欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【问题解决】文件系统报错:Try to bring eth0 interface up......grep: /etc/mtab: No such file or directory

程序员文章站 2024-03-08 19:00:34
...

问题:

新创建的文件系统报错:

Try to bring eth0 interface up......grep: /etc/mtab: No such file or directory

解决:

修改 etc/init.d/ifcpnfig-eth0 文件:

修改前:

#!/bin/sh

echo -n Try to bring eth0 interface up......>/dev/ttymxc0

if [ -f /etc/eth0-setting ] ; then
	source /etc/eth0-setting

	if grep -q "^/dev/root / nfs " /etc/mtab ; then
		echo -n NFS root ... > /dev/ttymxc0
	else
		ifconfig eth0 down
		ifconfig eth0 hw ether $MAC
		ifconfig eth0 $IP netmask $Mask up
		route add default gw $Gateway
	fi
	echo nameserver $DNS > /etc/resolv.conf

else
	if grep -q "^/dev/root / nfs " /etc/mtab ; then
		echo -n NFS root ... > /dev/ttymxc0
	else
		/sbin/ifconfig eth0 172.16.2.100 netmask 255.255.255.0 up
	fi
fi
echo Done > /dev/ttymxc0

修改后:

#!/bin/sh

echo -n Try to bring eth0 interface up......>/dev/ttymxc0

if [ -f /etc/eth0-setting ] ; then
	source /etc/eth0-setting

	if grep -q nfs /proc/mounts ; then
		echo -n NFS root ... > /dev/ttymxc0
	else
		ifconfig eth0 down
		ifconfig eth0 hw ether $MAC
		ifconfig eth0 $IP netmask $Mask up
		route add default gw $Gateway
	fi
	echo nameserver $DNS > /etc/resolv.conf

else
	if grep -q "^/dev/root / nfs " /etc/mtab ; then
		echo -n NFS root ... > /dev/ttymxc0
	else
		/sbin/ifconfig eth0 172.16.2.100 netmask 255.255.255.0 up
	fi
fi
echo Done > /dev/ttymxc0

参考:iTop开发板和ubuntu虚拟机nfs通信问题

相关标签: # Linux系统移植