I have autofs mounting nfs and cifs shares. Everything is great except for slow shutdowns and reboots. I find the message "A stop job is running for Automounts filesystems on demand" with a 3 min countdown. So this is what is causing the delay. But I can't find where to adjust the 3 minutes to something shorter or to direct autofs to unmount everything immediately. What can I do to speed up shutdown or reboot?
2 Answers
I have been having the same problem for ages and I use autofs extensively in my local network. The only way I have found around the problem is to open a terminal and issue the command:
sudo systemctl stop autofs
After this the systems shut down as normal.
It should be because the network interface get deactivated before the autofs service is stopped.
I encountered the same issue in KDE where I set up a WIFI connection from the GUI and have the "All users may connect to this network
" option untick, making the interface get deactivated before autofs.service is stopped during the shutdown.
Adding umount command to scripts under /etc/NetworkManager/dispatcher.d/ doesn't help either as they are not invoked in the shutdown.
Found 2 workarounds
One option is to tick the "
All users may connect to this network
" option in the Network Manager. It will maintain the WiFi even KDE exit. Then create and the following line to/etc/polkit-default-privs/local
. Otherwise the KDE will keep prompting for password to activate the connection every time it starts up or wakes up from a sleep.org.freedesktop.NetworkManager.settings.modify.system yes
Another option is to create a shell script to execute
sudo umount -a -t nfs4
(need to setup NOPASSWD in sudoers first) and add it as a "logout" script either through the GUI "System Setting -> Startup and Shutdown -> Autostart -> Add Logout Scripts..." or simply put it in the~/.config/plasma-workspace/shutdown
folder.