Extroot: HELP for installing/reverting

Hi everybody. It's the first time I'm posting here in this forum. I present myself as an IT passionate even if with a very low expertise. It was a long time I was trying to manage my network with OpenWrt. I tried a first time with my TD-W8970 v1.2, solding pins on the motherboard but, unluckily I wasn't able to connect via the usb-serial adapter. Luckily my router didn't get bricked. Finally, I recently found a second-hand TD-W8970 v1.2 with OpenWrt already installedand I'm having fun since two days....but.... Today I began trying to activate extroot but, now it seems that I followed the wrong guide on youtube.
I'm running this firware version OpenWrt 19.07.4 r11208-ce6496d796
LuCI openwrt-19.07 branch git-20.247.75781-0d0ab01
Kernel 4.14.195
First of all I run opkg update and installed:
block-mount
kmod-fs-ext4
kmod-usb-storage
kmod-usb-ohci
kmod-usb-uhci
e2fsprogs
fdisk
I rebooted the device
Then I formatted a 2GB microsd (1 primary ext4 partition of 512MB, 1 primary ext4 partition of 1GB, 1 primary linuxswap partition), and I run the following commands:
/etc/init.d/fstab enable
block detect > /etc/config/fstab
vi /etc/config/fstab, changing /dev/sda1 to /overlay, /dev/sda2 to /mnt and changing "enable" from 0 to 1.
Then I run:
mount --bind / /tmp/extroot
mkdir /tmp/system
mount /dev/sda1 /tmp/system
tar -C /tmp/extroot -cvf - . | tar -C /tmp/system -xf -
These are the info I can give to let understand what I did.
Now the situation is:
extroot doesn't work
I had to make a 30-30-30 reset to access again my router and even I was able to access it again letting it work there is something wrong because block info gives me this situation:
/dev/mtdblock3: UUID="0fee5930-8fbf6dcf-91c66017-318f80be" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
that's it, no overlay and no other partition.
I understand that I'm asking for help after having done something about which I had very few knowledge but I'm guessing if I will be able to install correctly extroot or, at least, to be able to go back to the normal configuration.
Thank you

1 Like

Hello Vladislav. Thanks for your prompt response. I tried it but it didn't work. The situation is the same as before. If you are willing to help me further, I post some commands details:

  • block info is showing only:
    */dev/mtdblock3: UUID="0fee5930-8fbf6dcf-91c66017-318f80be" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"*

  • cat /etc/config/fstab is showing only:

  *config global*
*option anon_swap '0'*
*option anon_mount '0'*
*option auto_swap '1'*
*option auto_mount '1'*
*option delay_root '5'*
*option check_fs '0'*
  • df -T is showing:
  *Filesystem           Type       1K-blocks      Used Available Use% Mounted on*
*/dev/root            squashfs        3584      3584         0 100% /rom*
*tmpfs                tmpfs          29092       264     28828   1% /tmp*
*tmpfs                tmpfs          29092        60     29032   0% /tmp/root*
*tmpfs                tmpfs            512         0       512   0% /dev*
*/dev/mtdblock4       jffs2           2432      1720       712  71% /overlay*
*overlayfs:/overlay   overlay         2432      1720       712  71% /*

Finally, it seems that none of the usb keys I connect to the router are identified.
Thanks for any suggestion you'll give me

1 Like

Install the drivers, then attach a USB flash and check:

ls -l /sys/block

Ciao Vladislav, before trying the last instructions you gave to me, I wasn't able to access the router anymore. Then, I had to reset it once more but, this time, after having switched it off, I pressed the on button and left it pressed for 10 seconds. After I was able to access it again, I saw the everything was reverted to the beginning...no root password set, no additional software installed (all the packets indicated in the Extroot configuration page). Now I set it up again the interfaces (lan and wifi) and already installed again the requested packet for extroot as indicated in the above-mentioned instructions page. I run block info and now the output is:

/dev/mtdblock3: UUID="0fee5930-8fbf6dcf-91c66017-318f80be" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock4: MOUNT="/overlay" TYPE="jffs2"

It seems that now everything was reverted to the initial situation. Maybe the ten seconds pression on the on button effectively performed a hard-reset.
Moreover, I put a usb stick and it was correctly recognized after having run block info as specified below:

/dev/mtdblock3: UUID="0fee5930-8fbf6dcf-91c66017-318f80be" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock4: MOUNT="/overlay" TYPE="jffs2"
/dev/sda: UUID="2015-08-05-08-12-01-00" LABEL="2.4.2-32-amd64" TYPE="iso9660"
/dev/sda1: UUID="2015-08-05-08-12-01-00" LABEL="2.4.2-32-amd64" TYPE="iso9660"
/dev/sda2: UUID="4D0E-5933" LABEL="OCS-EFI" VERSION="FAT12" TYPE="vfat"

Now, do you think I can proceed trying again to set the extroot with the instructions in the above-mentioned page?

Thanks

opkg update && opkg install block-mount kmod-fs-ext4 kmod-usb-storage kmod-usb-ohci kmod-usb-uhci e2fsprogs fdisk

connect usb stick which was previously formatted with ext4.

Now we configure /dev/sda1 as new overlay via fstab uci subsystem:

DEVICE="/dev/sda1"
eval $(block info "${DEVICE}" | grep -o -e "UUID=\S*")
uci -q delete fstab.overlay
uci set fstab.overlay="mount"
uci set fstab.overlay.uuid="${UUID}"
uci set fstab.overlay.target="/overlay"
uci commit fstab

Transferring the data

We now transfer the content of the current overlay inside the external drive:

mount /dev/sda1 /mnt
cp -f -a /overlay/. /mnt
umount /mnt

Reboot the device:

reboot

Ciao everybody and thanks for your support.
After having struggled to revert my router to an initial situation I followed kukulo instructions as also presented in the Extroot configuration page in openwrt.org. But it didn't work, settings are the same as before.
Here you are block info

/dev/mtdblock3: UUID="0fee5930-8fbf6dcf-91c66017-318f80be" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock4: MOUNT="/overlay" TYPE="jffs2"
/dev/sda1: UUID="aad4370c-3c9c-46a6-8cdd-75244afe0d18" VERSION="1.0" TYPE="ext4"
/dev/sda2: UUID="1f28d1ae-ffb9-4869-9a93-ac7f75a44bc5" VERSION="1" TYPE="swap"
/dev/sda3: UUID="5e82cc5f-5343-49f1-a24a-76c8f51087e2" VERSION="1.0" TYPE="ext4"

Then I give you df -h

Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.5M      3.5M         0 100% /rom
tmpfs                    28.4M    256.0K     28.2M   1% /tmp
/dev/mtdblock4            2.4M      1.7M    720.0K  70% /overlay
overlayfs:/overlay        2.4M      1.7M    720.0K  70% /
tmpfs                   512.0K         0    512.0K   0% /dev

Then cat /etc/config/fstab

config global
	option anon_swap '0'
	option anon_mount '0'
	option auto_swap '1'
	option auto_mount '1'
	option delay_root '5'
	option check_fs '0'

config mount 'overlay'
	option target '/overlay'

Then grep -e /overlay /etc/mtab

/dev/mtdblock4 /overlay jffs2 rw,noatime 0 0
overlayfs:/overlay / overlay rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work 0 0

Then *df /overlay /"

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mtdblock4            2432      1712       720  70% /overlay
overlayfs:/overlay        2432      1712       720  70% /

Finally the logread | sed -n -e "/- preinit -/,/- init -/p"

Sun Oct  4 18:37:05 2020 user.info kernel: [    5.411309] init: - preinit -
Sun Oct  4 18:37:05 2020 kern.info kernel: [    5.899841] usb 2-1: new high-speed USB device number 2 using dwc2
Sun Oct  4 18:37:05 2020 kern.notice kernel: [    9.876014] jffs2: notice: (496) jffs2_build_xattr_subsystem: complete building xattr subsystem, 6 of xdatum (3 unchecked, 3 orphan) and 51 of xref (5 dead, 2 orphan) found.
Sun Oct  4 18:37:05 2020 user.info kernel: [    9.928252] mount_root: loading kmods from internal overlay
Sun Oct  4 18:37:05 2020 user.info kernel: [   10.373311] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
Sun Oct  4 18:37:05 2020 kern.notice kernel: [   11.095270] SCSI subsystem initialized
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.145485] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.151528] ohci-platform: OHCI generic platform driver
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.175302] uhci_hcd: USB Universal Host Controller Interface driver
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.211935] usb-storage 2-1:1.0: USB Mass Storage device detected
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.217324] usb-storage 2-1:1.0: Quirks match for vid 090c pid 6000: 100000
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.224023] scsi host0: usb-storage 2-1:1.0
Sun Oct  4 18:37:05 2020 kern.info kernel: [   11.229023] usbcore: registered new interface driver usb-storage
Sun Oct  4 18:37:05 2020 user.info kernel: [   11.234469] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
Sun Oct  4 18:37:05 2020 user.info kernel: [   11.638792] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
Sun Oct  4 18:37:05 2020 user.info kernel: [   11.664719] block: extroot: not configured
Sun Oct  4 18:37:05 2020 user.info kernel: [   11.682675] mount_root: switching to jffs2 overlay
Sun Oct  4 18:37:05 2020 kern.warn kernel: [   11.730279] overlayfs: upper fs does not support tmpfile.
Sun Oct  4 18:37:05 2020 user.warn kernel: [   11.752277] urandom-seed: Seeding with /etc/urandom.seed
Sun Oct  4 18:37:05 2020 user.info kernel: [   11.967511] procd: - early -
Sun Oct  4 18:37:05 2020 user.info kernel: [   11.969291] procd: - watchdog -
Sun Oct  4 18:37:05 2020 kern.notice kernel: [   12.250128] scsi 0:0:0:0: Direct-Access     Generic                   6000 PQ: 0 ANSI: 0 CCS
Sun Oct  4 18:37:05 2020 kern.notice kernel: [   12.264504] sd 0:0:0:0: [sda] 3970048 512-byte logical blocks: (2.03 GB/1.89 GiB)
Sun Oct  4 18:37:05 2020 kern.notice kernel: [   12.271814] sd 0:0:0:0: [sda] Write Protect is off
Sun Oct  4 18:37:05 2020 kern.debug kernel: [   12.275343] sd 0:0:0:0: [sda] Mode Sense: 4b 00 00 08
Sun Oct  4 18:37:05 2020 kern.err kernel: [   12.276518] sd 0:0:0:0: [sda] No Caching mode page found
Sun Oct  4 18:37:05 2020 kern.err kernel: [   12.280853] sd 0:0:0:0: [sda] Assuming drive cache: write through
Sun Oct  4 18:37:05 2020 kern.info kernel: [   12.309310]  sda: sda1 sda2 sda3
Sun Oct  4 18:37:05 2020 kern.notice kernel: [   12.317281] sd 0:0:0:0: [sda] Attached SCSI removable disk
Sun Oct  4 18:37:05 2020 kern.info kernel: [   12.727912] lantiq,xrx200-net 1e108000.eth eth0: port 4 lost link
Sun Oct  4 18:37:05 2020 user.info kernel: [   12.817687] procd: - watchdog -
Sun Oct  4 18:37:05 2020 user.info kernel: [   12.820491] procd: - ubus -
Sun Oct  4 18:37:05 2020 user.info kernel: [   13.094040] procd: - init -

Now, I really don't know whatelse I can try.

Thanks

What is the output of

cat /etc/fstab

?

# <file system> <mount point> <type> <options> <dump> <pass>

it seems void

block info /dev/sda1

then it outputs something like this:

/dev/sda1: UUID="a3256256-c27e-4dbc-819a-b9d4f94e2556" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"

uci -q delete fstab.overlay

then change UUID to your UUID in the block info command output

uci set fstab.overlay="mount"
uci set fstab.overlay.uuid="a3256256-c27e-4dbc-819a-b9d4f94e2556"
uci set fstab.overlay.target="/overlay"
uci commit fstab

then reboot

It answers

uci: Invalid argument

after the uci set fstab.overlay.target="/overlay"

Did you do a

uci -q delete fstab.overlay

before?

I'd say yes.....here you are the details

root@OpenWrt:~# uci -q delete fstab.overlay
root@OpenWrt:~# uci set fstab.overlay="mount"
root@OpenWrt:~# uci set fstab.overlay.uuid="aad4370c-3c9c-46a6-8cdd-75244afe0d18"
root@OpenWrt:~# uci set fstab.overlay.target="/overlay"
uci: Invalid argument

Tried again, now it worked.....weird. The router is rebooting, let's see

To verify do a simple df command.

I think it worked

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 3584      3584         0 100% /rom
tmpfs                    29092       252     28840   1% /tmp
/dev/sda1               499656      3852    459108   1% /overlay
overlayfs:/overlay      499656      3852    459108   1% /
tmpfs                      512         0       512   0% /dev
1 Like

Congratulations, you have a working extroot now.

Thank you all, guys!!!!!! Especially for the patience with a newbie like me

You can mark the thread closed by ticking the solution on respective post.

I guess I already did it at post #10