I'm trying to understand dracut/systemd fsck behaviour, in the context
of an ext4 filesystem root mounted read-only from dracut, remaining
read-only even when the system is fully booted (kiosk-style).

I see that systemd's fstab-generator rightly creates a mount unit for
/sysroot from the initramfs, and causes e2fsck to be run on it from
inside the dracut initramfs, before it is mounted. So far so good.

Then the system continues booting, switches root, and then
system-fsck-root.service starts from the root fs, and runs fsck on /
again. This is the bit I don't understand - we already checked from
the initramfs, why check again now?

There used to be a marker file in /run to let systemd know that the
initramfs already checked it, but that was removed in commit

Also, systemd-fsck-root.service in itself seems a little questionable,
is it really safe in any context to run fsck on a mounted partition?
That could modify data structures which have already been cached in
memory in the kernel fs driver. In fact, e2fsck refuses to run on
partitions that are mounted, even ones that are ro.

Thanks for any clarification.
systemd-devel mailing list

Reply via email to