[systemd-devel] network and remote-fs on shutdown

Colin Guthrie gmane at colin.guthr.ie
Wed Sep 5 12:52:12 PDT 2012

'Twas brillig, and Michel Lafon-Puyo at 05/09/12 14:19 did gyre and gimble:
> Hi,
> I use systemd on an ArchLinux system and I use some remote fs that are
> described in /etc/fstab (with the x-systemd.automount option). On
> start-up, everything is fine and the fs is mounted when I cd into one of
> the directories. Actually, this is quite impressive because it is so
> simple to configure! Thank you all for that!
> However, on shutdown the network is stopped (i.e. I use
> NetworkManager.service, so actually the NetworkManager process is
> stopped) but the remote-fs are unmounted through umount.target after
> that. So, the system hang until the timeout occurs and finally the
> system is powered down/rebooted.
> If I check the unit generated by fstab-generator for one of the remote
> filesystems, I get:
> # Automatically generated by systemd-fstab-generator
> [Unit]
> SourcePath=/etc/fstab
> DefaultDependencies=no
> After=remote-fs-pre.target
> Wants=remote-fs-pre.target
> Conflicts=umount.target
> Before=umount.target
> [Mount]
> What=//
> Where=/mnt/be
> Type=cifs
> FsckPassNo=0
> Options=/home/mlo/.samba/credentials,noauto,user,x-systemd.automount,x-systemd.device-timeout=60
> If I understand it correctly, there is no dependency between the mount
> and the network target and this is why my network manager daemon stops
> before the remote filesystems are unmounted.

That indeed seems like a correct analysis, but there are further things
to consider here too.

The generated unit does have a After=remote-fs-pre.target, which in turn
has an After=network.target dep. Therefore, your mount unit itself
inherits this.

I thought it was possible to use use "systemctl show yourmount.mount" to
see the full set of After= units after taking this chain of deps into
account, but it's not the case here. Not sure if this has always been
this way, of if I'm just misremembering.

Anyway, systemd should reverse the After logic for shutdown, but I guess
it's maybe not dealing with this chain and thus not doing the order
order properly. If so this might be a bug, or it might be intended

> So I changed fstab-generator to add Requires=network.target and
> After=network.target (corresponding trivial patch attached to this
> email) to the generated mount units. It seems to work quite well but I
> just switched to systemd and I don't undertand all the consequences of
> this change...

Well as stated, it *shouldn't* really be needed as the
remote-fs-pre.target should have the necessary dep for ordering. I we
need a comment from someone who is more clued up on the ordering code to
comment if this is a bug or not, or whether something similar to your
patch is needed.




Colin Guthrie

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

More information about the systemd-devel mailing list