Fault Description
Recently finally updated the next Gentoo, reboot found that my eth0 network card failed to start:
* Bringing up interface eth0
* Error:interface eth0 does not exist
* Ensure that you have loaded the correct kernel module for your hardware
* ERROR:net.eth0 failed to start
And start some of my usual services, such as MongoDB, also error:
~ #/etc/init.d/mongodb Restart
* Bringing up interface eth0
* Error:interface eth0 does not exist
* Ensure that you have loaded the correct kernel module for your hardware
* ERROR:net.eth0 failed to start
* Error:cannot start MongoDB as Net.eth0 would not start
You also need to start the network card?
To view the kernel and DMESG:
Check the kernel module has been selected, and previously eth0 also have, and then look at DMESG
DMESG |grep Network
[74.261872] systemd-udevd[14259]: Renamed network interface wlan0 to WLP2S0
[74.391865] systemd-udevd[14259]: Renamed network interface eth0 to ENP0S4
The original was renamed.
Why?
From udev-197 will automatically assign better interface names, specific explanations please see [predictablenetworkinterfacenames] (http://www.freedesktop.org/wiki/Software/ Systemd/predictablenetworkinterfacenames),
Solution, there are three kinds
A temporary solution, restart or will fail
Ifrename-i enp0s4-n eth0 #修改网卡名字变成原来的eth0
Use a new name
Rm/etc/init.d/net.eth0 #删除不存在的引用
localhost ~ # rc-update Delete net.eth0 default #删除不存在的开机启动
* Service Net.eth0 removed from runlevel default
localhost ~ # rc-update Add net.enp0s4 default #使用新名字
Reset the rules of the udev, or use the original method
Ln-s/dev/null/etc/udev/rules.d/80-net-name-slot.rules
The second, and the third need to reboot
Why do I need to start the network card to start the application?
View the/etc/init.d/mongodb script, found because depend, the general initialization script structure is
#!/sbin/runscript
Depend () {
(Dependency information)
}
Start () {
(Commands necessary to start the service)
}
Stop () {
(Commands necessary to stop the service)
}
Restart () {
(Required to restart the service)
}
For example, MongoDB's dependence is
Depend () {
Need net #需要依赖net. X
}