X

Debugging automounter problems

Chris Beal
Senior Principal Software Engineer
I've been working on a fix to an automounter problem for some time. So I'm just testing the final fix and sanity testing the binaries on my laptop. Suddenly my home directory doesn't get mounted. This is of course very strange. It's been working on that laptop for ages so I think it must be my fix.

So naturally the first thing I do is take my binaries off and try again. Few that didn't work either so at least my fix is good. Trouble is I still have an autmounter that doesn't work.

Some things do work however. eg.
$ cd /net//

But somethings don't
$ cd /work/cwb
ksh: /work/cwb: permision denied
$ cd /home/cwb
ksh: /home/cwb: not found

This was rather strange.

So, you may or may not already know this, but there is a way of seeing the diagnostic output from automountd by running the command
$ ls -l /net/=9
/net/=9: No such file or directory

Well actually you can substitute the 9 for another number corresponding to a debug level.
Traditionally this sent output to the console window. So I dilligentley start up a console terminal window and it stays resolutely blank.
After a little investigation it appears that in converting autofs to SMF, these messages are now sent to the smf log
svcs -l \\\*autofs\\\*
fmri svc:/system/filesystem/autofs:default
name Automounter
enabled true
state online
next_state none
state_time Fri 17 Jun 2005 09:45:35 BST
logfile /var/svc/log/system-filesystem-autofs:default.log
restarter svc:/system/svc/restarter:default
contract_id 47
dependency require_all/none svc:/system/filesystem/local (online)
dependency require_all/restart svc:/milestone/name-services (online)
dependency optional_all/none svc:/network/nfs/client (online)

So I take a look in /var/svc/log/system-filesystem-autofs:default.log and low and behold we have the answer.
t1      Automountd: trace level = 9
t1 do_lookup1: action=2 wildcard=FALSE error=2
t1 LOOKUP REPLY : status=2
t10 LOOKUP REQUEST: Wed Jun 22 17:50:02 2005
t10 name=cwb[] map=auto_home opts=nobrowse path=/home direct=0
t10 PUSH /etc/auto_home
t10 Executable map: map=/etc/auto_home key=cwb
t10 read_execout: forking .....
t10 read_execout: map=/etc/auto_home key=cwb line=
t10 POP /etc/auto_home
t10 do_lookup1: action=2 wildcard=FALSE error=2
t10 LOOKUP REPLY : status=2
t10 LOOKUP REQUEST: Wed Jun 22 17:50:02 2005
t10 name=cwb[] map=auto_home opts=nobrowse path=/home direct=0
t10 PUSH /etc/auto_home
t10 Executable map: map=/etc/auto_home key=cwb
t10 read_execout: forking .....
t10 read_execout: map=/etc/auto_home key=cwb line=
t10 POP /etc/auto_home
t10 do_lookup1: action=2 wildcard=FALSE error=2
t10 LOOKUP REPLY : status=2

Note the PUSH of auto_home. In that section it appears that the map is executeable. But in this case auto_home is just a normal file
$ cat /etc/auto_home
# Home directory map for automounter
#
cwb deadarm:/export/home/&

So clearly something has happened to make the automounter believe this is an executeable map (see man automount(1m) for more details of automount maps and executeable ones).
Check the permissions on /etc/auto_\*
$ ls -l /etc/auto_\*
-rwxr-xr-x 1 root root 339 Apr 9 18:11 /etc/auto_direct
-rwxr-xr-x 1 root bin 66 Jun 23 14:44 /etc/auto_home
-rwxr-xr-x 1 root bin 128 Jun 22 17:55 /etc/auto_master

So somehow I've managed to get execute permission on these files, so the automounter tries to run them. Hence I get no mounts. Clearing the exec bit
$ chmod 644 /etc/auto_\*

And it all returns to normal. Now make sure I turn off the debugging so as not to fill up my log files :)
$ ls -l /net/=0
/net/=0: No such file or directory

Putting the debug messages in the the smf log file is great. It makes it much easier to debug remotely and you don't have to rty and capture the console output as you're testing. My laptop is now working fine, and my fix is still good. Of course I still don't know why my map files had the mode changed. I suspect I mistyped. I'll pkgchk the system later to see if there are any other strange permissions I've set...
Technorati Tag:

Technorati Tag:

Technorati Tag:

Technorati Tag:

Technorati Tag:

Join the discussion

Comments ( 1 )
  • Nathan Tuesday, April 13, 2010

    That's a fantastic hint. Helped me solve a silly problem with our automounts. Thanks.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services