某一日,用systemctl --failed查看到如下錯誤信息,但實際上網絡是OK的,真奇怪:
1
2
3
4
5
6
7
8
|
[root@localhost.localdomain media]
# systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
network.service loaded failed failed LSB: Bring up
/down
networking
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit
type
.
1 loaded
units
listed. Pass --all to see loaded but inactive
units
, too.
To show all installed unit files use
'systemctl list-unit-files'
.
|
執行此命令來解決這個問題:
1
|
[root@F1A-SWPE ~]
# systemctl enable NetworkManager-wait-online.service
|
重啟后再次用systemctl --failed查看,問題消失:
1
2
3
|
[root@localhost.localdomain ~]
# systemctl --failed
0 loaded
units
listed. Pass --all to see loaded but inactive
units
, too.
To show all installed unit files use
'systemctl list-unit-files'
.
|
解決問題的關鍵跟/usr/lib/systemd/system/NetworkManager-wait-online.service這個文檔有關,其內容如下:
[Unit]
Description=Network Manager Wait Online
Requisite=NetworkManager.service
After=NetworkManager.service
Wants=network.target
Before=network.target network-online.target
[Service]
Type=oneshot
ExecStart=/usr/bin/nm-online -q --timeout=30
[Install]
WantedBy=multi-user.target
有興趣的同學不妨研究一下這個文檔就能明了!!
最后sudo service network restart 解決