FS#35671 - [systemd] fails to unmount CIFS network share on shutdown/reboot

Attached to Project: Arch Linux
Opened by david (stryder) - Thursday, 06 June 2013, 07:12 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 24 December 2013, 21:05 GMT
Task Type Bug Report
Category System
Status Closed
Assigned To Tobias Powalowski (tpowa)
Dave Reisner (falconindy)
Tom Gundersen (tomegun)
Architecture i686
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


systemd fails to umount manually mounted samba shares upon reboot/poweroff. Shutdown occurs only after a couple of minutes, probably with timeout. Same samba shares that are auto-mounted (via fstab entry) are umounted without problems.

There is a short but inconclusive discussion here: https://bbs.archlinux.org/viewtopic.php?id=162236

Additional info:
* package version(s)
* config and/or log files etc.

Steps to reproduce:
Entry in fstab to mount samba share: set to automount -> no problem; noauto, manually mounted -> poweroff/reboot takes a couple of minutes waiting for the share to be umounted.
This task depends upon

Closed by  Dave Reisner (falconindy)
Tuesday, 24 December 2013, 21:05 GMT
Reason for closing:  Upstream
Additional comments about closing:  Potentially fixed in 208-8, otherwise this will be fixed in a fabled v209.
Comment by Dave Reisner (falconindy) - Thursday, 06 June 2013, 18:06 GMT
And your fstab looks like.... ?
Comment by david (stryder) - Friday, 07 June 2013, 13:15 GMT
Just the relevant entry:

## samba shares
// /media/shuttle3 cifs credentials=/root/credentials.txt,defaults,user,noauto 0 0

## nfs shares /mnt/pcache nfs4 defaults,users,rsize=8192,wsize=8192,timeo=14,intr,noauto 0 0

This is a fresh install so the rest are just standard entries generated by genfstab. No problems with nfs shares. Oh, there is a vboxsf entry too in case that's relevant.
Comment by Dave Reisner (falconindy) - Friday, 07 June 2013, 13:18 GMT
Please attach the output of 'systemctl show .....' for one of the manually mounted devices. There *will* be a mount unit for it.
Comment by david (stryder) - Friday, 07 June 2013, 13:26 GMT
Attached. david.
Comment by Dave Reisner (falconindy) - Friday, 07 June 2013, 13:49 GMT
Looks like the relevant difference is:

-Before=umount.target remote-fs.target
+Before=local-fs.target umount.target

Where the manual mount is missing Before=remote-fs.target, but it does have the appropriate After= ordering dependencies.
Comment by stqn (stqn) - Thursday, 13 June 2013, 22:16 GMT
For what it’s worth, there’s a very similar problem with sshfs (manually mounted -> hang at shutdown).
Comment by Fedor Dostoyevskiy (bachtiar) - Friday, 09 August 2013, 02:28 GMT
I had the same problem, and from what I'd observed, the cause was that network was being killed before unmounting remote filesystems, causing umount timeouts (and possibly unclean unmounts). If this is true, it could be fixed just by reordering shutdown scripts.

Unfortunately, I don't know much about systemd, so I left it at that. Could someone confirm this?
Comment by Tom Gundersen (tomegun) - Friday, 27 September 2013, 12:32 GMT
As far as I can tell there is one bug in systemd: if there is no unit file for your mount (i.e., if you don't have an entry in fstab, or if you added the entry to fstab without doing "systemctl daemon-reload") we will assume the mount is a local one (which fits with your description). See http://cgit.freedesktop.org/systemd/systemd/tree/src/core/mount.c#n1442

However, that doesn't quite fit with what you describe, as you do have a mount unit (in /run/systemd/generator) before mounting manually, so you should be getting the correct dependencies as far as I can tell...
Comment by Dave Reisner (falconindy) - Tuesday, 24 December 2013, 19:47 GMT
Looks like this bug report duplicates:


And this was subsequently fixed in git: