Why does autofs log "couldn't get ioctl fd for direct mount" error message while autofs service is restarting or shutting down on an NIS server?
Environment
- Red Hat Enterprise Linux
- Automount
- NIS server
Issue
- While starting the autofs service on an NIS server, below messages are triggered in the "/var/log/messages" log eventhough all the shares(direct and indirect) are accessible and working fine.:
Jun 3 14:01:01 testserver automount[10409]: do_umount_autofs_direct: couldn't get ioctl fd for direct mount /mymount
Jun 3 14:01:01 testserver automount[10409]: do_umount_autofs_direct: couldn't get ioctl fd for direct mount /mount1
Jun 3 14:01:01 testserver automount[10409]: do_umount_autofs_direct: couldn't get ioctl fd for direct mount /data
Jun 3 14:01:01 testserver automount[10409]: do_umount_autofs_direct: couldn't get ioctl fd for direct mount /share
Resolution
- If running autofs on an NIS server, then use either NIS or local files for automount maps (not both).
- Change the
automountentry in/etc/nsswitch.confto look like
automount: files
OR
automount: NIS
Note: If the machine running autofs is NOT an NIS server, then it's okay to read automount maps from both NIS and local files as long as the same maps aren't defined in both places.
Root Cause
autofs is reading the direct maps from both NIS and the local files, but there's only one autofs mountpoint for each of those mounts so after it's unmounted the first time the mount point does not exist anymore, but we still go and try to unmount it again.
Diagnostic Steps
- Check the umount pattern while the service is shutting down
Jun 3 15:01:41 testserver automount[1520]: umount_multi: path /mymount incl 0
Jun 3 15:01:41 testserver automount[1520]: umounted direct mount /mymount
At this point we've successfully unmounted it. But we're going to call umount_multi again, and this time we get an error:
Jun 3 15:01:41 testserver automount[1520]: umount_multi: path /mymount incl 0
Jun 3 15:01:41 testserver automount[1520]: do_umount_autofs_direct: couldn't get ioctl fd for direct mount /mymount
- Check the pattern while the service is coming up. Here we load the maps from local files.
Jun 3 15:01:59 testserver automount[960]: lookup_nss_read_map: reading map files auto.direct
Jun 3 15:01:59 testserver automount[960]: parse_init: parse(sun): init gathered global options: (null)
and then we read it in again via NIS:
Jun 3 15:01:59 testserver automount[960]: lookup_nss_read_map: reading map nis auto.direct
Jun 3 15:01:59 testserver automount[960]: parse_init: parse(sun): init gathered global options: (null)
and then we see what appears to be the /mymount autofs mountpoint being mounted twice:
Jun 3 15:01:59 testserver automount[960]: mounted direct on /mymount with timeout 300, freq 75 seconds
Jun 3 15:01:59 testserver automount[960]: do_mount_autofs_direct: mounted trigger /mymount
Jun 3 15:01:59 testserver automount[960]: remount_active_mount: trying to re-connect to mount /mymount
Jun 3 15:01:59 testserver automount[960]: mounted direct on /mymount with timeout 300, freq 75 seconds
Jun 3 15:01:59 testserver automount[960]: remount_active_mount: re-connected to mount /mymount
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
