Mounted NFS share prevents shutdown

Bug #1577120 reported by HasHPIT
74
This bug affects 15 people
Affects Status Importance Assigned to Milestone
nfs-utils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

On ubuntu 16.04 I mount an NFS share using "sudo mount ip.ip.ip.ip:/remote_path/remote_path localpath/"
When I try to shutdown or restart the computer it hangs.
It appears to be attempting to unmount the NFS share and theres a timeout, but each time it reaches the timeout, it gets increased.

I have read bug reports that similar issues were present in several previous ubuntu versions.
One work around was to soft mount instead of the default hard mount.

Revision history for this message
HasHPIT (hashpit) wrote :

I just noticed that if I don't do "a lot" on the mounted drive, it shuts down fine.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nfs-utils (Ubuntu):
status: New → Confirmed
Revision history for this message
Sean (seanshivak) wrote :

Same issue but only on wifi, issue doesnt occur on lan connections.

Revision history for this message
Sean (seanshivak) wrote :

This issue is fixed for me by editing nfs-config.service and adding After=local-fs.target remote-fs.target NetworkManager.service

sudo systemctl edit --full nfs-config.service

[Unit]
Description=Preprocess NFS configuration
After=local-fs.target remote-fs.target NetworkManager.service
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh

Other suggestions on various forums dont work such as adding dbus.service to wpa_supplicant.service

Revision history for this message
Jeremie Tamburini (jeremie2) wrote :

@Sean
I have tried to use your workaround #4 but unfortunately didn't work on my computer.
Please could you let me know which options are you using on your /etc/fstab?

Thanks

Revision history for this message
Jeremie Tamburini (jeremie2) wrote :

OK, it seems that workaround #4 works if I wait a bit before shutdown/reboot. If I switch off the computer immediately after the boot, the problem will still be there.

Revision history for this message
Sean (seanshivak) wrote :

Hi sorry for the delay here is my NFS fstab entry.

192.168.0.100:/mnt /mnt/Server nfs4 _netdev,bg,nofail,rw,relatime,rsize=65536,wsize=65536 0 0

Revision history for this message
Jeremie Tamburini (jeremie2) wrote :

@Sean
I tried your fstab entry and it works perfectly, even if I switch off the computer immediately after the boot.

Thanks

Revision history for this message
Clive Wychwood (goshawk1973) wrote :

I have solved the same issue by doing a 'mount -a' command in the startup applications. This remounts the shares at the very end of the process, which seems to do what is necessary to straighten the dbus timing. A kludge option but very simple.

Revision history for this message
Harald Nikolisin (hochglanz) wrote :

Same Problem here with 16.04. and NFS automounter

Workaround #4 works here as well.

Revision history for this message
Jelle De Loecker (skerit) wrote :

The `nfs-config.service` fix did resolve my issue, but I noticed that without it the unmount job gets "terminated" by systemd when it reaches a certain timeout.

As the timeout is reached systemd still reached the "shutdown target", but fails to actually shut down the system.

So, yes, unmounting the nfs mount doesn't seem to work, but systemd should still shut down the system after the timeout is reached. I guess that's why some people are reporting bug #1594023 as fixed and some do not.

Revision history for this message
McFly81 (christian-lange-81) wrote :

Same issue here (KDE Neon 5.10, based on Ubuntu 16.04; last dist-upgrade today). When I'm trying to shutdown and press ESC on the Splashscreen I see the message "A stop job is running for <mountname>" with a timeout. When the timeout is reached, it is prolonged (at first ist was 1 minute 41, then 3 minutes 11, then 4 minutes 41, ...) but nothing more happens.

This occurs when mounting at startup via fstab and also when commenting out fstab entries for startup and doing manual "mount -a" after startup.

Sadly, Workaround from Post#4 didn't work for me.

Revision history for this message
yurx cherio (cherio) wrote :

Workaround #4 seems to assume the machine runs NetworkManager. This is not always the case and shouldn't be a requirement.

Revision history for this message
Yurx Cherio (cherio-e) wrote :

Almost 2 years later and the bug is still unresolved. Good luck Ubuntu users.

Revision history for this message
James Crook (cooljimy) wrote :

I just added a mount in fstab for my NAS, and now get this issue were if i do a large amount of work on the NAS and forget to unmount manually before a shutdown/reboot then Ubuntu hangs at the splash screen.
For now i have added the below to my bash_logout

umount /mnt/NAS

It doesn't happen if i use the GUI to mount the share rather than the fstab, tho that uses Fuse mount stuff (i think)

Revision history for this message
bmomjian (bruce-momjian) wrote :

I used to have intermittent hangs on shutdown with 16.04 , but with 20.04, the hangs always happen. Item #4 fixed my problem. I suggest #4 be added to the official tree unless someone can explain it is not a good idea.

Revision history for this message
mathew7 (mateiberatco) wrote :

Just had this problem on 2104 (which just had a 1st taste of NFS).
Previously I've had this problem on my main system when using nfs and wifi-only. I ended up having to replace the logout icon (XFCE) with a script that checks for nfs mounts and warns before showing original logout prompt. But that system now uses /etc/network/interfaces (due to VM bridges). Never had problems since.

The "After" in #4 hints at starting order. Does "After" also affect stopping order? I see "Wants" in some other scripts. Plus current releases have a much different nfs-utils.service.

"bad idea" on #4: not all installs might use NetworkManager. Therefore implementing #4 might disable nfs services on those systems.

I don't have an overview on systemd dependencies, so I can't give a robust solution. Just took a few minutes to scan through systemd configs.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.