[systemd-devel] Setting mount option `sync` for root parition in fstab causes umount to fail during shutdown

Isaac Nickaein nickaein.i at gmail.com
Wed Aug 8 12:47:50 UTC 2018


On Wed, Aug 8, 2018 at 1:16 PM Lennart Poettering
<lennart at poettering.net> wrote:
>
> > systemd-shutdown[1]: Unmounting file systems.
> > systemd-shutdown[1]: Remounting '/' read-only with options 'sync,data=ordered'.
> > EXT4-fs (mmcblk2p1): Unrecognized mount option "sync" or missing value
> > systemd-shutdown[1]: Remounting '/' read-only with options 'sync,data=ordered'.
> > EXT4-fs (mmcblk2p1): Unrecognized mount option "sync" or missing value
>
> This message is generated by the kernel. This appears to be a kernel
> problem: it apparently doesn't allow remounts of ext4 if we specify
> "sync" in the mount options...
>
> Please report this to the kernel folks.

OK, I will try my chances. However, there seems to be a fundamental
issue with filesystem-independent flags like `sync` as discussed here:
https://unix.stackexchange.com/a/131414/91614

*it appears to be impossible to set any of the filesystem-independent
flags via rootflags, which explains the special-case code for the 'ro'
and 'rw' flags*

Therefore, kernel might be unable to parse flags such as `sync`. At
least in my experience, I don't know if that's the case for other
folks.
If that is the case, systemd should probably not pass these options to
kernel as it causes failure in unmounting.

>
> When systemd shuts down it will remount all file systems read-only.

I am curious what is the reasoning behind this behavior? Couldn't
systemd just unmount the partition whether it is in readonly mode or
not?

> It does that by reading the old mount options from /proc/self/mountinfo
> and adding MS_RDONLY to it.

Shouldn't systemd uses the original mount flags that kernel was given
in the first place (in the first `rootfs` mount during boot).
The flags provided at /proc/self/mountinfo is *augmented* by fstab
options and the kernel might fail to understand them, hence the
failure in unmounting.


More information about the systemd-devel mailing list