If the automounter daemon starts before the ypbind daemon is ready to answer queries than the automounter does not work for nfs mounts depending on nis (other mount types not tested), even if the ypbind daemon later gets ready.
There exists a race condition in ubuntu 12.04 between autofs.conf and ypbind.conf which leads to the above described problem. The reason for that is that ypbind.conf sometimes lies about the state of the ypbind daemon. The post-start script in ypbind.conf terminates after 5 tries ( about 5 sec.) to contact the nis-server or when ypbind respawns and change its state to running. Upstart than kills the dedicated wait-for-state job. Now autofs.conf starts the automounter daemon but the ypbind daemon is not ready to work and the automounter does not work for nfs automounts too. I have to restart the automounter daemon manualy (stop autofs; start autofs) after the ypbind daemon is working to get nfs automounts working. I solve the problem by changing ypbind.conf so that the "test loop" in post-start script only terminates when ypwhich is working. Additional I add a parameter TIMEOUT=300 to the exec wait-for-state .... call in start-ypbind.conf because the default default timeout of 30 sec is to short for my network and leads to the above described problem. OK the 5min time out is not a 100% resolution. For a 100% resolution of the race condition I have to set the parameter WAIT_FOREVER="T". autofs.conf: -------------------vvv snip vvvv---------------------------------- description "NIS binding process" author "Steve Langasek <steve.langa...@canonical.com>" # Patterned after the statd.conf job in nfs-common. start on (started portmap ON_BOOT= or (started portmap ON_BOOT=y and ((filesystem and static-network-up) or failsafe-boot))) stop on stopping portmap or runlevel [!2345] expect daemon respawn respawn limit 3 250 pre-start script NISSERVER=false [ -f /usr/sbin/ypbind ] && [ -f /etc/defaultdomain ] || { stop; exit 0; } [ -f /etc/default/nis ] && . /etc/default/nis oname=$(domainname) nname=$(cat /etc/defaultdomain) if [ "$oname" != "$nname" ]; then echo "Setting NIS domainname to: $nname" domainname "$nname" fi case $NISSERVER in master|slave|[Yy]*) ;; *) case $NISCLIENT in false|[nN]*) { stop; exit 0; } ;; esac ;; esac if [ "$NISSERVER" != false ]; then start wait-for-state WAIT_FOR=ypserv WAITER=ypbind WAIT_STATE=running >/dev/null fi end script script [ -f /etc/default/nis ] && . /etc/default/nis BROADCAST=-broadcast while read arg junk ; do case $arg in ypserver|domain) BROADCAST= ;; esac done < /etc/yp.conf exec ypbind $BROADCAST $YPBINDARGS end script post-start script # Give ypbind time to finish starting up, so that jobs depending on # it are actually able to use the maps echo -n "Binding to YP server " bound= #for i in 1 2 3 4 5 while [ -z "${bound}" ] do echo -n "." #if status ypbind | grep -q start/respawn; then # # something killed ypbind; short-circuit here instead # # of continuing to try to call ypwhich, since that # # can take more than a minute. # break #fi if [ "$(ypwhich 2>/dev/null)" != "" ]; then bound=1 break fi sleep 3 done if [ "$bound" ]; then echo "done" echo "$(date) ypbind is running" sleep 5 #else # echo "backgrounded" fi end script ---------------^^^ snip ^^^----------------------------------- start-ypbind.conf: -------------------vvv snip vvvv---------------------------------- description "block processes that need ypbind" author "Steve Langasek <steve.langa...@canonical.com>" instance $JOB env JOB= start on (starting autofs or starting am-utils or starting gdm or starting lightdm or starting atd) task exec start wait-for-state WAITER="$JOB" WAIT_FOR=ypbind WAIT_STATE=running TIMEOUT=300 ---------------^^^ snip ^^^---------------------------------- -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1007273 Title: autofs does not start automatically after reboot To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/autofs5/+bug/1007273/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs