Download built OpenWRT firmware from a router as backup

I’ve spent some time installing OpenWRT on a gl-iNet MT6000 (Flint 2) router, and have manually installed a number of other packages, from various repos… I believe I can download a list of the packages from the router, but I’d ideally like to download (to my local computer) the whole firmware (as a .bin maybe) so I can just re-install it at a later date.

This would be especially useful as I have a habit of installing too many (or maybe incompatible) packages and bricking the firmware, and have to start from scratch again. A copy of the full, working firmware before I broke it would be really useful!

Is there a way to do this, please?

You have target sysupgrade image link in luci-app-attendedsysupgrade
You have to back up config via system/ normal upgrades, this includes what sysupgrade -L "sees"

Attended sysupgrade can do just this.

OK, thanks. I have installed this but I’ve a number of packages from someone else’s repo and I get a whole slew of errors because attendedsysupgrade can’t ‘see’ the repo.

This doesn’t quite seem to do what I want - all I want to do is dump out the whole firmware (as it is now) from the router?

Ask "someone else" then, we can not help you with that.

Sorry, I don’t think I am explaining myself clearly!

I just want to dump out as a .bin file, the firmware that is on the router - as a .bin file I can reinstall later again…

related Configuring own ASU on custom hardware - #2 by efahl ?

It is not that easy.
The ".bin file" (on your PC) was the original firmware image, and you have then modified that.

openWrt has no direct "whole current system" export functionality.

As long as you only install packages from the official OpenWrt download repos, the Attendedsysupgrade etc. can cook up the corresponding image, but as you have installed third-party packages download from somewhere, it will not be possible, as you have noticed.

Best alternative to keep archiving the original firmware and the seaprate .ipk/.apk package files that you have downloaded and installed from elsewhere.

Ps. Contrary to your message title, you are not looking to "download the built firmware", but to create a new image with all your later modifications/installations included.

Yes, that’s what I do, and I copy them across with WinSCP and manually install them…

I can see that my title could be misconstrued, but I know what I meant!!

Ooo, external package feeds. That looks like what I want - to include a 3rd party repo (there is only one I need) and use that in combination with the standard OpenWRT source, to build a complete package.

Thanks, I will have a look at that!

problem is, there's only you in your head, we're not ,)

Just to state the concepts.

OpenWrt is designed from the ground up, you can easily build/ compile an image with local modifications - but you can't (easily/ safely) export an installed/ runtime modified image from your router.

Yes, technically it is 'possible' to accomplish this nevertheless, but details of how to do that would by highly device specific (what flash type, how it's organized and partitioned, etc.) - and writing this back would be very-very-very dangerous, as you'd bypass all normal sanity checks, while at the same time dealing with extremely device specific procedures (and things that do change over time, NAND, ECC/ wear-leveling is a guarantee for nightmares (very, very easy to hard-brick the router for good, non-recoverably). Do not even think about this (the 'restore' step) without knowing exactly what you're doing - and those who do, won't.


Now for a more constructive alternative, make your system upgrade safe.
This means documenting your config (declaring all conffiles and taking backups of the overlay contents) and your desired addon-packages, to an extent that you can just use owut to upgrade to the next point release without thinking. Yes, depending on 3rd party packages makes that not quite as easy as owut, but you can still get it to that point using the offline imagebuilder or building from source.
tl;dr: spend some time now, while the details are fresh in your head, to make your sysupgrade experience fool-proof, from the ground up - don't try to hack a full system restore together that would likely kill your router.

OK, many thanks for ELI5… I have copies of all the packages I manually install saved - it’s just a bit of extra hassle to have to re-install them from terminal when I break the firmware!