Failed to start LSB: Bring up/down networking
遇到這個錯誤好幾次,所以總結了一下排解的幾種方法。
錯誤記錄及排查方法過程:
當我克隆出一台新的 centos7 的虛擬機器的時候,修改了網絡卡配置檔案啓動時,報錯
1
2
3
[root@centos7 ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journalctl -xe” for details.
[root@centos7 ~]#
按照提示輸入 systemctl status network.service 檢視
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@centos7 ~]# systemctl status network.service
● network.service – LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2017-03-13 23:24:37 CST; 16s ago
Docs: man:systemd-sysv-generator(8)
Process: 2878 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 systemd[1]: network.service: control process exited, code=exited status=1
Mar 13 23:24:37 centos7 systemd[1]: Failed to start LSB: Bring up/down networking.
Mar 13 23:24:37 centos7 systemd[1]: Unit network.service entered failed state.
Mar 13 23:24:37 centos7 systemd[1]: network.service failed.
無奈去百度了一下,找到解決方法,説是 centos7 沒有 70-persistent-net.rules 這個檔案,所以新克隆的機器需要配置 mac 地址。
通過 ip a 命令檢視 mac 地址是 00:0c:29:0c:15:49
1
2
2: eno16777736:
link/ether 00:0c:29:0c:15:49 brd ff:ff:ff:ff:ff:ff
然後在配置檔案中加入這一行(如果存在的話只修改就可以)
1
HWADDR=00:0c:29:0c:15:49
重啓生效
1
2
3
[root@centos7 ~]# systemctl restart network.service
Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journalctl -xe” for details.
[root@centos7 ~]#
發現依然有這個錯誤
檢視啓動日誌
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Mar 13 23:51:35 centos7 systemd: Starting LSB: Bring up/down networking…
Mar 13 23:51:35 centos7 network: Bringing up loopback interface: Could not load file ‘/etc/sysconfig/network-scripts/ifcfg-lo’
Mar 13 23:51:35 centos7 network: Could not load file ‘/etc/sysconfig/network-scripts/ifcfg-lo’
Mar 13 23:51:35 centos7 network: Could not load file ‘/etc/sysconfig/network-scripts/ifcfg-lo’
Mar 13 23:51:35 centos7 network: Could not load file ‘/etc/sysconfig/network-scripts/ifcfg-lo’
Mar 13 23:51:35 centos7 network: [ OK ]
Mar 13 23:51:36 centos7 network: Bringing up interface eth0: Error: Connection activation failed: No suitable device found for this connection.
Mar 13 23:51:36 centos7 network: [FAILED]
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 network: RTNETLINK answers: File exists
Mar 13 23:51:36 centos7 systemd: network.service: control process exited, code=exited status=1
Mar 13 23:51:36 centos7 systemd: Failed to start LSB: Bring up/down networking.
Mar 13 23:51:36 centos7 systemd: Unit network.service entered failed state.
Mar 13 23:51:36 centos7 systemd: network.service failed.
發現無法載入/etc/sysconfig/network-scripts/ifcfg-lo 檔案
給 NetworkManager-wait-online 服務設定開機自啓動
1
systemctl enable NetworkManager-wait-online.service
然後重啓網絡卡
1
2
3
[root@centos7 ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journalctl -xe” for details.
[root@centos7 ~]#
檢視日誌
1
Could not load file ‘/etc/sysconfig/network-scripts/ifcfg-lo’
這個錯誤依然存在
1
2
systemctl stop NetworkManager
systemctl disable NetworkManager
將 NetworkManager 關閉,然後重啓網絡卡,檢視日誌
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Mar 14 00:31:27 centos7 systemd: Starting LSB: Bring up/down networking…
Mar 14 00:31:27 centos7 network: Bringing up loopback interface: [ OK ]
Mar 14 00:31:28 centos7 network: Bringing up interface eth0: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device eth0 does not seem to be present, delaying initialization.
Mar 14 00:31:28 centos7 /etc/sysconfig/network-scripts/ifup-eth: Device eth0 does not seem to be present, delaying initialization.
Mar 14 00:31:28 centos7 network: [FAILED]
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 network: RTNETLINK answers: File exists
Mar 14 00:31:28 centos7 systemd: network.service: control process exited, code=exited status=1
Mar 14 00:31:28 centos7 systemd: Failed to start LSB: Bring up/down networking.
Mar 14 00:31:28 centos7 systemd: Unit network.service entered failed state.
Mar 14 00:31:28 centos7 systemd: network.service failed.
Mar 14 00:33:42 centos7 dhclient[3813]: DHCPREQUEST on eno16777736 to 10.0.0.254 port 67 (xid=0x4d17f187)
Mar 14 00:33:42 centos7 dhclient[3813]: DHCPACK from 10.0.0.254 (xid=0x4d17f187)
那個錯誤已經不見了,但是重啓網絡卡
1
2
3
[root@centos7 ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journalctl -xe” for details.
[root@centos7 ~]#
依然是這個錯誤,然後我又重新百度,説虛擬機器設定中的兩個連線選項(已連線和啓動時連線)沒有選擇也會報同樣的錯,但是我的已經連線,問題依然存在,到底是因為什麼呢?再次查詢方法。
結果這次認真看了日誌報錯後發現是説 eth0 這個檔案找不到
1
2
Mar 14 00:36:39 centos7 network: Bringing up interface eth0: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device eth0 does not seem to be present, delaying initialization.
Mar 14 00:36:39 centos7 /etc/sysconfig/network-scripts/ifup-eth: Device eth0 does not seem to be present, delaying initialization.
原來是之前做優化的時候將 7 的網絡卡名改成了 eth0(眾所周知 7 的網絡卡名是 eno 後面隨機 一串數字),生成選單時沒有生效,那麼在此生效一下
注意網絡卡配置名是已經修改成 eth0 以後執行下面操作,一共修改的地方有三處,第一處網絡卡名:/etc/sysconfig/network-scripts/ifcfg-eth0 ,第二處配置檔案裏面:NAME=eth0 ,第三處也是配置檔案裏面:DEVICE=eth0
修改/etc/sysconfig/grub,新增 net.ifnames=0 biosdevname=0
1
2
3
4
5
6
7
8
9
[root@centos7 ~]# cat /etc/sysconfig/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=”console”
GRUB_CMDLINE_LINUX=”crashkernel=128M rd.lvm.lv=centos/root rhgb quiet net.ifnames=0 biosdevname=0″
GRUB_DISABLE_RECOVERY=”true”
[root@centos7 ~]#
生成選單
1
2
3
4
5
6
7
8
[root@centos7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-8058723e5e754d3aabc51842d9108e3b
Found initrd image: /boot/initramfs-0-rescue-8058723e5e754d3aabc51842d9108e3b.img
done
[root@centos7 ~]#
最後 reboot 重啓
最後登入後正常
本文出自 “11853547” 博客網站,請務必保留此出處 http://11863547.blog.51cto.com/11853547/1905929