How to get access to upper dir of root overlay?

I recently upgraded to 22.03.2 on my WRT1900ACS and wanted to setup the extroot. So I've been following the extroot configuration wiki page, but I'm hitting a snag at the second section. For one, I think the example doesn't setup the mount via uci correctly. Shouldn't it be using uci add fstab mount and then adding the options like uci set fstab.@mount[-1].device="${DEVICE}"'? I'm guessing that section is from a previous way of adding mounts. Does it still work on 22.03.2?

Second, my rootfs_data is a UBIFS which is on top of an MTD, but the MTD has name ubi. So grepping for rootfs_data as suggested does not work. My question here is, is my case the general case or does the wiki suggestion work on some targets?

Third and more importantly, it seems that because my rootfs_data is on a UBIFS it won't be mounted at another mount point if its already mounted (whereas I've tested that both vfat and xfs filesystems will). So this section can't work when rootfs_data is on UBIFS. Did OpenWRT which to UBIFS in the last 4 years or is this different for different devices and this wiki section is valid only on devices that don't have rootfs_data on a UBIFS?

So considering that the intention behind that wiki section doesn't work (on my device at least) are there suggestions for getting it to work? I was hoping to add a uci fstab config to bind mount /overlay to /rwm, but my understanding is that bind mounts are unsupported there. And even if they were, how could I ensure that the bind mount happened before the overlayfs was mounted over /?

Any help welcome.

It does. If it works on 21.02.x and Snapshot, it works on 22.03.

Not on your platform. the statement does come with a caveat.

FWIW, I used the wiki to add ExtRoot on my production WRT1900ACS starting from 21.02.3 through 21.02.5 as well as on my lab 1900ACS running Snapshot. Not a hitch.

My /etc/config/fstab

config mount 'rwm'
	option device '/dev/ubi0_1'
	option target '/rwm'
	option enabled '0'

My df

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                17152     17152         0 100% /rom
tmpfs                   255212      6888    248324   3% /tmp
/dev/sda1             14803288    116808  13914796   1% /overlay
overlayfs:/overlay    14803288    116808  13914796   1% /
ubi1:syscfg              30276       284     28412   1% /tmp/syscfg
tmpfs                      512         0       512   0% /dev
/dev/sda7              3645300       820   3439220   0% /mnt/shared
/dev/sda5              3645300     10772   3429268   0% /mnt/usb
/dev/sda8              3642228      1004   3436120   0% /mnt/testing
/dev/sda6              3645300     51628   3388412   2% /mnt/data

Thanks for the reply and confirmation that it can work.

Yes, I've now gotten it to work. My issue was that I was using the XFS filesystem as the extroot filesystem. This file system is unsupported by block and it will say as such when running block extroot. However, that output is not output as a log message to the serial console. So this is all I see from the log messages printed to the serial console:

[    9.549305] block: attempting to load /tmp/ubifs_cfg/upper/etc/config/fstab
[    9.559488] block: extroot: device not present, retrying in 15 seconds
[   24.587169] block: extroot: cannot find device with UUID 5a26d355-dfd0-4958-860a-90145755a23a
[   24.597956] mount_root: switching to ubifs overlay

There isn't a clue that this is because XFS is not supported. The wiki should mention the whitelist of supported filesystems.

Are you saying that the statement(s) on that section of the wiki page come with a caveat? Because I don't see one there.

Okay, so you have configured the mount point /rwm but it does not show up in you list of mounts. It sounds like that mount is not working, correct?

So a UBIFS can be can mounted two multiple locations simultaneously (I wasn't passing -t ubifs to mount so it was failing). However, it appears that mount_root and block have artificial restrictions that disallow a block device from being mounted multiple times.

[   49.734334] mount_root: rootfs_data:/dev/ubi0_1 is already mounted as /overlay
root@Xela:/# block mount
block: /dev/ubi0_1 is already mounted on /overlay

So, I think the wiki section on mounting /rwm is incorrect for any rootfs_data filesystem type, UNTIL the extroot is working (because then that filesystem will not be already mounted and mount_root will mount it). This should be better explained on the wiki.

1 Like

Very nice! + :100: