Created attachment 392064 [details, diff] dracut mount /boot patch Dracut does not mount /boot partition if it is separated. sys-kernel/dracut-040-r2 was built with the following: USE="systemd -debug (-selinux)" ABI_X86="64" Attached a patch to detect /boot mountpoint inside /etc/fstab and try to mount it. Check /proc/mounts before try mounting. This is very useful when /boot has noauto option.
Sorry, I've totally missed that bug report. Is there any reason why you provide full path to `grep`, `egrep` and `mount` commands?
No any specific reasons for that. Feel free to remove full paths.
Hm… why one would like to mount /boot at initramfs-time? Actually I mount boot only when I upgrade kernel or change something in Grub.
Dracut has a special shutdown hook. This hook is used to shutdown special devices like LVM and/or RAID arrays (both for me). dracut-initramfs-restore script does unpacking content of initramfs inside the /run/initramfs folder and after shutdown systemd doing a pivot-root to this folder and running a shutdown script. I have a noauto,nofail options set for /boot partition and this partition is not mounted automatically. So then dracut-initramfs-restore script runs it fails to unpack initramfs and thus doing not clean shutdown. That's why this fix is kinda good thing.
Yeah, I'm aware of this bug. It forced me to remove noauto from fstab long time ago. :) How about the following logic: if findmnt -s -n --target=/boot &>/dev/null; then mountpoint -q /boot || mount /boot fi
But I'm not sure if /boot mount point will be correctly tracked by systemd and unmounted during shutdown.
/boot could me mounted read-only. Igor, could you test Alexander suggestion (+ro) and possibly correct the patch?
Ah.. I already use more recent version with umounting the /boot after unpacking initramfs. I'll add an attachment.
Created attachment 399892 [details, diff] Initramfs restore script with auto-umount functionality
Nice, you've added unmounting at the end. And what about findmnt usage suggested by Alexander? Could you also mount /boot with "ro" anyway? /boot is not supposed to be modified.
Created attachment 399978 [details, diff] New patch, using findmnt and ro mount option I've attached a new patch. Right now using findmnt to find the mount source and mounting /boot in read-only mode.
Harald commited fix for this bug: http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=4f0c7fc91728a0c9aca211cbab5ae69bd08335d5
Should be fixed in dracut-043
Hmm.. Upstream solution have a bug: set -e ... mount -o ro /boot &>/dev/null So if /boot is not a mount point or is already mounted, then script exits after unsuccessful mount command. :) I'll send upstream a fix.
https://github.com/haraldh/dracut/compare/master...dracut-mailing-devs:E1ZK3hi-0000SN-Lt%40puleglot.ru
Thank you guys! commit 01f96bde83ab52f47cea0c0f9641e0528b87522e