I have a (I think) very particular situation on my embedded Linux which I cannot work out properly...
Due to particular (custom) checks to be performed on filesystems at startup before mounting them, I use an initial ramdisk to check and mount all the requested filesystem, and then I transfer them to the root filesystem when init is completed (so no /etc/fstab
is used for mounting device, but rather they are mounted through a script residing inside the initial ramdisk).
To be more specific, the /boot
partition (mmcblk1p1
) is mounted first (in READ-ONLY mode); inside that partition I have a file (rootfs.squashfs
) corresponding to a squashfs image of the target root filesystem... so, after some other operations (not relevant for the purpose of this post) the initial ramdisk script ends up mounting the squashfs image on /rootfs
and at the end of the init script the system root is switched to /rootfs
(via switch-root
command);
The problem arises at system reboot (or shutdown or poweroff): when the system tries to umount all mounted filesystems, then the umount of /boot
fails (because the device is busy, as it is obvious, since the root filesystem is mounted from a squashfs file residing in /boot).
Is there a way for avoiding to umount /boot
at reboot/shutdown/poweroff, thus avoid the umount fail? Since it is mounted read-only it should not be risky at all, isn't it? Or am I missing something?
P.S.: I do not know if it may be helpful and/or relevant: my OS init is managed via systemd
.