Bug 17385 - Missing shared library
Missing shared library
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: autofs (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-09-09 15:18 EDT by David Highley
Modified: 2007-04-18 12:28 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-19 15:19:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Highley 2000-09-09 15:18:32 EDT
If you are using NIS and automounter for home directories the
/var/log/messages file will have an errro for a missing shared
/usr/lib/autofs library.
Comment 1 Nalin Dahyabhai 2000-09-11 14:41:26 EDT
/usr/lib/autofs is a directory, not a library.  What are the error messages
you're getting?
Comment 2 David Highley 2000-09-11 23:57:04 EDT
/var/log/messages:
automount: can not open lookup module auto.home
(/usr/lib/autofs//lookup_auto.home.so: can not open shared object file:
No such file or directory)
Comment 3 Nalin Dahyabhai 2000-09-12 14:38:40 EDT
What does your automounter master map (auto.master) look like?  It looks like
the lookup type is being set to auto.home instead of "yp" with "auto.home" as
the name of the map....
Comment 4 dmetz 2000-09-29 19:20:21 EDT
nalin,

I'm sure you are aware of the list of problems reported for the autofs script.
I looked at the rh-7 version (autofs-3.1.5 I believe).  It got most of them.
But it still has a bug in the restart section. I think the code is stepping a
little
over the KISS line tool. Also, in the area of use /etc/auto.master, don't use
/etc/auto.master,
use yp:auto.master, I would like the option to use only /etc/auto.master or to
use both whether
there is a yp:auto.master or not as we used to be able to do under
sunos/solaris. 

I'm including an autofs script below that addresses these issues. Note the
trailing $ in the
grep expression for reload. And the + format support for auto.master. The autofs
and auto.master manpages need updated to reflect these. They've been fairly well
tested. 

Sorry about stripping the hesiod and debian support. I can't test those. I think
they could 
be added back and still keep most of the simplicity.

Derald
dmetz@remotesensing.org

-------------------------------------------------------------------
! /bin/bash
# $Id$
# $crtd:  by  Derald Metzger  on  000926 $
# $cmnt:
#
# WARNING: 000926 - Derald Metzger <dmetz@remotesensing.org>
# The autofs-3.1.4-4 autofs with redhat-6.2 had some problems and
# didn't support optional inclusion of a yp:auto.master.
# I looked at the rh-7.0 release and thought it went a bit too far
# beyond the KISS requirements. This fixes the problems I found
# and adds support for control of yp:auto.master via a "+" field in 
# the /etc/auto.master. It does NOT support debian, hesiod maps,
# etc.
#
# Much of this is borrowed from the script in the autofs-3.1.4-4 pkg
# of redhat release 6.2.
#
#  Some notes based on the autofs-3.1.4-4 manpages:
# auto.master(5) note:
# Format of the mapfield is maptype:mapname.  Only the file and yp map
# types are addressed here tho others could easily be added in the
# case table. The default map type (null type field) is yp. 
#
# 000927-dam. Summary of changes:
# 1. Strip of support for debian and hesiod maps. I can't test those.
# 2. Document and pretty print for readability.
# 3. Fix for use of yp maps in /etc/auto.master.
# 4. Extend to support appending yp:auto.master via + in /etc/auto.master.
# 5. Fix restart/reload.
# 6. Add pid param to status: eg ./autofs status pid
#    This will prefix the pids to the active processes list.
# 7. The default map tpye (null type field) is yp. This should make
#    this autofs backward compatable in many situations.
#
# chkconfig: 345 18 82
# processname: /usr/sbin/automount
# config: /etc/auto.master
# description: autofs starts/stops/monitors automount processes \
#              which mount filesystems on demand
# $
#  Setup
DAEMON=/usr/sbin/automount
initdir=/etc/rc.d/init.d
. $initdir/functions
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

#  We can add local options here, e.g. localoptions='rsize=8192,wsize=8192'
localoptions='rsize=8192,wsize=8192'

#  This function will parse a map line from an auto.master and echo
#  a suitable automount cmdline or an err msg.
function parse_line() {
    [ -d "$dir" ] || { echo "### No dir for mountpoint $dir"; continue; }
        if echo "$mapfield" | grep -q : >/dev/null; then \
                type=`echo $mapfield | cut -d: -f1`
                map=`echo $mapfield | cut -d: -f2` 
        else
                type=yp
                map=$mapfield
        fi
    [ -z $map ] && { echo "### Bad map arg for $dir"; continue; }
    # Get possible timeout option
    if echo $options | grep -- '-t' >/dev/null 2>&1 ; then \
        timo=`echo "$options" |\
            sed 's/--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/--timeout \2/g'`
        fi
    #collect all other options, converting -rwsize, et al to rwsize
    options=`echo "$options" | sed -e 's/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g'`
    case $type in
        file) cmd="$DAEMON $timo $dir file $map $options $localoptions" ;;
        yp) cmd="$DAEMON $timo $dir yp $map $options $localoptions" ;;
        *) echo "### bad maptype for $dir"; return ;;
    esac
        echo $cmd | sed 's/  / /g'
}

#  Function to echo a list of automount commands based on content of
#  the auto.master files. Output is used to start automounter
#  processes or check the config against running processes.
function getmounts() {
    # Check for local maps to be loaded
    if [ -f /etc/auto.master ]; then \
        echo "## file:/etc/auto.master"
        # /etc/auto.master exists so set the no yp:auto.master flag.
        NOYPFLG=`mktemp /tmp/autofs_noypflg.XXXXXX`
        cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| 
        while read dir mapfield options; do
            # If 1st field is a + clear the no yp:auto.master flag.
            [ "$dir" = + ] && { rm -f $NOYPFLG; continue; }
            parse_line
        done
    fi
    #  Conditionally check for yp:auto.master
    [ -f $NOYPFLG ] && rm -f $NOYPFLG && return
        [ -x /usr/bin/ypcat ] || return
    echo "## yp:auto.master"
    ypcat -k auto.master | 
    while read dir mapfield options; do
        parse_line
    done
}

#  See how we were called.
case "$1" in
  start)
    # Check if the automounter is already running?
    if [ ! -f /var/lock/subsys/autofs ]; then
        echo -n 'Starting automounter: '
        getmounts | sh && success "autofs startup" || failure "autofs startup"
        echo
        touch /var/lock/subsys/autofs
    fi
    ;;
  stop)
    echo -n "Stopping automounter:"
    killproc $DAEMON
    echo
    rm -f /var/lock/subsys/autofs
    ;;
  reload|restart)
    if [ ! -f /var/lock/subsys/autofs ]; then
        echo "Automounter not running"
        exit 1
    fi
    echo "Checking for changes to auto.master ...."
        TMP1=`mktemp /tmp/autofs.XXXXXX` || { 
            echo "could not make temp file" >& 2; exit 1; }
        TMP2=`mktemp /tmp/autofs.XXXXXX` || {
            echo "could not make temp file" >& 2; exit 1; }
    getmounts >$TMP1
    cat $TMP1
    ps axwww|grep "[0-9]:[0-9][0-9] $DAEMON " |
        while read pid tt stat time command; do
            echo "$command" >>$TMP2
            #  If running cmds not in config then stop them
            if ! grep -q "^$command$" $TMP1; then
                kill -USR2 $pid
                echo "Stop $command"
            fi
        done
    cat $TMP1 | while read x; do
        [ `expr "$x" : '#'` -gt 0 ] && continue
        #  If configed cmds not running start them
        if ! grep -q "^$x$" $TMP2; then
            $x
            echo "Start $x"
        fi
    done
    rm -f $TMP1 $TMP2
    ;;
  status)
    echo "Configured Mount Points:"
    echo "------------------------"
    getmounts
    echo ""
    echo "Active Mount Points:"
    echo "--------------------"
    ps axwww|grep "[0-9]:[0-9][0-9] $DAEMON " | 
        while read pid tt stat time command; do 
                        [ "$2" = "pid" ] && echo -n "pid=$pid "
                        echo $command
                done
    ;;
  *)
    echo "Usage: $initdir/autofs {start|stop|reload|status}"
    exit 1
esac

exit 0


should be updated to support the
Comment 5 Nalin Dahyabhai 2000-10-02 01:59:46 EDT
I'll have to take some time to look at the revised script -- since we already
deviate from the canonical init script, I guess we could drop the debian section
altogether, but that makes the patch bigger.  Please also send it to the autofs
mailing list if you think it's a general improvement -- I've seen at least 5
different versions on the list in the last few months.
Comment 6 dmetz 2000-10-11 17:31:11 EDT
Mods/fixes for the autofs script by Derald Metzger:
1. Change item 7. in the doc to read:
# 7. If there is no colon in the mapfield the default type will be
#    file if the 1st char is / otherwise yp. This should make things
#    backward compatable in many situations.
2. Insert befor the else in function parse_line()
    elif echo "$mapfield" | grep -q "^/" >/dev/null; then \
        type=file
        map=$mapfield
3. In function gemounts() quote the $NOYPFLG in the test line like so:
    [ -f "$NOYPFLG" ] && rm -f $NOYPFLG && return
Comment 7 Nalin Dahyabhai 2001-08-28 19:56:31 EDT
Okay, I think the support for "+" maps in auto.master is in 3.1.7-20.  I'd get
too many complaints if I tried backing out the various gymnastics the current
script goes through, so it can't just be reverted.  Adding the "$" at the end of
the pattern seemed to not work correctly -- I'll have to look at that some more.

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