Firmware version from Archive

The archive compressed file created as bundle of etc/config files and saved as backup.tar.gz file.

I wonder if there is a way for us to look into this archive to find out what firmware level this backup was taken at. Say a backup taken on 18x release should not accidentally get restored to 21x release. I realize that the date of the backup can often give a clue and we may also develop some protocol around renaming the file to include release level...

It will be nice to be able to take in look inside the bundle and know for sure what firmware took this backup.

Please let me know.


Not really, apart from the dates and guessing based on subtile (default-) config differences.


It will be a good if we could add that. My use cases are not as complicated except memory decay!

I think the file /etc/firewall.user went missing after the release 19. Is that true?


1 Like

It won't be used for 22.03~ an upwards.


Thank you so much. I wonder how I can make a request for devs to consider. Also I noticed that /etc/opkg has keys that has some rev level notations.


An easy workaround would be to include /etc/openwrt_version (or whatever file contains the release info) into your backup tarball through /etc/sysupgrade.conf.

I believe that file contains all the details you need.

Easy solution for getting it into the archive, but the side-effect would be for it to also remain ovet upgrades on the running system (which is not wanted and also breaks the purpose here).

True enough. A wrapper around sysupgrade might help there, to store the revision into a separate file that gets included in the tarball then.

Yeah... This is a good solution.

Is there a real file /etc/openwrt_version or /etc/sysupgrade.conf?


Yes. Both are part of a standard vanilla OpenWrt image.

root@OpenWrt:~# cat /etc/openwrt_version

There's also /etc/openwrt_version which contains more info and can be sourced easily.

But as @slh pointed out, backing up that file would make you restore it as well, overwriting the original file on your new firmware. So I'd advise to write a wrapper script, e.g.:


. /etc/openwrt_release

sysupgrade -b "/tmp/backup-$(cat /tmp/sysinfo/board_name)-$DISTRIB_REVISION.tar.gz"

That would yield a file like /tmp/backup-mikrotik,rb5009-r19394+27-ee4a765090.tar.gz e.g. If you don't like the revision being in the file name, you can always grep /etc/openwrt_release and store the revision value in another file that you include in /etc/sysupgrade.conf.

It just occurred to me that if in the file rc.local we store a copy command...

cp /etc/opkg/distfeeds.conf /etc/config/hold_for_check_distfeeds.conf

This might do the trick. If we are really keen to find out what version this backup was taken.
Or perhaps rsync at 1:00am every day.

What do you think?


Does that file contain a revision?

/etc/config/ is purposely for UCI generated configuration files.

I posted this merely to show that as a work around. The sources do point to release number. The content of my router:

root@NEWIFI-GW:~# cat  /etc/opkg/distfeeds.conf
src/gz openwrt_core
src/gz openwrt_base
src/gz openwrt_luci
src/gz openwrt_packages
src/gz openwrt_routing
src/gz openwrt_telephony

Sure, but /etc/openwrt_version is way more detailed. If you stick to official stable releases, you might not need that info of course. But I myself find it to be more helpful than checking the feeds.

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