1
$ systemctl show -p Before /home/.shared-separate
Before=umount.target

$ systemctl show -p Before /data
Before=umount.target local-fs.target

Why is the mount unit for /home/.shared-separate missing Before=local-fs.target ? It is not what I expected from man systemd.mount -

For mount units with DefaultDependencies=yes in the "[Unit]" section (the default) a couple additional dependencies are added. Mount units referring to local file systems automatically gain an After= dependency on local-fs-pre.target. Network mount units automatically acquire After= dependencies on remote-fs-pre.target, network.target and network-online.target. Towards the latter a Wants= unit is added as well. Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases this is not sufficient (for example network block device based mounts, such as iSCSI), in which case _netdev may be added to the mount option string of the unit, which forces systemd to consider the mount unit a network mount. Mount units (regardless if local or network) also acquire automatic Before= and Conflicts= on umount.target in order to be stopped during shutdown.

...

When reading /etc/fstab a few special mount options are understood by systemd which influence how dependencies are created for mount points. systemd will create a dependency of type Wants= or Requires (see option nofail below), from either local-fs.target or remote-fs.target, depending whether the file system is local or remote.

This is on Debian 8. systemd version is 232-25+deb9u6.

It seems undesirable. It seems to be causing an unmount failure sometimes, if I am logged in on the console and in the directory /home/.shared-separate when I shut down. Because it means is no ordering dependency to make sure that the session is stopped before systemd tries to stop the mount.

$ journalctl -u /home/.shared-separate -b -1
Jan 06 21:26:59 drystone systemd[1]: Mounting /home/.shared-separate...
Jan 06 21:26:59 drystone systemd[1]: Mounted /home/.shared-separate.
Jan 06 21:28:18 drystone systemd[1]: Unmounting /home/.shared-separate...
Jan 06 21:28:18 drystone systemd[1]: home-.shared\x2dseparate.mount: Mount process exited, code=exited status=32
Jan 06 21:28:18 drystone systemd[1]: Failed unmounting /home/.shared-separate.

systemd itself is not logging any warning or even notice messages during boot. There are some notices at shutdown though:

journalctl -p notice -u init.scope
...
-- Reboot --
Jan 06 21:28:18 drystone systemd[1]: home-.shared\x2dseparate.mount: Mount process exited, code=exited status=32
Jan 06 21:28:18 drystone systemd[1]: Failed unmounting /home/.shared-separate.
Jan 06 21:28:18 drystone systemd[1]: Requested transaction contradicts existing jobs: Transaction is destructive.
Jan 06 21:28:18 drystone systemd[1]: systemd-coredump.socket: Failed to queue service startup job (Maybe the service file is missing or not a non-template unit?): Transaction is destructive.
Jan 06 21:28:18 drystone systemd[1]: systemd-coredump.socket: Unit entered failed state.
Jan 06 21:28:21 drystone systemd[1]: Failed to propagate agent release message: Transport endpoint is not connected
Jan 06 21:28:21 drystone systemd[1]: Failed to propagate agent release message: Transport endpoint is not connected
Jan 06 21:28:21 drystone systemd[1]: dev-disk-by\x2duuid-642a335b\x2da00a\x2d4f63\x2d9a36\x2dd689b0d15099.swap: Swap process exited, code=exited status=255
Jan 06 21:28:21 drystone systemd[1]: dev-disk-by\x2duuid-642a335b\x2da00a\x2d4f63\x2d9a36\x2dd689b0d15099.swap: Unit entered failed state.
Jan 06 21:28:21 drystone systemd[1]: Shutting down.
-- Reboot --
...

The coredump, and hence the failed attempt to launch systemd-coredump during shutdown, is from part of gnome-session. Clearly this is not related to the fact that inspecting my mount unit before shutdown shows it is missing Before=local-fs.target.

Jan 06 21:15:58 drystone kernel: gnome-session-f[14384]: segfault at 0 ip 00007f30cf45de19 sp 00007ffd77e4bd50 error 4 in libgtk-3.so.0.2200.11[7f30cf17b000+700000]

Both of the mounts are defined in /etc/fstab. Neither of the mounts have a _netdev option. But you can see the difference in their unit files...

# Extract from /etc/fstab :
UUID=8bf8198a-02d4-450b-a4e7-461194aff2ec /data ext4 nosuid,nodev,errors=remount-ro 0 0
/home/.shared-separate-internal /home/.shared-separate fuse.bindfs nofail,allow_other,force-group=jenkins-photos,perms=g+rwX

$ systemctl cat /home/.shared-separate
# /run/systemd/generator/home-.shared\x2dseparate.mount
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)

[Mount]
What=/home/.shared-separate-internal
Where=/home/.shared-separate
Type=fuse.bindfs
Options=nofail,allow_other,force-group=jenkins-photos,perms=g+rwX

$ systemctl cat /data
# /run/systemd/generator/data.mount
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Before=local-fs.target

[Mount]
What=/dev/disk/by-uuid/8bf8198a-02d4-450b-a4e7-461194aff2ec
Where=/data
Type=ext4
Options=nosuid,nodev,errors=remount-ro
1

This is due to the nofail option. Keep reading the same man page :-).

nofail

With nofail, this mount will be only wanted, not required, by local-fs.target or remote-fs.target. Moreover the mount unit is not ordered before these target units. This means that the boot will continue without waiting for the mount unit and regardless [of] whether the mount point can be mounted successfully.


I think I expected the opposite, because I had read the following information on Arch Wiki (or maybe elsewhere) which appears to be wrong or outdated:

The nofail option is best combined with the x-systemd.device-timeout option. This is because the default device timeout is 90 seconds, so a disconnected external device with only nofail will make your boot take 90 seconds longer, unless you reconfigure the timeout as shown. Make sure not to set the timeout to 0, as this translates to infinite timeout.

https://wiki.archlinux.org/index.php/Fstab#External_devices

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.