nis and autofs manual restart after a reboot

11,805

Solution 1

I had this problem in 14.04.

If your distribution uses Upstart for starting processes, go to /etc/init/autofs.conf and change the line that says

start on runlevel [2345]

to

start on (local-filesystems and net-device-up IFACE!=lo)

This will make Upstart wait with launching autofs until filesystem and networking is available.

Now, I don't use nis, but I assume this is your main problem. It was for many people. Sorry for reviving this old post. Just thought this information needed to be here

Solution 2

In /etc/init/ypbind.conf I added directly after "pre-start script":

    while [ ! -e /var/run/network/ifup.eth? ]
    do
      sleep 0.1
    done

It's because autofs starts before the Networkmanager has brought up the interface. Then NIS looks for the mounts and can't find the NFS Filesystem, because it isn't provided by autofs. Start ypbind after your interface is up and everything is allright.

Solution 3

This sounds as if the start-order of your services is not ok.

At what level-number is NIS started, at what level-number is autofs started and at what level-number is the nfs-client started?

How does your autofs-configuration for your home-directory look like?

Is it in auto.master or is it a submap?

Share:
11,805

Related videos on Youtube

Wojtek
Author by

Wojtek

Updated on September 18, 2022

Comments

  • Wojtek
    Wojtek almost 2 years

    I have a minor inconvenience involving NIS and autofs. I pull my home directory from an NFS server. It all works fine, except that I have to manually restart nis and autofs after each reboot. So after the system starts up, I need to switch to a console (or ssh into the machine) and do

    sudo service nis restart
    sudo service autofs restart
    

    After this, everything works like a charm, with no problems.

    If I don't do that, I can't get past the login screen. To give an example, I have two users on the system, call them localuser (password and home directory on the machine) and remoteuser (password on the remote machine, home directory on NFS). Now, after a fresh reboot, I can log in as localuser with no problems. If I try to login as remoteuser, my password is accepted but no home directory is found, so if I try to log in using GNOME, I get an instant logout. I can still log in as remoteuser remotely or after switching to a text terminal (ctrl+alt+f1), but no home directory is found. After restarting NIS and autofs as mentioned above, I can log in as remoteuser with no further problems until a reboot.

    So my question is: how do I avoid manually restarting these services after each reboot?

    I have been using this computer as a standalone machine, and then moved it to a network, so I imagine some network settings were configured before I installed autofs.
    I am using Ubuntu 12.04, but I had a similar problem on a different machine running older versions of Ubuntu.

    • Lars Rohrbach
      Lars Rohrbach over 11 years
      I've routinely had this problem on Ubuntu, never on RedHat variants -- but only had to restart autofs. Since I don't have many Ubuntu boxen using our NIS/autofs, on some I've added a cronjob to check for an automounted directory, restarting autofs if necessary: 0,15,30,45 * * * * [ -f /home/sub/groupdir ] || service autofs restart