How to upgrade without losing config and installed softwares?

Is this possible? How?

Thank you.

Regarding the configs:
It is possible to save the config.

In the LuCI web GUI, you go to Backup / Flash Firmware and click the button beside "Download backup:" that says "Generate Archive."

It will download a file with the current config.

Regarding installed software:
Since the downloaded packages are different for each version, you will have to reinstall the packages after flashing the upgrade.

NOTE: In OpenWRT, you can flash in-place (keeping the config). This option is also located on the Backup / Flash Firmware page.

2 Likes

So this scenario is possible:

1] Save the config
2]Flash the updated firmware without saving the config, all settings turn to default and every installed software and modified config deleted as a result.
3] Installing all the software
4] Restoring the saved config in 1]
5] Everything works as before except the firmware is the latest

1 Like

Your scenario is possible except if there are material changes to the packages features etc which make the old configs for that package not work.

also, you can flash the new software while retaining the old config by checking a box in LuCi, but still: do the backup first just in case.

2 Likes

you can back up configs by editing "sysupgrade.conf" file to include the directories to be backed up.

This make your config persistent across FW upgrades.

1 Like

This might come in handy:

After upgrade, OpenWRT keeps /etc/ directory and rc.local file in it. This file contains commands that will be run after system init finishes.You can add

opkg update && opkg install <packages>

So once firmware upgrades, it will install the packages you need. You can make it a bit more automated if you create a file with all packges and parse them in rc.local. Just remember that these commands will be run every time you reboot so it would be a good idea to remove them after firmware upgrades and packages get install.

Then the next step is to reboot...subsequently scripting the reboot alone will then cause a boot loop for the user...even if setup as a timed cron job instead!!!

Please do not follow these directions before you:

See: Cron reboot loop - #3 by lleachii
and: Sysupgrade >>auto reinstall<< packages - #2 by lleachii (I offer an example on how to to reinstall Wireguard after an upgrade)

1 Like

You're right. I should've included some better warnings. These commands are run every time it boots. Please be careful

As a matter of fact, I used this to make sure router has wireguard installed after upgrade, just didn't find your example. Thanks for notice!