why is /dev umounted before switch_root in initfs?
I noticed a problem in an unreleased version of Portfolio that seems to be caused by the fact that info in /dev
is "lost" after switch_root from the initfs init.sh script. Specifically, when using FDE, the rootfs luks vol is unlocked and a node is made under /dev/mapper
, which is ultimately mounted as /
(new root). /dev
is then umounted before switch_root, so that node is no longer available in /dev
when pmOS fully boots:
librem5:~$ ls /dev/mapper/
control
librem5:~$ df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/root 29874052 22703688 5637852 80% /
this seems to be screwing up udisks2, since it's unable to figure out what the backing encrypted volume is:
/org/freedesktop/UDisks2/block_devices/mmcblk0p2:
org.freedesktop.UDisks2.Block:
Configuration: []
CryptoBackingDevice: '/'
Device: /dev/mmcblk0p2
CrytoBackingDevice
should point to the block device under /dev/mapper: http://storaged.org/doc/udisks2-api/2.9.4/gdbus-org.freedesktop.UDisks2.Block.html#gdbus-property-org-freedesktop-UDisks2-Block.CryptoBackingDevice
For example, on my laptop running Alpine:
/org/freedesktop/UDisks2/block_devices/dm_2d0:
org.freedesktop.UDisks2.Block:
Configuration: []
CryptoBackingDevice: '/org/freedesktop/UDisks2/block_devices/nvme0n1p2'
Device: /dev/dm-0
switch_root should move /dev
(and other things like /proc
, /sys
) to the new root. the git history for the relevant section in the init.sh
was lost(?) in 1c0ff6aa:
umount /dev
# shellcheck disable=
exec switch_root /sysroot "$init"
So, does anyone (@ollieparanoid ?) remember why we are umounting /dev prior to switch_root?