If you are using autofs to mount your external shares (e.g. NAS) then you probably experienced the same issue like me. When you want to shutdown the computer it takes 3 minutes because the autofs service hangs and waits for the default time out. This is caused when e.g. the Network Manager disconnects your network during logout of your session but the autofs still runs. I have seen people posting to reduce the service timeout but a better solution is to sudo systemctl edit autofs.service and add the option ExecStop=umount. The file should look like this:
Of course you may want to alter the nfs entry with your current network file protocol you access the external data, like nfs4 or cifs.
You would like to reload the services by systemctl daemon-reload
Now autofs should not cause a waiting time during shutdown anymore.
Hope this is useful for some but if you have got any other solution this would be awesome to know.
As a side note, never edit the files in /usr/lib/systemd/system. Either use the systemctl edit command or copy the file to /etc/systemd/system and modify it there.
Just to understand correctly… The fstab entry is made instead of the /etc/auto.misc file to define all shares and where they are connected to? But /etc/auto.master still needs to be defined.
Just to say, I much prefer autofs to systemd mount. I’ve never managed to get systemd mount to work properly, as it mounts EVERYTHING as root, and I need things mounted as the current user (assuming multi-user per machine), in order to allow files/folders created to have correct permissions. Autofs you can do UID=$UID, GID=$GID to do this, if there’s a way in systemd mount, I haven’t found it on any of the tutorials I’ve read.
Might try it again, but I seem to recall having tried setting that before, and whenever a user would attempt to copy a file over to the NAS, it would do it, but would pop up an error saying it had failed (using dolphin).
If you think you can help fix it, feel free to split this into a new thread…but it just doesn’t WORK on my systems with systemd-mount. Set it all up (unit files instead of fstab), and I get nothing but:
[tim@sovereign soth]$ pwd
/mnt/soth
[tim@sovereign soth]$ ls documents
ls: cannot access ‘documents’: Too many levels of symbolic links
[tim@sovereign soth]$ cd documents
bash: cd: documents: Too many levels of symbolic links
And journalctl shows no errors, just lines upon lines of
May 03 09:22:13 sovereign systemd[1]: mnt-soth-documents.automount: Got automount request for /mnt/soth/documents, triggered by 5045 (bash)
Since on the NAS at home I have anonymous browsing enabled, seems related to having guest and user both set… If I have guest, it’ll mount, but mounts read-only even if rw is set. If I add user, gets those errors.
So, if I do guest w/ file_mode=0777,dir_mode=0777, it MOSTLY works, but gets the odd behavior that I remember if you attempt to MOVE a file to the share, gives error that it doesn’t have access, but does indeed copy (instead of move) the file if you choose “skip all”