OpenWrt Forum Archive

Topic: Extroot problem

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

After following the wiki for extroot, I ran into problems after rebooting. The mount points show nicely in LuCi, however the free space hasn't increased. In the shell I do not see any extra mountpoints, only the swap is enabled.

Could anyone give me some pointers?

My system:

System
Hostname    OpenWrt
Model    ZyXEL P-2812HNU-F1
Firmware Version    OpenWrt Chaos Calmer 15.05.1 / LuCI 15.05-149-g0d8bbd2 Release git-15.363.78009-956be55)
Kernel Version    3.18.23

Luci system mountpoints screenshot: i.imgur.com/92ICh4A.png

Mounted file systems
rootfs  / 105.11 MB / 111.56 MB 6% (6.45 MB)
ubi0:rootfs / 105.11 MB / 111.56 MB 6% (6.45 MB) 
tmpfs /tmp 60.35 MB / 61.03 MB 1% (700.00 KB)
tmpfs /dev 512.00 KB / 512.00 KB 0% (0.00 B) 

Mount Points
UUID: 9f02e83f-16e3-4c9f-8532-8db7f5ea004f (/dev/sda1, 10240 MB) /overlay ext2 defaults overlay no
UUID: b909f187-bbbc-49ea-8fd2-b9deba01dc8e (/dev/sda3, 465675 MB) /mnt/sda3 ext2 defaults no no 

SWAP
/dev/sda2 (1024 MB) 

ssh responds:

root@OpenWrt:/mnt# mount
rootfs on / type rootfs (rw)
ubi0:rootfs on / type ubifs (rw,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
root@OpenWrt:/mnt# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                  111.6M      6.5M    105.1M   6% /
ubi0:rootfs             111.6M      6.5M    105.1M   6% /
tmpfs                    61.0M    700.0K     60.3M   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/mnt# block info
/dev/ubi0_0: UUID="3e569e82-f5e8-400e-9cb8-222bb8a07aaf" VERSION="w4r0" TYPE="ubifs"
/dev/sda1: UUID="9f02e83f-16e3-4c9f-8532-8db7f5ea004f" VERSION="1.0" TYPE="ext2"
/dev/sda2: VERSION="1" TYPE="swap"
/dev/sda3: UUID="b909f187-bbbc-49ea-8fd2-b9deba01dc8e" VERSION="1.0" TYPE="ext2"
root@OpenWrt:/mnt# 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'
    option    target    '/overlay'
    option    uuid    '9f02e83f-16e3-4c9f-8532-8db7f5ea004f'
    option    enabled    '1'

config 'swap'
    option    device    '/dev/sda2'
    option    enabled    '1'

config 'mount'
    option    target    '/mnt/sda3'
    option    uuid    'b909f187-bbbc-49ea-8fd2-b9deba01dc8e'
    option    enabled    '1'

(I've changed delay_root to 15. Didn't help.)

The odd thing I could find is that dmesg shows that it doesn't understand ext4 nor ext3 nor ext2:

[    5.668000] scsi 0:0:0:0: Direct-Access     WDC WD50 00BEVT-00A0RT0        PQ: 0 ANSI: 6
[    5.676000] sd 0:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB/465 GiB)
[    5.684000] sd 0:0:0:0: [sda] Write Protect is off
[    5.688000] sd 0:0:0:0: [sda] Mode Sense: 3b 00 00 00
[    5.688000] sd 0:0:0:0: [sda] No Caching mode page found
[    5.692000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    5.740000]  sda: sda1 sda2 sda3
[    5.744000] sd 0:0:0:0: [sda] Attached SCSI disk
[    8.056000] mount_root: mounting /dev/root
[    8.060000] mount_root: loading kmods from internal overlay
[    8.256000] block: attempting to load /etc/config/fstab
[    8.264000] block: extroot: filesystem ext2 not supported by kernel
[    8.280000] procd: - early -
[    8.280000] procd: - watchdog -
[    8.596000] Adding 1048572k swap on /dev/sda2.  Priority:-1 extents:1 across:1048572k 
[    8.864000] procd: - ubus -
[    9.876000] procd: - init -

(I reformatted the partitions to check all 3 formats.)

(Last edited by Markismus on 11 Jan 2017, 21:49)

You need kmod-fs-ext4 installed in the internal flash.  It also supports ext2 and ext3.

Thanks!

Found that out with modprobe, too. (Somehow deinstalled it, because I thought it was already in the kernel. Stupid!) Now both the swap and data partition are mounted at boot. However, doesn't solve the extroot problem, but changed the message in dmesg:

[    5.808000] scsi 0:0:0:0: Direct-Access     WDC WD50 00BEVT-00A0RT0        PQ: 0 ANSI: 6
[    5.816000] sd 0:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB/465 GiB)
[    5.824000] sd 0:0:0:0: [sda] Write Protect is off
[    5.828000] sd 0:0:0:0: [sda] Mode Sense: 3b 00 00 00
[    5.828000] sd 0:0:0:0: [sda] No Caching mode page found
[    5.832000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    5.884000]  sda: sda1 sda2 sda3
[    5.888000] sd 0:0:0:0: [sda] Attached SCSI disk
[    8.076000] mount_root: mounting /dev/root
[    8.080000] mount_root: loading kmods from internal overlay
[    8.268000] block: attempting to load /etc/config/fstab
[    8.292000] EXT4-fs (sda1): mounted filesystem without journal. Opts: 
[    8.300000] block: extroot: unable to lookup root device /dev/ubiblock0_0

Obviously there is no /dev/ubiblock0_0, only

root@OpenWrt:/dev# ls -larth ubi*
crw-r--r--    1 root     root       10,  58 Jan  1  1970 ubi_ctrl
crw-r--r--    1 root     root      252,   1 Jan  1  1970 ubi0_0
crw-r--r--    1 root     root      252,   0 Jan  1  1970 ubi0

The message at 8.29 is because 've created the filesystem with

mkfs.ext4 -O ^has_journal,extent /dev/sda1


So when I can mount the overlay manually, but it won't work on boot:

root@OpenWrt:~# mount /dev/sda1 /overlay
root@OpenWrt:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  114240      6992    107248   6% /
ubi0:rootfs             114240      6992    107248   6% /
tmpfs                    62496       732     61764   1% /tmp
tmpfs                      512         0       512   0% /dev
/dev/sda3            469367280     71664 445436672   0% /mnt/sda3
/dev/sda1             10321208     23028   9757508   0% /overlay


Increasing delay_root to 15 or 100 doesn't work either.
Adding 'export  PREINIT=1; mount_root' to /etc/rc.local doesn't work either.
Removing the prefixed '/' before '/overlay' in /etc/config/fstab resulted in

[    8.288000] block: ignoring mount section cfg044d78 due to invalid target 'overlay'

(Last edited by Markismus on 5 Jan 2017, 20:35)

I am going to reflash with a squash FS image instead of Ubi FS and see what the error message is then.

Joy!

Interestingly, I didn't enable the mount option!! So that could have worked with ubi filesystem image, too. Who knows? I am done for the day!

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    9.8G     23.8M      9.3G   0% /
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    61.0M    404.0K     60.6M   1% /tmp
/dev/sda1                 9.8G     23.8M      9.3G   0% /overlay
overlayfs:/overlay        9.8G     23.8M      9.3G   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda3               447.6G     70.0M    424.8G   0% /mnt/sda3
root@OpenWrt:~# 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'
    option    target    '/mnt/sda1'
    option    uuid    '04c6443e-a522-44af-8973-4c928860d8d1'
    option    enabled    '0'

config 'swap'
    option    device    '/dev/sda2'
    option    enabled    '1'

config 'mount'
    option    target    '/mnt/sda3'
    option    uuid    '50bca58d-7b49-40eb-95b1-eb35b97cba09'
    option    enabled    '1'

(Last edited by Markismus on 5 Jan 2017, 21:48)

Today I installed extroot on my NETGEAR WND3700v5 router. After the command

mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

, I again saw that nothing was copied to the mounted partition.
Checking the filesystem gave:

root@lede:/# ls /overlay/
root@lede:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2304      2304         0 100% /rom
tmpfs                    62376       988     61388   2% /tmp
tmpfs                    62376      5292     57084   8% /tmp/root
overlayfs:/tmp/root      62376      5292     57084   8% /
tmpfs                      512         0       512   0% /dev
root@lede:/# ls /tmp/root
upper  work

So 'overlay' is empty and used, while /tmp/root is where the typical overlay directories 'upper' and 'work' reside. This overlay will be completely lost when the router reboots, so I've changed the command to:

mount /dev/sda1 /mnt ; tar -C /tmp/root -cvf - . | tar -C /mnt -xf - ; umount /mnt

That worked, however after rebooting the tmp/root directory is still mounted as overlay filesystem.

(Last edited by Markismus on 11 Jan 2017, 20:20)

The discussion might have continued from here.