Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110887 - autofs: /etc/init.d/autofs status seems to imply /etc/init.d/autofs stop
Summary: autofs: /etc/init.d/autofs status seems to imply /etc/init.d/autofs stop
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Stefaan De Roeck (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-30 05:41 UTC by Stefaan De Roeck (RETIRED)
Modified: 2008-01-24 10:09 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
zzam's emerge info (zzam-emerge-info.txt,2.96 KB, text/plain)
2006-09-10 03:02 UTC, Matthias Schwarzott
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefaan De Roeck (RETIRED) gentoo-dev 2005-10-30 05:41:16 UTC
I really don't know what information is useful to provide here, but I'll give it
a try:

olympia ~ # /etc/init.d/autofs start
 * Starting automounter ...
{different mountpoints}     [ ok ]
olympia ~ # /etc/init.d/autofs start
 * WARNING: "autofs" has already been started.
olympia ~ # /etc/init.d/autofs status
 * status:  stopped
olympia ~ # /etc/init.d/autofs start
 * Starting automounter ...
{different mountpoints}     [ ok ]

The maps contain some more extended syntax, like
 rfaustin -nosuid,intr   cragganmore:/volume1/users/students/&
 * -nosuid,intr  lesse:/volumeC/students/&

Also, the mountpoints that were not busy (locked by someone having cwd in that
mountpoint) at the time of the status-command, are effectively unmounted.  The
automount daemons dissappear as well.

/var/log/everything/current doesn't contain anything between the start and the
status command: (where the status command effectively does a stop)
Oct 30 14:27:01 [rc-scripts] WARNING: "autofs" has already been started.
Oct 30 14:27:08 [rc-scripts] status:  stopped

emerge info:
Portage 2.0.53_rc6 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r3,
2.6.13-gentoo i686)
=================================================================
System uname: 2.6.13-gentoo i686 Intel(R) Pentium(R) 4 CPU 2.80GHz
Gentoo Base System version 1.12.0_pre9
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.13
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=pentium4 -fomit-frame-pointer -pipe -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-O3 -march=pentium4 -fomit-frame-pointer -pipe -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig cvs digest distlocks sandbox sfperms strict userpriv
usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LINGUAS="en_US de en_GB fr nl zh_CN zh_TW"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="cvs://stefaan@cvs.gentoo.org:/var/cvsroot"
USE="x86 X afs alsa apm arts avi berkdb bitmap-fonts cdr cjk crypt cups curl dv
eds emboss encode esd f77 fam flac fltk foomaticdb fortran gd gdbm gif gnome
gphoto2 gpm gstreamer gtk gtk2 imagemagick imlib ipv6 jack java jpeg jpeg2k
junit kde kerberos libg++ libwww mad mikmod mmx motif mozilla mp3 mpeg ncurses
nis nls nptl ogg oggvorbis opengl oss pam pdflib perl png python qt quicktime
readline sdl slang spell sse sse2 ssl svga tcltk tcpd tetex tiff truetype
truetype-fonts type1-fonts udev unicode vorbis xine xinerama xml2 xmms xv xvid
zlib linguas_en_US linguas_de linguas_en_GB linguas_fr linguas_nl linguas_zh_CN
linguas_zh_TW userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, MAKEOPTS, PORTDIR_OVERLAY
Comment 1 Matthias Schwarzott gentoo-dev 2006-09-10 03:01:17 UTC
For me "/etc/init.d/autofs status" does what is supposed, it shows the status and does not change it.
My autofs-version is net-fs/autofs-4.1.3-r7.
Comment 2 Matthias Schwarzott gentoo-dev 2006-09-10 03:02:48 UTC
Created attachment 96565 [details]
zzam's emerge info
Comment 3 Stefaan De Roeck (RETIRED) gentoo-dev 2006-09-10 03:59:07 UTC
I have the exact same autofs version, the problem still remains.  

I do notice that when I disable "ldap" in /etc/nsswitch.conf, the problem doesn't show.  A "/etc/init.d/autofs stats" then gives like:
Active Mount Points:
--------------------
/usr/sbin/automount --timeout 60 --pid-file /var/run/autofs.software.pid /software ldap ou=auto.software.linux-i386,ou=Automount,dc=esat,dc=kuleuven,dc=be -d -D TYPE=linux-i386 -v

When re-activating ldap in nsswitch.conf, I get this (after restarting autofs, before trying to do "/etc/init.d/autofs status"):
Active Mount Points:
--------------------
/usr/sbin/automount --timeout 60 --pid-file /var/run/autofs.software.pid /software ldap ou=auto.software.linux-i386,ou=Automount,dc=esat,dc=kuleuven,dc=be -d -D TYPE=linux-i386 -v
/usr/sbin/automount --timeout 60 --pid-file /var/run/autofs.cdroms.pid /cdroms ldap nisMapName=auto.cds,ou=Automount,dc=esat,dc=kuleuven,dc=be -d -D TYPE=linux-i386 -v
/usr/sbin/automount --timeout 60 --pid-file /var/run/autofs.esat.pid /esat ldap nisMapName=auto.net,ou=Automount,dc=esat,dc=kuleuven,dc=be -d -D TYPE=linux-i386 -v
--- cut ---
and much much more (about 31 automounts in total)

I probably should note that there's one automount failing to start, could this have something to do with the problem.  If I had write access to the ldap-database, I would have tried removing the entry.  

I have no further clue on how to debug this, all ideas are welcome.  
Comment 4 Stefaan De Roeck (RETIRED) gentoo-dev 2006-09-17 02:21:30 UTC
Looking further into this, I noticed that:
- if I remove the automount that's failing to start correctly, everything is ok
- if I don't pass the --pidfile option to start-stop-daemon, everything is ok
- if I disable the storing of the automount-parameters as an append to the pid-file, everything is ok

Exploring the third option:
the start() part of the autofs-init-script contains:
    if [ $? -ne 0 ]; then
      eerror "Failure on $mnt"
    else
      echo "${params}" >> $pidfile
    fi
but $? (return status of start-stop-daemon) is 0, as the automount-daemon first daemonizes and only then almost immediately kills itself (because it can't load the map).  Hence the parameters are written to the pid-file, even though the file didn't previously exist, creating a new file that doesn't contain a valid pid-number.  

I would like to note that the pidfile is created by the daemon also after daemonizing. So roughly there are two possibilities:
- pidfile is firstly created by the automount-daemon, then $params is appended
- $params is written to pidfile, then automount-daemon recreates the pidfile

As I also don't see where the added $params-information to the pidfile is used, I'd like to propose to remove the 5 lines of code I pasted above.  
Comment 5 Wes 2006-11-13 11:51:17 UTC
I just ran into this same issue.  I ran rc-status (which in turns calls /etc/init.d/autofs status) and was watching my syslog at the same time and watched all my automounts shutdown except my home directory and an apps directory that were in use.

Looking at the /etc/init.d/autofs script, there is no status() function defined there, so I suppose this is from /etc/init.d/runscript.sh.  I know nothing about the /sbin/runscript that is apparently the interpreter for init scripts.

Unlike Stefaan in comment #3, I do not have ldap in my nsswitch.conf and building autofs with the ldap USE flag off or on does not make any difference.

whardin@freeman ~ $ equery list autofs           
[ Searching for package 'autofs' in all categories among: ]
 * installed packages
[I--] [  ] net-fs/autofs-4.1.3-r7 (0)
whardin@freeman ~ $ equery list baselayout
[ Searching for package 'baselayout' in all categories among: ]
 * installed packages
[I--] [  ] sys-apps/baselayout-1.12.6 (0)

whardin@freeman ~ $ emerge --info
Portage 2.1.2_rc1-r5 (default-linux/x86, gcc-4.1.1/vanilla, glibc-2.5-r0, 2.6.18-gentoo-r1 i686)
=================================================================
System uname: 2.6.18-gentoo-r1 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System version 1.12.6
Last Sync: Mon, 13 Nov 2006 12:50:02 +0000
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-java/java-config: 1.3.7, 2.0.30
dev-lang/python:     2.3.5-r3, 2.4.4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.60
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r2, 2.17
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=pentium4"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=pentium4"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://gentoo.chem.wisc.edu/gentoo/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo"
LINGUAS="en en_US"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/opt/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage/"
USE="X Xaw3d a52 aac aalib acl acpi aim alsa apache2 audiofile avahi avi bash-completion berkdb bitmap-fonts bluetooth bzip2 cairo caps cddb cdparanoia cdr cgi clamav cli cracklib crypt cups curl dar32 dar64 dba dbm dbus dga directfb divx4linux dlloader doc dri dts dv dvd dvdr dvdread elibc_glibc encode ethereal expat fam fbcon ffmpeg firefox flac fltk foomaticdb fortran ftp gd gdbm ggi gif gpm graphviz gstreamer gtk gtk2 gtkhtml hal iconv imagemagick imap imlib innodb input_devices_evdev input_devices_keyboard input_devices_mouse isdnlog jabber jack java javascript jbig jikes jpeg jpeg2k kde kdeenablefinal kdehiddenvisibility kerberos kernel_linux ldap lesstif libcaca libg++ libwww linguas_en linguas_en_US live lm_sensors logitech-mouse logrotate lzo mad maildir mailwrapper matroska mbox mikmod mime ming mmap mmx mmxext mng modplug mono motif mozdevelop mozilla moznocompose moznoirc mozsvg mp3 mpeg mplayer msn musicbrainz mysql ncurses netboot network nfs nis nptl nsplugin odbc offensive ogg oggvorbis openal openexr opengl oscar pam pcre pdf perl php png posix povray ppds pppd python qt qt3 qt4 quicktime readline real reflection ruby samba sdl sharedext sharedmem slang slp sndfile snmp spell srvdir sse sse2 ssl svg svga sysfs syslog sysvipc tcl tcltk tetex theora threads tidy tiff tk truetype truetype-fonts type1-fonts udev unicode usb userland_GNU vcd verbose vhosts video_cards_ati video_cards_fbdev video_cards_fglrx video_cards_radeon video_cards_vesa videos vidix visualization vorbis wifi win32codecs wmf wxwindows x86 xcomposite xine xinerama xinetd xml xml2 xmlrpc xorg xosd xpm xscreensaver xsl xv xvid xvmc yahoo zeroconf zlib"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 6 Stefaan De Roeck (RETIRED) gentoo-dev 2006-11-13 11:56:26 UTC
I'm interested to see your autofs-configuration. Could you post auto.net or similar?
Comment 7 Wes 2006-11-13 12:32:53 UTC
Here's my /etc/conf.d/autofs

whardin@freeman ~ $ grep -v "#" /etc/conf.d/autofs
localoptions=''
daemonoptions='--timeout 60 -g -v'
nis_mapname='auto.master'

I won't post my auto.master, but I will describe it.

One entry, /autofs, that points to a local automap for pluggable devices and other oddities for my workstation.
40 entries for NIS automaps for company data.  All confirmed valid.

I've not had any other problems with autofs in recent memory.

Unfortunately I don't know how to trace/debug what happens from the time I hit enter.  I think it's safe to say it doesn't actually call the stop() function defined in /etc/init.d/autofs because the ebegin output "Stopping automounter" is not seen (for me anyways).

Here's a sample of whats in the syslog:
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/shuffleboard
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/rhel
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/netapp
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/misnts7-mis
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/jumbo
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/floppy
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/cdrom
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/burn_staging
Nov 13 13:44:52 freeman automount[15034]: rm_unwanted: /autofs/bbot_archive
Nov 13 13:44:52 freeman automount[15034]: shut down, path = /autofs
Nov 13 13:44:52 freeman rc-scripts: status:  stopped
Comment 8 Stefaan De Roeck (RETIRED) gentoo-dev 2006-11-13 12:42:55 UTC
Just curious, if you remove the 5 lines in /etc/init.d/autofs, as I suggest in comment #4, then restart autofs and then ask for a status, does it behave better?
Comment 9 Wes 2006-11-13 14:23:24 UTC
I made the changes proposed in comment #4

Before:
autofs.engtools.pid
17536
--timeout 60 --ghost --verbose --pid-file /var/run/autofs.engtools.pid /engtools yp auto.engtools

After:
autofs.engtools.pid
6759

The behavior of "/etc/init.d/autofs status" does indeed improve after this change.
Comment 10 Wes 2006-11-13 15:07:15 UTC
Since some .pid files did not exist due to remaining open between the stop and the start, I echoed the PID of the automount process into a new .pid as defined on in the 'ps -ef' listing.  Either I messed up or this broke it because after that doing the 'status' caused autofs to stop again.

I finally forced all automount processes to shutdown, removed all the mounts, and restarted the autofs service.  With no errors when starting autofs, status works just fine, but I have been known to restart autofs and still have lingering processes hanging around because my email and user directory are NFS auto mounted, so I feel that I will probably run into this problem again.
Comment 11 Stefaan De Roeck (RETIRED) gentoo-dev 2008-01-24 09:47:57 UTC
Bug is still in there today...

/etc/init.d/autofs status calls
  svc_status inside /sbin/runscript.sh
  which calls update_service_status inside rc-daemon.sh

which looks up all started daemons associated with autofs by looking into
  /var/lib/init.d/daemons/autofs

if one of those services is not running anymore, update_service_status effectively runs /etc/init.d/autofs stop, killing all working automounts

Planning to solve this the way I suggested in comment #4 (as I still see no use for the parameters to be inside the pid-file)
Comment 12 Stefaan De Roeck (RETIRED) gentoo-dev 2008-01-24 09:48:27 UTC
Reassigning to myself
Comment 13 Stefaan De Roeck (RETIRED) gentoo-dev 2008-01-24 10:09:35 UTC
Fixed in net-fs/autofs-4.1.3-r8