Bug 73727 - remote file systems cannot be unmounted at shutdown
Summary: remote file systems cannot be unmounted at shutdown
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-17 08:35 UTC by Mario Natiello
Modified: 2014-06-21 02:46 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
journalfile, standard form (connections time out) (150.17 KB, text/plain)
2014-01-17 08:35 UTC, Mario Natiello
Details
journalfile, modified systemd handling. No timeout issues when umounting remote devices (142.25 KB, text/plain)
2014-01-17 08:48 UTC, Mario Natiello
Details
journal file. Modified systemd handling but still failing to umount (151.67 KB, text/plain)
2014-01-17 16:07 UTC, Mario Natiello
Details

Description Mario Natiello 2014-01-17 08:35:46 UTC
Created attachment 92263 [details]
journalfile, standard form (connections time out)

I have to remote file systems mounted via sshfs.
At shutdown, these file systems cannot be umounted. The system waits a couple
of minutes before timeout. The reason could be that the system issues the 
umount after network and/or sshd have been killed. 
See attachment 1 [details] [review]: Journalfile for shutdown "as is".
Comment 1 David Strauss 2014-01-17 08:39:41 UTC
Have you tried making the mount Requires=network.target and After=network.target to take it down before the network?
Comment 2 Mario Natiello 2014-01-17 08:48:10 UTC
Created attachment 92267 [details]
journalfile, modified systemd handling. No timeout issues when umounting remote devices
Comment 3 Mario Natiello 2014-01-17 08:52:41 UTC
(In reply to comment #1)
> Have you tried making the mount Requires=network.target and
> After=network.target to take it down before the network?

More or less. I added After=network.target to /usr/lib/systemd/systemd-user-sessions.services
and the problem persists. However, changing /usr/lib/systemd/systemd-user-sessions.services
in this way:
#After=remote-fs.target
After=network.target
After=NetworkManager.service
does the trick. The second attachment I filed shows that the filesystems are unmounted
properly, and shutdown proceeds in a few seconds without time delay.

Shouldn't this "fix" -or yours if it also works- be incorporated to systemd?

Another "fix" is to umount the devices manually right before issuing the shutdown command.
This does fix the problem but it hides the fact that the system is handling the 
shutdown process improperly.
Comment 4 David Strauss 2014-01-17 09:06:28 UTC
systemd isn't actually aware of whether a file system requires network access or other resources (like a USB stick). So, it provides dependency primitives like After=, Requires=, and others to allow defining dependencies on devices, services, targets, and other resources. It's the mount unit author's responsibility to specify the proper dependencies, which systemd will then respect.

We also can't fix this by adding After=network.target and After=NetworkManager.service to every mount. This would not fix mounts depending on more sophisticated network conditions, and it would unnecessarily delay mounts of file systems that don't need the network.
Comment 5 David Strauss 2014-01-17 09:08:06 UTC
> We also can't fix this by adding After=network.target and After=NetworkManager.service to every mount.

To clarify, having re-read your comment, we also can't do this for systemd-user-sessions.service for the same reasons.
Comment 6 Mario Natiello 2014-01-17 16:05:44 UTC
(In reply to comment #5)
> > We also can't fix this by adding After=network.target and After=NetworkManager.service to every mount.
> 
> To clarify, having re-read your comment, we also can't do this for
> systemd-user-sessions.service for the same reasons.

Addendum: The modification I proposed does not work either. Or it is at least
erratic. Not having changed other things, I twice found myself in the situation
where umount of the remote systems fails and the shutdown process is 
delayed by 90 sec before the timeout takes over. So which one is the proper
After=... command remains unclear.
The only thing that invariably works without obstacles is to umount the sshfs
devices myself by hand right before issuing shutdown. I will attach a third
journalfile with a umount failure, run in the same conditions as journalfile nr 2.
Comment 7 Mario Natiello 2014-01-17 16:07:13 UTC
Created attachment 92289 [details]
journal file. Modified systemd handling but still failing to umount


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.