Bug 6484 - Autofs ignores NIS auto.master if a local /etc/auto.master exists
Autofs ignores NIS auto.master if a local /etc/auto.master exists
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: autofs (Show other bugs)
6.1
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Nalin Dahyabhai
:
: 5796 6208 6615 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-10-28 22:54 EDT by ted.ruegsegger
Modified: 2008-05-01 11:37 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-04-05 16:12:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description ted.ruegsegger 1999-10-28 22:54:36 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.
Comment 1 Bill Nottingham 1999-11-01 17:34:59 EST
*** Bug 6615 has been marked as a duplicate of this bug. ***

autofs(8) manpage says:
After   the
       auto.master configuration file  is  processed  the
autofs
       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
pro-
       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 17:35:59 EST
*** 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
    else
         search for mount points in NIS maps.
    fi

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.

thanks!


------- 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 17:36:59 EST
*** 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\)*[
\t]*\([0-9][0-9]*\).*$/\2/g')"
+               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
+    )
+else
+#
 #      Check for local maps to be loaded
 #
 if [ -f /etc/auto.master ] ; then
@@ -87,30 +117,6 @@
                        ;;
                esac
                unset basecommand
-           fi
-       done
-    )
-else
-#
-#      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\)*[
\t]*\([0-9][0-9]*\).*$/\2/g')"
-               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"
            fi
        done
     )
Comment 4 John Hein 2000-01-05 12:00:59 EST
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 09:36:59 EST
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 16:12:59 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.