0

The automatic NFS mount at boot doesn't work. This is my fstab row:

nas:/backups     /mnt/nas_backups      nfs     rw,_netdev,auto    0       0

Using mount -a it works, but at boot it doesn't work. After some investigations, I think the problem lies in /etc/network/run/ifstate: I say this because /etc/init.d/mountnfs.sh calls /etc/network/if-up.d/mountnfs, which contains this code:

exit_unless_last_interface() {
    grep "^[:space:]*auto" /etc/network/interfaces  | \
   sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]*$//;s/[ \t]/\n/g' | \
   while read i; do
   if [ `grep -c $i /etc/network/run/ifstate` -eq "0" ]; then
       msg="if-up.d/mountnfs[$IFACE]: waiting for interface $i before doing NFS mounts"
       log_warning_msg "$msg"
       # Can not pass this as a variable because of the while subshell
       mkdir /var/run/network/mountnfs_earlyexit 2> /dev/null
   fi
    done
    if [ -d /var/run/network/mountnfs_earlyexit ]; then
   rmdir /var/run/network/mountnfs_earlyexit 2>/dev/null
   exit 0
    fi
}

This code makes the script exit, because in /etc/network/run/ifstate there is not the eth0 interface (its only content is lo=lo), although eth0 interface is up and running.

Do you have some suggestions about the causes ifstate is not correct, and how to resolve this?

UPDATE 1: This is the configuration of eth0 (an user said it could take a part in the problem, so I write it):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
 # The primary network interface
auto eth0
iface eth0 inet static
         address 10.0.0.11
         netmask 255.255.255.0
         post-up iptables-restore < /etc/iptables.up.rules
         gateway 10.0.0.1

UPDATE 2: This is the output of /etc/init.d/networking restart:

Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).
Reconfiguring network interfaces...SIOCADDRT: File exists
Failed to bring up eth0.
done.

After the restart eth0 works correctly, and /etc/network/run/ifstate still doesn't contain eth0.

7
  • Is your eth0 up? Jul 31, 2012 at 15:10
  • yes it is, it works flawlessy :/ Jul 31, 2012 at 15:11
  • Can you edit your /etc/network/if-up.d/mountnfs and replace /bin/sh with /bin/bash -x, run /etc/init.d/mountnfs.sh manually and report back? Jul 31, 2012 at 15:17
  • no need to modify it, just run bash -x /etc/network/if-up.d/mountnfs... done, this is the result: pastebin.com/jdSHrCdM PS I didn't know this bash option :) Jul 31, 2012 at 16:09
  • The problem lies indeed in /etc/network/run/ifstate. Is is writable? What does /etc/init.d/network restart tell you? Jul 31, 2012 at 16:41

2 Answers 2

1

It was a problem of missing firmware: the network card (a NetXen NX3031) works without installing his proprietary firmware, but works better with it (firmware-netxen package inside non-free repos).

Once installed, at the reboot the network devices has been mounted correctly. Thank you a lot!

0

Maybe adding the "bg" option into your fstab mount line might get around this?

If the bg option is specified, a timeout or failure causes the mount(8) command to fork a >child which continues to attempt to mount the export. The parent immediately returns with a >zero exit code. This is known as a "background" mount.

2
  • I tried, no luck. This was predictable, since the mount in itself works without problems, and the network works flawlessly too. The problem is that the mountnfs init service doesn't try at all to mount the network devices, because it does not find eth0 inside /etc/network/run/ifstate. Aug 1, 2012 at 9:47
  • missing firmware problem. Thank you for your answer Aug 1, 2012 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .