OpenWRT backup and network config corrupted

Today i wanted to try something new on my OpenWRT router… And while meddling with files by accident i corrupted network settings. I was unable to access it neither through LUCI, nor even SSH. I quickly found DHCP must have not been working, but even manually configuring network card did not helped. What to do?

Fortunately OpenWRT has Failsafe Mode. To get to i I had to reset my router with power button, wait some time until power LED started to blink 5 times a second, then press one of the buttons on it’s back and then LED started blinking even faster informing about Failsafe Mode enabled.

Then I had to connect my PC to eht0 interface (it was connected to second port, so I just switched cables), configure it’s IP manually and I was able to finally get to it with SSH and WinSCP.

Unfortunately it was not end of problems. I’ve tried hard- and soft-resetting it, but was unable to.

root@ (none):~# firstboot
root@ (none):~# umount /overlay && jffs2reset && reboot

Neither of those commands worked, after either of them I’ve got:

/dev/ubi0_1 is not mounted
/dev/ubi0_1 will be erased on next mount

But after reboot issue was still the same. I’ve tried using


But this forced router to read network configuration from corrupted file and it was inaccessible again.

In the end I downloaded upgrade image for my router from and flashed it in Failsafe Mode, for that I copied image to /tmp using WinSCP and installed it

sysupgrade -n /tmp/openwrt.bin

Finally after that everything started to work and I had clean OpenWRT installation on my router.

Then the second part – getting everything to work again.

Fortunately before I’ve started meddling around guts of my router I made backup of configuration using LUCI System -> Backup / Flash Firmware -> Generate archive. Now I was able to just use option “Upload archive…” to get all configuration files back.

Bigger problem was packages – I copied /overlay to my PC, but unfortunately I did that just with plan copy/paste in WinSCP, pasting it back just didn’t worked. In the end I just used ‘/overlay/upper/usr/lib/opkg/status’ as guide which packages to install (and which not used ones to ignore).

Now reboot, and… Everything seems to be working fine. Uff. If I would need to configure everything form scratch… 🙂

In the end I backed up config again and backed up also /overlay this time using:

tar -cvzf /tmp/overlay.tar.gz /overlay

And copied resulting file to my PC for safekeeping, where it is backed up multiple ways. In case if I would need to restore I can do it with:

cd /; tar -xvzf /tmp/overlay.tar.gz

We all learn by our mistakes, so now I’d be more cautious. And also maybe it would be good idea to buy second same device for experimenting…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.