Script: upgrade firmware with backup - locally or remotely

Backup/restore script for GL.iNet routers: keep your config through the "factory reset + new firmware" step

After the security notice told us to factory reset and install the upcoming firmware, I was surprised
that GL.iNet routers have no built-in backup/restore in the admin panel (without using LuCI)

That's a real problem for routers at remote sites. If nobody is there to press Reset and set the router up again, a factory reset isn't an option.

So, with some testing (and help from Claude), I wrote a small script that does the job. It runs on the router itself: one file, busybox sh, nothing to install.

  • Backup: saves the same file set LuCI saves, using the firmware's own sysupgrade -b, including the GL.iNet-specific settings.
  • Restore: puts the files back where they belong. It shows a preview first, checks the model and firmware, flags files that control logins and startup, takes a snapshot of the current state, and verifies the result.
  • Firmware upgrade with your config: the instructions show how to combine it with the upgrade using sysupgrade -f backup.tar.gz firmware.bin. (the Github page has a tiny script which detects your router and downloads the firmware.bin for your router). This flashes the new firmware and installs your backup as its configuration, so the router comes back already configured. No Reset button, and nobody has to be on site. It also covers downloading the firmware on the router and checking its SHA-256.

Things to know:

  • The fixed firmware isn't out yet, so don't reinstall the old version.
  • If a router may be compromised, a restore can bring the attacker's changes back. Review the files the script flags before restoring.
  • I tested the pieces (a sandbox plus read-only checks on a Flint 3), but not yet a full flash and restore on real hardware. Please try it on a router you can reach first.
  • The Flint 3 appears to have a single firmware partition, so a failed flash could need physical recovery.

Script and instructions (MIT licence): GitHub - dorinxev/gl.inet-routers-backup: Config backup & restore for GL.iNet / OpenWrt routers — one shell script that runs on the router · GitHub

Feedback, bug reports and test results are welcome.

Hi,

Thanks for sharing the script, Dorin!

If your router is running firmware v4.7 or later and already has GoodCloud remote web access enabled, you can also export a backup remotely through LuCI. Select your router in GoodCloud, open Remote GUI, and enter LuCI’s HTTP port (8080 by default).

For more details: Access the LuCI via GoodCloud - GL.iNet Router Docs 4

In addition, we have also released firmware fixes for some models. You can get them as follows: