Fixing extroot

Hello all,
I've successfully updated my main router ( Netgear WNDR3700 version 1) to 18.06.4, the only problem is I was using extroot on a USB drive to install extra packages from opkg.

Currently I'm stuck in a situation where trying to save any changes using luCI results in the following

.

I'm assuming this is because all the packages installed using opkg while on 17.04 are obsoleted. What's the best way to correct this situation? I'm okay with yanking the pendrive out and redoing extroot from scratch I'd just prefer not to lose all my wifi / host / ssh-key data if possible.

Can you SSH the device?

yes I can ssh into the router easily.

Do you have GNU tar installed?
What's the output of sysupgrade -l? (Just confirm that it's a long list of files)

root@LEDE:~# sysupgrade -l
/etc/config/cjdns
/etc/config/dhcp
/etc/config/dropbear
/etc/config/firewall
/etc/config/fstab
/etc/config/luci
/etc/config/network
/etc/config/rpcd
/etc/config/system
/etc/config/ubootenv
/etc/config/ucitrack
/etc/config/uhttpd
/etc/config/unbound
/etc/config/upnpd
/etc/config/vnstat
/etc/config/wireless
/etc/crontabs/root
/etc/dropbear/authorized_keys
/etc/dropbear/dropbear_rsa_host_key
/etc/e2fsck.conf
/etc/fw_env.config
/etc/group
/etc/hosts
/etc/inittab
/etc/luci-uploads/.placeholder
/etc/opkg.conf
/etc/opkg/keys/1035ac73cc4e59e3
/etc/opkg/keys/5151f69420c3f508
/etc/opkg/keys/72a57f2191b211e0
/etc/opkg/keys/792d9d9b39f180dc
/etc/opkg/keys/9ef4694208102c43
/etc/opkg/keys/b26f36ae0f4106d
/etc/opkg/keys/b5043e70f9a75cde
/etc/opkg/keys/c10b9afab19ee428
/etc/opkg/keys/dace9d4df16896bf
/etc/opkg/keys/dd6de0d06bbd3d85
/etc/passwd
/etc/ppp/options
/etc/profile
/etc/rc.local
/etc/services
/etc/shadow
/etc/shells
/etc/sysctl.conf
/etc/unbound/unbound.conf
/etc/unbound/unbound_ext.conf
/etc/unbound/unbound_srv.conf
/etc/vnstat.conf

That's the lisf of files that the system will try to backup (and that we want to backup and restore after reformating the extroot). I don't see your SSH keys. What's the ouput of sysupgrade -l -o -u?
Do you have GNU tar installed?

root@LEDE:~# tar -v
BusyBox v1.28.4 () multi-call binary.

I'm assuming the keys are stored in '/etc/dropbear/authorized_keys' properly which is in that list.

Well, in that case:
Perform a backup: sysupgrade -b /tmp/backup.tar.gz. Grab the file with scp, remove your external root and let the device boot fresh.

Then, reformat the extroot and re-enable but this time try to use an external overlay instead of an external root. That way, you can easily perform an upgrade given that you have backup tar and you will not need to copy anything or reformat anything.

Once your device runs from a clean external overlay, go to LuCI in the Firmware section and upload your file to the "Restore settings" button.

Thanks I'll try it!

Could you point me to something where I could read about the differences of external overlay vs external root?

I thought I was using overlay already, I had followed these instructions originally when setting it up.

Mainly the mount point. The external overlay is a feature used by OpenWrt for mounting a RW filesystem over the ROM which you install. This allows you changing where packages are installed and performing factory resets.
The rootfs is a kernel feature and it tells the kernel where is the root it should use to boot. It can be any "mountable" filesystem or an initamfs.

So, in the overlay there are actually two layers. The rootfs of the kernel will remain untouched but the kernel will merge both the rootfs and your overlay making them look like an unique filesystem.

Also: after restoring your settings from the backup, remember that it will override your fstab so you will likely end up with a device without external overlay upon reboot. To fix this, you will need to unpack the backup, delete the /etc/config/fstab file and repack the backup. LuCI only accepts .tar.gz and you will need to preserve all permisions.

--- Manually fixing the extroot will work but more reboots are requiered...

1 Like

Yes, OpenWrt's upgrade process does not handle extroot very well. You should boot without the pen drive, upgrade and reconfigure, then start the extroot process again with an empty device. Of course, be free to keep any config files.

1 Like

what am I backup up exactly with that backup?

settings that can be applied to the non-extroot router?

I've removed the extroot device and rebooted the router which fixed being unable to save settings in LuCI but lost many configuration settings too.

Is there a way to selectively bring back settings from that backup I took?

For more information about the command: https://openwrt.org/docs/techref/sysupgrade

Also: for selectively restoring your settings you will have to unpack, modify and repack your backup. Of course, you'll need to do that in a Unix filesystem with either the root account or the fakeroot from Debian, because the tar contains very important permissions (i.e. dropbear/openssh will refuse to use keys without correct permissions).

I did not created that command, that's why I asked if you had GNU tar (not in the router, you can install it in macOS using Macports).

1 Like