How to do proper backup router settings via ssh

Hi
I lost access to the admin panel and luci interface.
I need backup some of the router settings.
I performed a backup before the NGINX crash and luci created tar.gz archive
inside are files from made by the command sysupgrade .
I suppose that I will migrate from GLiInet firmware to OpenWRT firmware, so I do not need backup GL-Inet specific settings.
according to advice in [[OpenWrt Wiki] Backup and restore] sysupgrade is available and suitable to do backup/restore
is anyone who has experience with a similar problem and give me some advice?
Or just simply copy some settings to USB stick ?

The usual way is to create a luci backup and install the firmware again. When you migrate between different firmware, you need to open each config file and adopt it — there is no way to migrate seamless.

Basically the procedure is like this:

  • Be on firmware XYZ
  • Create backup of config files using luci
  • Get back on firmware XYZ
  • Install config backup using luci
1 Like

You can use the luci functionality through:

sysupgrade -b /tmp/backup.tar.gz

Then use winscp (works similar as ftp), use protocol scp and username root, password same as ui.

You can open these backups with 7zip my advise:

Cherry pick the configs on /etc/config so you don't accidentally copy the breaking configuration in case those changes did actually did something to /etc/nginx and also was tracked in the backup to avoid the same breakage again.

You can also strip these tar.gz backup files by removing everything unneeded, if you then use a fresh reset, then it won't overwrite those changes.

Only make sure the folder structure keeps intact. For /etc/

When migrating see @admon post, not all config is compatible so check carefully, hardcoded wireless devices can be different as one example, the vpn surely will be, and maybe also the network, always make sure when picking firmware images to go with the sysupgrade ones, this will preserve the u-boot recovery mechanism which can be really helpfull compared to OpenWrts version of it (the factory image).

1 Like

When I will want to restore settings after hard reset firstboot -y && reboot:
should I perform
sysupgrade -r -i -v /root/backup.tar.gz
it should be in interactive mode so only chosen configs which might be restored ?
or do you advise remove from backup.tar.gz all ngnix and luci related configs ( mean files ) ?
I'm aware that I will have to manually install user pakages .
I do not have it too much :
mc ,luci-samba nano, vim

Yes this ^, the backup will just work via luci here.

If you open the generated tar.gz file and click on etc, just delete nginx, and maybe everything else except for the path /etc/config.

Now you have a extremely light stripped backup which only copies over the main configuration nothing else or remnants.

For Migration:

Then you may also choose to delete wireless or manually update the entries to work with the new comfiguration.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.