Upgrading OpenWrt via opkg

I'm currently running OpenWrt 21.02.1 on a TP-Link TL-WDR3600 v1 and would like to upgrade to the latest stable version. Not sure how to do this, but wondered if there was an automated way of doing this eg by running something like

opkg upgrade firmware....

1 Like

Thanks for the link but I don't see:-

Go to System → Atttended Sysupgrade . You'll see the main Attended Sysupgrade window

Maybe my version does not have such an option.

Install luci-app-attendedsysupgrade first.

Does attendedsysupgrade really handle gracefully the major version upgrade from 21.02 with the iptables firewall3 to 22.03 with the nftables firewall4 ???

1 Like

As long as you don't have any custom rules or scripts that access iptables natively, it should.

Regarding the package selection ? Dropping the unnecessary iptables and firewall3 packages?

I feel that using an official release image for the 21.02 - 22.03 sysupgrade would be safer.

2 Likes

Thanks, but I have no space left on device!

Earlier, I tried installing midnight commander which failed because of lock of space after it had installed numerous dependent files. Is there any way to remove those dependencies?

The router has two USB slots, so maybe I can move some packages onto a USB stick...

root@OpenWrt:~# opkg install luci-app-attendedsysupgrade
Installing luci-app-attendedsysupgrade (git-22.210.54423-3b0b325) to root...
Downloading https://downloads.openwrt.org/releases/21.02.1/packages/mips_24kc/luci/luci-app-attendedsysupgrade_git-22.210.54423-3b0b325_all.ipk
Installing rpcd-mod-rpcsys (2022-02-19-8d26a1ba-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.1/packages/mips_24kc/base/rpcd-mod-rpcsys_2022-02-19-8d26a1ba-1_mips_24kc.ipk
Collected errors:
 * wfopen: //usr/lib/opkg/info/rpcd-mod-rpcsys.control: Read-only file system.
 * wfopen: //usr/lib/opkg/info/rpcd-mod-rpcsys.postinst: Read-only file system.
 * wfopen: //usr/lib/opkg/info/rpcd-mod-rpcsys.prerm: Read-only file system.
 * wfopen: /usr/lib/rpcd/rpcsys.so: Read-only file system.
 * pkg_write_filelist: Failed to open //usr/lib/opkg/info/rpcd-mod-rpcsys.list: Read-only file system.
 * opkg_install_pkg: Failed to extract data files for rpcd-mod-rpcsys. Package debris may remain!
 * opkg_install_cmd: Cannot install package luci-app-attendedsysupgrade.
2 Likes

It looks like I have 122 pkgs installed. Presumably most of those come with the base OpenWrt system. Is there any way to get back to the base system so that I can start again from scratch? ie is there a way to run 'opkg remove 'pkgs-not-included-in-base-build''?

Maybe I'll look at 'firstboot' and see where that gets me...

Just hope I'll be able to access my router again without too much difficulty...

After the jffs has crashed and become read-only (due to overfilling it), the only practical way to recover is to start over. Export the configuration, then re-flash or firstboot and install only necessary packages. You can use this opportunity to upgrade as well.

Unfortunately I can't seem to come up with a configuration which works properly.
I've done a reset a dozen times trying get my router to talk to my LAN so that I can apply an upgrade.

I think I will have to manually edit /etc/config/network to get a working system. Clicking on various option in the WebGUI has been counter productive so far.

there is nice documentation available https://openwrt.org/docs/start which probably answers most your questions. suggest to start there first. if not you can search the forum for same/similar topic, and of course you can ask new question too.

to your OP: opkg is not able to upgrade an openwrt image. there is sysupgrade for that, which tries to keep your settings (not always possible) but surely not keeping the installed packages you manually installed on top of the official image. it is the official upgrade tool - it is always re-flashing a full image, which is the recommended approach anyway.

the attenteded-sysupgrade custom package is designed to track your custom packages, do sysupgrade and then re-install tracked packages.

also there is Firmware Selector which helps you to find the right firmware and also able to customize an image with packages pre-installed so sysupgrade will re-flash device already containing those packages.

if you are out of space there are guides to extend storage.

1 Like

After a reset, am I correct in thinking the Web GUI does not come up until after a reboot?

I have found that I can ping the router on 192.168.1.1 and I can ssh in, but I don't see any /etc/config/network and httpd isn't running.

After a reboot I am able to access the Web GUI and if I can LAN2 to my network I can access the Internet. What I can't figure out is how to access the Internet if I use the WAN port as my Internet gateway.

I assume that the configuration is so messed up at this point that you should not try to save it.

Connect your PC to the Internet somehow and download the latest stable version sysupgrade firmware. Then connect PC to the router and use scp from your PC to push the firmware to the router's /tmp directory.

on the PC CLI
cd Downloads
scp filename root@192.168.1.1:/tmp

Note this works on Linux or Windows 10 in a Command Prompt window, and probably MacOS as well.

Then make a ssh connection to log into the router and run the upgrade:
on the router CLI
sysupgrade -n /tmp/filename
The router should close the SSH connection and commence to flash and reboot itself. Do not cut the power off! Wait about 5 minutes for the process to complete.

I managed to install the luci app to do an attended sysupgrade but it seems to search for ages.

I'd try manually but am not sure which file to download.

I'm not all that sure that my configuration is badly screwed up.
This is what my /etc/config/network consists of:-

config interface 'loopback'                                                                                                                                                                                                    
        option device 'lo'                                                                                                                                                                                                     
        option proto 'static'                                                                                                                                                                                                  
        option ipaddr '127.0.0.1'                                                                                                                                                                                              
        option netmask '255.0.0.0'                                                                                                                                                                                             
                                                                                                                                                                                                                               
config globals 'globals'                                                                                                                                                                                                       
        option ula_prefix 'fd16:725c:4c66::/48'                                                                                                                                                                                
                                                                                                                                                                                                                               
config interface 'lan'                                                                                                                                                                                                         
        option proto 'static'                                                                                                                                                                                                  
        option ipaddr '192.168.1.4'                                                                                                                                                                                            
        option netmask '255.255.255.0'                                                                                                                                                                                         
        option ip6assign '60'                                                                                                                                                                                                  
        option gateway '192.168.1.1'                                                                                                                                                                                           
        option device 'br-lan'                                                                                                                                                                                                 
        option broadcast '192.168.1.255'                                                                                                                                                                                       
                                                                                                                                                                                                                               
config switch                                                                                                                                                                                                                  
        option name 'switch0'                                                                                                                                                                                                  
        option reset '1'                                                                                                                                                                                                       
        option enable_vlan '1'                                                                                                                                                                                                 
                                                                                                                                                                                                                               
config switch_vlan                                                                                                                                                                                                             
        option device 'switch0'                                                                                                                                                                                                
        option vlan '1'                                                                                                                                                                                                        
        option ifname 'eth0.1'                                                                                                                                                                                                 
        option ports '2 3 4 5 0t'                                                                                                                                                                                              
                                                                                                                                                                                                                               
config device                                                                                                                                                                                                                  
        option name 'br-lan'                                                                                                                                                                                                   
        option type 'bridge'                                                                                                                                                                                                   
        list ports 'eth0.1'

All I want to do is use the WAN port rather than LAN2 to provide Internet access, but haven't found the magical formula yet...

Is this what I should use?

https://downloads.openwrt.org/releases/22.03.2/targets/ath79/generic/openwrt-22.03.2-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin

  1. this thread is turned to something totally different than OP - probably better to close this thread and open a new one.
  2. your network config is absolutely different than your statement: there is no sign of wan or lan2. where are those defined?