Centos

為什麼 systemd network.service 抱怨“無法載入文件’/etc/sysconfig/network-scripts/ifcfg-lo’”

  • October 3, 2016

我有幾個使用 Kickstart 安裝的全新 CentOS 7 系統。

當我重新啟動網路時,我注意到奇怪的錯誤,上面寫著“ Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'”。這個錯誤實際上沒有意義,因為 ifcfg-lo 文件存在,而且對我來說看起來很正常。系統似乎執行正常,為什麼網路服務抱怨?

[root@host3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-lo 
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
[root@host3 ~]#


[root@host3 ~]# systemctl restart network
[root@host3 ~]# journalctl -xe -u network.service
...
-- Subject: Unit network.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit network.service has begun starting up.
Sep 30 15:02:56 host3.example.org network[36432]: Bringing up loopback interface:  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 30 15:02:56 host3.example.org network[36432]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 30 15:02:56 host3.example.org network[36432]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 30 15:02:56 host3.example.org network[36432]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 30 15:02:56 host3.example.org network[36432]: [  OK  ]
Sep 30 15:02:56 host3.example.org network[36432]: Bringing up interface eth0:  Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
Sep 30 15:02:56 host3.example.org network[36432]: [  OK  ]
Sep 30 15:02:56 host3.example.org systemd[1]: Started LSB: Bring up/down networking.
-- Subject: Unit network.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit network.service has finished starting up.
-- 
-- The start-up result is done.
[root@host3 ~]#

更新回复@SmallLoanOf1M 的問題。實際設備似乎在啟動後啟動並執行。據我所知,“未知”欄位似乎很正常。

[root@host3 ~]# ip addr show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
   inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
   inet6 ::1/128 scope host 
      valid_lft forever preferred_lft forever
[root@host3 ~]#

Red Hat 目前正在將此作為一個錯誤進行跟踪,請參閱此知識文章

修復:添加NM_CONTROLLED=no/etc/sysconfig/network-scripts/ifcfg-lo.

根本原因:NetworkManager 中的 ifcfg-rh 外掛不支持環回介面類型,並在系統日誌中記錄有關它的消息。

引用自:https://serverfault.com/questions/806446