grml / live-boot-grml

GNU General Public License v3.0
10 stars 12 forks source link

Unreliable /lib/live/mount/medium usage #10

Closed mika closed 5 years ago

mika commented 5 years ago

If the "scripts" boot option is used, then grml-autoconfig expects to use LIVECD_PATH=/lib/live/mount/medium as base-path for the scripts. For some yet unknown reason the /lib/live/mount/medium directory might not be present, while its content is available as-is under /run/live/medium.

This might be a race condition inside systemd unit-files, needs to be tracked down yet.

mika commented 5 years ago

I tracked this down:

screenshot 2019-03-21T10:53:54

So system disables it because of Unit is bound to inactive unit dev-sr0.device, sigh.

mika commented 5 years ago

systemd doesn't seem to properly take over the mounted directories from initramfs stage. Neither /dev/sr0 nor /lib/live/mount nor /run/live have entries in /etc/fstab, while /lib/live/mount is an rbind mount of /run/live.

Once Grml finished booting and we manually rbind mount /lib/live/mount then it works fine though:

root@grml ~ # systemctl | grep medium
run-live-medium.mount                                                                    loaded active mounted   /run/live/medium
root@grml ~ # mount --rbind /run/live /lib/live/mount
root@grml ~ # systemctl daemon-reload
root@grml ~ # systemctl | grep medium
lib-live-mount-medium.mount                                                              loaded active mounted   /lib/live/mount/medium
run-live-medium.mount                                                                    loaded active mounted   /run/live/medium

I'd assume if we provide entries for those in fstab, then automount-magic of systemd shouldn't kick in (since fstab entries take precedence). I tested adding /dev/sr0 /lib/live/mount iso9660 defaults 0 0 to /etc/fstab (by booting with break=init and then editing /root/etc/fstab) and couldn't reproduce the issue within several boots (which doesn't necessarily mean anything, because the problem is not always reproducible). I'm not planning to change the fstab handling though, I'll push Grml package updates, taking care of switching everywhere to new mount path /run/live (since /lib/live/mount will go away anyway).