- multiple machines using NFS and autofs (automount)
- some of them running FreeBSD 12.2, the others 12.1
- at the end of the day they are shut down simultaneously; before that, it is ensured that all NFS mounts are unmounted (using automount -u and checking via "df -t nfs")
- The 12.2 machine hangs in the rc.d/nfsclient script with repeated error messages indicating it cannot contact the remote portmapper: the remote portmapper does not reply anymore because that machine is also going down.
- This happens because the file /var/db/mounttab is non-empty and still indicates the remote NFS servers despite the fact that all NFS mounts have already been unmounted.
- After the last NFS mount from a server has been unmounted, the corresponding entry in /var/db/mounttab, and the complete file if empty, should be removed.
- This should enable rc.d/nfsclient to skip any further NFS server notification during shutdown.
It seems that the problem with rc.d/nfsclient hanging is that the autounmountd (part of autofs) does not remove entries from /var/db/mounttab, where the regular umount command does.
In this way, even if there are no NFS mounts anymore, entries accumulate in /var/db/mounttab.
It is possible to manually mount a remote dir (e.g., on /mnt) and then unmount it again, and this will remove all the corresponding entries from /var/db/mounttab.
Therefore, it seems that autounmountd needs to be fixed to remove entries from /var/db/mounttab.