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".
Have you tried making the mount Requires=network.target and After=network.target to take it down before the network?
Created attachment 92267 [details]
journalfile, modified systemd handling. No timeout issues when umounting remote devices
(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:
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.
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.
> 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.
(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.
Created attachment 92289 [details]
journal file. Modified systemd handling but still failing to umount
Should be fixed by http://cgit.freedesktop.org/systemd/systemd/commit/?id=77009452 and http://cgit.freedesktop.org/systemd/systemd/commit/?id=da92ca5e.