Red Hat Bugzilla – Bug 6484
Autofs ignores NIS auto.master if a local /etc/auto.master exists
Last modified: 2008-05-01 11:37:52 EDT
According to the manpage and the comments at the top of the script,
autofs should first process the local /etc/auto.master and then any NIS
auto.master. Previous versions (3.1.3-2) did this correctly.
Later versions (I've seen this in 3.1.3-5 and 3.1.3-9) have an "else"
after the first check, so that the NIS check isn't performed if the local
/etc/auto.master exists (which it does, since the RPM installs it).
I suspect this is an unintentional error introduced when the name of the
lock file was changed.
*** Bug 6615 has been marked as a duplicate of this bug. ***
autofs(8) manpage says:
auto.master configuration file is processed the
script will check for an NIS map with the same
such a map exists then that map will be processed
same way as the auto.master map. The NIS map will be
But that's not true, the autofs script only looks at the
auto.master map if /etc/auto.master does not exist.
The autofs-master-yp.patch patch included with the autofs
SRPM mentions this behavior.
I suggest that the behavior be modified to be compatible
with Sun's automounter, checking for a line starting with
"+" and including that map (e.g. "+auto.master"). It is
useful to be able to have both local automounter
configuration and to be able to pull the configuration from
NIS. This would be a trivial change to the autofs script.
*** Bug 5796 has been marked as a duplicate of this bug. ***
A logic error in /etc/rc.d/init.d/autofs prevents automount
from being started for maps that are received through NIS.
the function 'getmounts()' in the autofs start script does
if[ -f /etc/auto.master ] then
start automount for mount points in/etc/auto.master
search for mount points in NIS maps.
this logic prevents maps from being loaded from _both_
/etc/auto.master and over NIS. The fix for this is quite
simple: test first for /etc/auto.master and then test for
NIS maps. I'd be happy to provide a patch if this
explanation isn't clear.
------- Additional Comments From 10/14/99 06:01 -------
A quick fix is to use the startup script from 6.0
Although not the best of solutions, I need my system up and running.
------- Additional Comments From 10/20/99 13:44 -------
Autofs should check /etc/nsswitch.conf to determine if it should use
NIS at all. In 6.0, you could say "automount: files" in
/etc/nsswitch.conf, and autofs it would still check NIS. It looks
like this change in 6.1 was meant to remedy the problem, but the best
solution was not chosen.
*** Bug 6208 has been marked as a duplicate of this bug. ***
The init script for autofs does check for a local
auto-master file in /etc before asking the NIS server. This
is against the usual philosophy that NIS maps take
precedence over local files.
Additionally if the map from the NIS server is used the
script assumes map-type 'yp' as default what makes it
impossible to mix local and NIS maps.
Included is a patch that moves the NIS maps to the front of
the script and additionally checks if the found auto.master
map contains any maps that begin with a slash, then assuming
that a local map is wanted, setting the map type to 'file'.
--- rc.d/init.d/autofs.orig Mon Sep 20 17:13:32 1999
+++ rc.d/init.d/autofs Sat Oct 16 19:20:35 1999
@@ -37,6 +37,36 @@
+# Next to check for YellowPage maps to be loaded
+ if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master
2>/dev/null | wc -l` -gt 0 ]
+ ypcat -k auto.master | (
+ while read dir map options
+ if [ ! -z "$dir" -a ! -z "$map" \
+ -a x`echo "$map" | cut -c1` != 'x-'
+ map=`echo "$map" | sed -e 's/^auto_/auto./'`
+ if echo $options | grep -- '-t' >/dev/null
2>&1 ; then
+ mountoptions="--timeout $(echo $options
+ sed 's/^.*-t\(imeout\)*[
+ options=`echo "$options" | sed -e '
+ s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
+ s/\(^\|[ \t]\)-/\1/g'`
+ if [ x`echo "$map" | grep '^\/'` != 'x' ]
+ echo "/usr/sbin/automount $mountoptions $dir
$type $map $options $localoptions"
# Check for local maps to be loaded
if [ -f /etc/auto.master ] ; then
@@ -87,30 +117,6 @@
-# Next to check for YellowPage maps to be loaded
- if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master
2>/dev/null | wc -l` -gt 0 ]
- ypcat -k auto.master | (
- while read dir map options
- if [ ! -z "$dir" -a ! -z "$map" \
- -a x`echo "$map" | cut -c1` != 'x-'
- map=`echo "$map" | sed -e 's/^auto_/auto./'`
- if echo $options | grep -- '-t' >/dev/null
2>&1 ; then
- mountoptions="--timeout $(echo $options
- sed 's/^.*-t\(imeout\)*[
- options=`echo "$options" | sed -e '
- s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
- s/\(^\|[ \t]\)-/\1/g'`
- echo "/usr/sbin/automount $mountoptions $dir
yp $map $options $localoptions"
I've recently upgraded to RedHat 6.1 and found the same problem and read the
submitted comments regarding bug 6484.
But it made me wonder about the automount entry in nsswitch.conf
Is this ignored? Perhaps a good solution would be to use the NSS to determine
where automount gets its map information.
The automount line in /etc/nsswitch.conf is ignored by autofs. Most other
lines (passwd, group, hosts) map directly to a set of functions in libc that
consult these lines, but there is no such function in libc (on any flavor that
I've ever heard of) for looking up information about filesystems, so autofs
implements lookups internally.
The behavior of the init script in 3.1.4-6 once again tries to merge the local
and NIS auto.master maps. Entries in NIS that duplicate entries in the local
file get dropped, and particular NIS maps can still be disabled by specifying a
map type of '-' for the directory in the local auto.master file.
This should solve the problems everyone has been having. Please respond with
results (good or bad) if you upgrade to this version, which will show up in the
next Raw Hide (ftp://ftp.redhat.com/pub/rawhide/i386/RedHat/RPMS/) release.