[CentOS7]Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' を抑制する


# 前提
以下環境で調べた

|環境|/etc/redhat-release|$  rpm -qf /etc/sysconfig/network-scripts/if{down,up}|補足|
|:--|:--|:--|:--|
|KVMGuest|CentOS Linux release 7.1.1503 (Core)|initscripts-9.49.24-1.el7.x86_64|-|
|Vagrant|CentOS Linux release 7.1.1503 (Core)|initscripts-9.49.24-1.el7.x86_64|https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box|
|実機|CentOS Linux release 7.1.1503 (Core)|initscripts-9.49.24-1.el7.x86_64|-|

# Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'

```c:/var/log/messages
Oct  7 15:10:15 hostname NetworkManager[657]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct  7 15:10:15 hostname network: Bringing up loopback interface:  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct  7 15:10:15 hostname ntpd_intres[584]: host name not found: ntp.nict.jp
Oct  7 15:10:15 hostname NetworkManager[657]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct  7 15:10:15 hostname network: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct  7 15:10:16 hostname NetworkManager[657]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct  7 15:10:16 hostname network: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct  7 15:10:16 hostname NetworkManager[657]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct  7 15:10:16 hostname network: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct  7 15:10:16 hostname network: [  OK  ]
```

解せぬ

# if{down,up}でエラーメッセージを吐いている

```c:ifdown
# bash -x /etc/sysconfig/network-scripts/ifdown ifcfg-lo
+ unset WINDOW
+ . /etc/init.d/functions
++ TEXTDOMAIN=initscripts
++ umask 022
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' 2351 -ne 1 -a -z '' ']'
++ /bin/mountpoint -q /cgroup/systemd
++ /bin/mountpoint -q /sys/fs/cgroup/systemd
++ case "$0" in
++ '[' -z '' ']'
++ COLUMNS=80
++ '[' -z '' ']'
++ '[' -c /dev/stderr -a -r /dev/stderr ']'
+++ /sbin/consoletype
++ CONSOLETYPE=pty
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/i18n -o -f /etc/locale.conf ']'
++ . /etc/profile.d/lang.sh
++ unset LANGSH_SOURCED
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/init ']'
++ . /etc/sysconfig/init
+++ BOOTUP=color
+++ RES_COL=60
+++ MOVE_TO_COL='echo -en \033[60G'
+++ SETCOLOR_SUCCESS='echo -en \033[0;32m'
+++ SETCOLOR_FAILURE='echo -en \033[0;31m'
+++ SETCOLOR_WARNING='echo -en \033[0;33m'
+++ SETCOLOR_NORMAL='echo -en \033[0;39m'
+++ ulimit -n 65536
+++ ulimit -u 32768
+++ ulimit -s 10240
++ '[' pty = serial ']'
++ __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
++ '[' '' = 1 ']'
+ cd /etc/sysconfig/network-scripts
+ . ./network-functions
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' -z '/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' ']'
+ '[' -f ../network ']'
+ . ../network
+ CONFIG=ifcfg-lo
+ '[' -z ifcfg-lo ']'
+ need_config ifcfg-lo
+ local nconfig
+ CONFIG=ifcfg-ifcfg-lo
+ '[' -f ifcfg-ifcfg-lo ']'
+ CONFIG=ifcfg-lo
+ '[' -f ifcfg-lo ']'
+ return
+ '[' -f ifcfg-lo ']'
+ '[' 0 '!=' 0 ']'
+ source_config
+ CONFIG=ifcfg-lo
+ DEVNAME=lo
+ . /etc/sysconfig/network-scripts/ifcfg-lo
++ DEVICE=lo
++ IPADDR=127.0.0.1
++ NETMASK=255.0.0.0
++ NETWORK=127.0.0.0
++ BROADCAST=127.255.255.255
++ ONBOOT=yes
++ NAME=loopback
+ '[' -r keys-lo ']'
+ case "$TYPE" in
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -z lo -a -n '' ']'
+ '[' -z '' ']'
++ echo lo
++ sed 's/[0-9]*$//'
+ DEVICETYPE=lo
+ '[' -z '' -a -n '' ']'
+ '[' -z '' ']'
+ REALDEVICE=lo
+ '[' -z '' ']'
+ SYSCTLDEVICE=lo
+ '[' lo '!=' lo ']'
+ ISALIAS=no
+ is_false
+ case "$1" in
+ return 1
+ is_nm_running
++ LANG=C
++ nmcli -t --fields running general status
+ '[' running = running ']'
+ nmcli con load /etc/sysconfig/network-scripts/ifcfg-lo
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'    #エラー出力
++ get_uuid_by_config ifcfg-lo
++ dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:/etc/sysconfig/network-scripts/ifcfg-lo
++ awk -F '"' '/string / { print $2 }'
+ UUID=
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' '' = true ']'
+ '[' -x /sbin/ifdown-pre-local ']'
+ OTHERSCRIPT=/etc/sysconfig/network-scripts/ifdown-lo
+ '[' '!' -x /etc/sysconfig/network-scripts/ifdown-lo ']'
+ OTHERSCRIPT=/etc/sysconfig/network-scripts/ifdown-
+ '[' '!' -x /etc/sysconfig/network-scripts/ifdown- ']'
+ OTHERSCRIPT=/etc/sysconfig/network-scripts/ifdown-eth
+ exec /etc/sysconfig/network-scripts/ifdown-eth ifcfg-lo
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'   #エラー出力
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'   #エラー出力
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'   #エラー出力
```

# 既知のバグっぽい

[0007351: Service network failes to start](https://bugs.centos.org/view.php?id=7351)
[0007473: Network connection is failing during boot](https://bugs.centos.org/view.php?id=7473)

# 以下追記修正を行うとエラーが消える

```c:command
 # cat >> /etc/sysconfig/network-scripts/ifcfg-lo <<'EOF'
> TYPE=loopback
> EOF
```

```c:command
# bash -x /etc/sysconfig/network-scripts/ifdown ifcfg-lo
+ unset WINDOW
+ . /etc/init.d/functions
++ TEXTDOMAIN=initscripts
++ umask 022
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' 2351 -ne 1 -a -z '' ']'
++ /bin/mountpoint -q /cgroup/systemd
++ /bin/mountpoint -q /sys/fs/cgroup/systemd
++ case "$0" in
++ '[' -z '' ']'
++ COLUMNS=80
++ '[' -z '' ']'
++ '[' -c /dev/stderr -a -r /dev/stderr ']'
+++ /sbin/consoletype
++ CONSOLETYPE=pty
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/i18n -o -f /etc/locale.conf ']'
++ . /etc/profile.d/lang.sh
++ unset LANGSH_SOURCED
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/init ']'
++ . /etc/sysconfig/init
+++ BOOTUP=color
+++ RES_COL=60
+++ MOVE_TO_COL='echo -en \033[60G'
+++ SETCOLOR_SUCCESS='echo -en \033[0;32m'
+++ SETCOLOR_FAILURE='echo -en \033[0;31m'
+++ SETCOLOR_WARNING='echo -en \033[0;33m'
+++ SETCOLOR_NORMAL='echo -en \033[0;39m'
+++ ulimit -n 65536
+++ ulimit -u 32768
+++ ulimit -s 10240
++ '[' pty = serial ']'
++ __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
++ '[' '' = 1 ']'
+ cd /etc/sysconfig/network-scripts
+ . ./network-functions
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' -z '/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' ']'
+ '[' -f ../network ']'
+ . ../network
+ CONFIG=ifcfg-lo
+ '[' -z ifcfg-lo ']'
+ need_config ifcfg-lo
+ local nconfig
+ CONFIG=ifcfg-ifcfg-lo
+ '[' -f ifcfg-ifcfg-lo ']'
+ CONFIG=ifcfg-lo
+ '[' -f ifcfg-lo ']'
+ return
+ '[' -f ifcfg-lo ']'
+ '[' 0 '!=' 0 ']'
+ source_config
+ CONFIG=ifcfg-lo
+ DEVNAME=lo
+ . /etc/sysconfig/network-scripts/ifcfg-lo
++ DEVICE=lo
++ IPADDR=127.0.0.1
++ NETMASK=255.0.0.0
++ NETWORK=127.0.0.0
++ BROADCAST=127.255.255.255
++ ONBOOT=yes
++ NAME=loopback
++ TYPE=loopback
+ '[' -r keys-lo ']'
+ case "$TYPE" in
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -z lo -a -n '' ']'
+ '[' -z '' ']'
++ echo lo
++ sed 's/[0-9]*$//'
+ DEVICETYPE=lo
+ '[' -z '' -a -n '' ']'
+ '[' -z '' ']'
+ REALDEVICE=lo
+ '[' -z '' ']'
+ SYSCTLDEVICE=lo
+ '[' lo '!=' lo ']'
+ ISALIAS=no
+ is_false
+ case "$1" in
+ return 1
+ is_nm_running
++ LANG=C
++ nmcli -t --fields running general status
+ '[' running = running ']'
+ nmcli con load /etc/sysconfig/network-scripts/ifcfg-lo
++ get_uuid_by_config ifcfg-lo
++ dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:/etc/sysconfig/network-scripts/ifcfg-lo
++ awk -F '"' '/string / { print $2 }'
+ UUID=
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' '' = true ']'
+ '[' -x /sbin/ifdown-pre-local ']'
+ OTHERSCRIPT=/etc/sysconfig/network-scripts/ifdown-lo
+ '[' '!' -x /etc/sysconfig/network-scripts/ifdown-lo ']'
+ OTHERSCRIPT=/etc/sysconfig/network-scripts/ifdown-loopback
+ '[' '!' -x /etc/sysconfig/network-scripts/ifdown-loopback ']'
+ OTHERSCRIPT=/etc/sysconfig/network-scripts/ifdown-eth
+ exec /etc/sysconfig/network-scripts/ifdown-eth ifcfg-lo
# エラー出力なし
```

# ただ起動時に以下warnログが残るのが気になる

```c:/var/log/messages
Oct  7 18:10:39 hostname NetworkManager[654]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct  7 18:10:39 hostname NetworkManager[654]: <info>      read connection 'loopback'
Oct  7 18:10:39 hostname NetworkManager[654]: <warn>      Ignoring connection 'loopback' of unrecognized type.
```