Debian Squeeze stable:ifstate文件不包含networking接口(与在启动时挂载失败NFS有关)

启动时的自动NFS挂载不起作用。 这是我的fstab行:

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

使用mount -a它工作,但在启动它不起作用。 经过一番调查,我认为问题在于/etc/network/run/ifstate :我这样说是因为/etc/init.d/mountnfs.sh调用了/etc/network/if-up.d/mountnfs ,它包含了这个码:

 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 } 

这段代码使脚本退出,因为在/etc/network/run/ifstate中没有eth0接口(它的唯一内容是lo=lo ),尽pipeeth0接口已经启动并正在运行。

如果状态不正确,你有什么build议吗?如何解决?

更新1:这是eth0的configuration(用户表示可以参与这个问题,所以我写它):

 # 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 

更新2:这是/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. 

eth0重新启动后, /etc/network/run/ifstate仍然不包含eth0

这是一个缺less固件的问题:网卡(一个NetXen NX3031)没有安装他的专有固件,但工作更好( firmware-netxen包内非免费回购)。

一旦安装,在重新启动的networking设备已正确安装。 万分感谢!

也许在你的fstab安装行中join“bg”选项可能会解决这个问题?

如果指定了bg选项,那么超时或失败会导致mount(8)命令fork>>子继续尝试装载导出。 父母立即返回一个>零退出代码。 这被称为“背景”安装。