An audience of two

All | CEC | FBinfo | General | Humour | iPhone | Java | Music | W(h)ine | X64

20060823 Wednesday August 23, 2006

Enabling automout in CentOS

It was really bugging me that the automounter wouldn't access my home directory, so I spent a bit of time digging around. When I restarted autofs it complained that it couldn't find a map for auto.home. However ypcat auto_master showed an auto_home entry, so why wasn't it picking that up? I hunted around for a file containing a regerence to auto.home, but no joy.

Eventually I used strace, the Linux equivalent of truss, to see what it was doing. I found that it was reading a file called /etc/sysconfig/autofs. This isn't documented in the man page for autofs or automount but it contains a few configuration values that really should be listed. In particular the option UNDERSCORETODOT=1 looked suspicious. That was causing it to change auto_host to auto.host (What a kludge. What's that about?). I commented it out, only to find that 1 is the default value. Setting it to 0 fixed the problem

So what about /net? Clearly there was an entry in the auto_master:

# ypcat auto_master
auto_home -intr,nosuid,retrans=10,retry=3,nobrowse
-hosts -intr,nosuid,retrans=10,retry=3,nobrowse
. . .

but it wasn't showing up under mount. After a few blind alleys and a bit of googling I found this titbit. /etc/auto.net already exists, so all you need to do is edit the file /etc/rc.d/init.d/autofs and make this change:

getrawmounts | (
while read dir map options
do
# These checks screen out duplicates and skip over directories
# where the map is '-'.
# We can't do empty or direct host maps, so don't bother trying.

# Strip trailing slashes from the dir line if it exists to aid
# in checking for duplicate maps
dir=`echo "$dir" | sed -e "s/\/*$//"`

if [ ! -z "$map" -a "$map" = "-hosts" ] ; then
# START EDIT
if [ -x '/etc/auto.net' ]; then
map='/etc/auto.net'
else
continue
fi
# END EDIT
fi
if [ $DISABLE_DIRECT -eq 1 \
-a x`echo $dir | grep -E "^/-"` != 'x' ]
then
continue
fi

Then restart the automounter with /etc/rc.d/init.d/autofs restart and you're away.

That strace thing annoys me too. Half the problem of working with Linux is that the dialect difference. Most of the time for every Solaris command there's an equivalent Linux command, it's just finding it. Now I'm not saying that either side is "right" or "wrong" here, but it would be nice if there was a set of pseudo Solaris man pages, so for example if I typed "man truss" it would say "use strace" and would say what the equivalent commonly used flags are.

Another project for my copious free time I suppose.

Permalink del.icio.us | furl | slashdot | technorati | digg Comments [1]
Tags:

Stinkin' Badges

Santa Cruz Mountains wine info on Wikispaces


follow davetong at http://twitter.com

Add to Technorati Favorites

www.flickr.com
This is a Flickr badge showing public photos from davetong. Make your own badge here.

Locations of visitors to this page

Calendar

« August 2006 »
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
19
20
21
22
24
25
26
27
30
31
   
       
Today

RSS Feeds

XML
All
/CEC
/FBinfo
/General
/Humour
/iPhone
/Java
/Music
/W(h)ine
/X64

Search

Links


Navigation



Referers

Today's Page Hits: 118