[systemd-devel] Why did you set MountFlags=slave in systemd-udevd.service.in
Andrei Borzenkov
arvidjaar at gmail.com
Tue Feb 27 19:02:19 UTC 2018
27.02.2018 17:20, Hongzhi, Song пишет:
> Hi,
>
> thank for your help, but I still have some question.
>
>
> My current linux system init uses systemd and udev, with
> 'automount.rules' and 'mount.sh' in /etc/udev/,
>
> to manage device. But owning to MountFlags=slave, hotpluggable media
> (e.g., /dev/sda1 )
>
> can be mounted again in host, whereas can't be formatted by mkfs.ext4 in
> host with error
>
> message '/dev/sda1 is apparently in use by the system; will not make a
> filesystem here!'.
>
>
> In your reply, you told me to invoke "systemd-mount" from udev rules. Do
> you mean that
>
> I should replace /bin/mount with /usr/bin/systemd-mount in mount.sh, or add
>
> "RUN+='/usr/bin/systemd-mount $env{DEVNAME}'" to automount.rules?
>
> 1)
>
> I replaced /bin/mount with /usr/bin/systemd-mount in mount.sh.
>
> /usr/bin/systemd-mount $DEVNAME "/run/media/$name"
>
> it prompted that
>
> systemd[1]: dev-sda.device: Job dev-sda.device/start timed out.
> systemd[1]: Timed out waiting for device dev-sda.device.
> systemd[1]: Dependency failed for /run/media/sda.
> systemd[1]: run-media-sda.mount: Job run-media-sda.mount/start
> failed with result 'dependency'.
> systemd[1]: Dependency failed for File System Check on /dev/sda.
> systemd[1]: systemd-fsck at dev-sda.service: Job
> systemd-fsck at dev-sda.service/start failed with result 'dependency'.
> systemd[1]: Startup finished in 16.692s (kernel) + 1min 32.605s
> (userspace) = 1min 49.298s.
> systemd[1]: dev-sda.device: Job dev-sda.device/start failed with
> result 'timeout'.
>
> ...
>
> in /var/log/syslog.
>
Try
systemd-mount --no-block ...
More information about the systemd-devel
mailing list