Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 6484

Summary: Autofs ignores NIS auto.master if a local /etc/auto.master exists
Product: [Retired] Red Hat Linux Reporter: ted.ruegsegger
Component: autofsAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 6.1CC: chauvin, chberg5, kresa, neumann, shuey, ted.ruegsegger, txn2tahx3v
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-04-05 20:12:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description ted.ruegsegger 1999-10-29 02:54:36 UTC
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.

Comment 1 Bill Nottingham 1999-11-01 22:34:59 UTC
*** Bug 6615 has been marked as a duplicate of this bug. ***

autofs(8) manpage says:
After   the
       auto.master configuration file  is  processed  the
       script  will  check  for an NIS map with the same
name. If
       such a map exists then that map will be processed
in  the
       same  way as the auto.master map. The NIS map will be
       cessed last.

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.

Comment 2 Bill Nottingham 1999-11-01 22:35:59 UTC
*** 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
the following:

    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.

Comment 3 Bill Nottingham 1999-11-01 22:36:59 UTC
*** 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 @@
 function getmounts()
+#      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 ]
+  then
+    ypcat -k auto.master | (
+       while read dir map options
+       do
+           if [ ! -z "$dir" -a ! -z "$map" \
+                       -a x`echo "$map" | cut -c1` != 'x-'
+           then
+               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\)*[
+               fi
+               options=`echo "$options" | sed -e '
+                 s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
+                 s/\(^\|[ \t]\)-/\1/g'`
+               if [ x`echo "$map" | grep '^\/'` != 'x' ]
+                   then
+                        type="file"
+                    else
+                        type="yp"
+               fi
+               echo "/usr/sbin/automount $mountoptions $dir
$type $map $options $localoptions"
+           fi
+       done
+    )
 #      Check for local maps to be loaded
 if [ -f /etc/auto.master ] ; then
@@ -87,30 +117,6 @@
                unset basecommand
-           fi
-       done
-    )
-#      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 ]
-  then
-    ypcat -k auto.master | (
-       while read dir map options
-       do
-           if [ ! -z "$dir" -a ! -z "$map" \
-                       -a x`echo "$map" | cut -c1` != 'x-'
-           then
-               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\)*[
-               fi
-               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"

Comment 4 John Hein 2000-01-05 17:00:59 UTC
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.

Comment 5 Nalin Dahyabhai 2000-02-02 14:36:59 UTC
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.

Comment 6 Nalin Dahyabhai 2000-04-05 20:12:59 UTC
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 ( release.