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

问题:

新创建的文件系统报错:

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通信问题

上一篇:reset脚本


下一篇:2021-01-21 大数据尚学堂课程笔记 day1