27

I Can't start CentOS 7 "network" service after disabling and removing "NetworkManager" service. When I check the network service status, it comes up with the following error:

#systemctl status network.service
network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network)
   Active: failed (Result: exit-code) since Fri 2015-01-16 22:30:46 GMT; 38s ago
  Process: 4857 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain network[4857]: RTNETLINK answers: File exists
Jan 16 22:30:46 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Jan 16 22:30:46 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Jan 16 22:30:46 localhost.localdomain systemd[1]: Unit network.service entered failed state.

In earlier CenOS it didn't seem to give any problems when switching from the "NetworkManager" service to the network service. Any ideas as to what causes the problem and how to fix it?

Note: I used yum erase to remove network manage service.

Here is additional info as asked:

/etc/sysconfig/network-script/ifcfg-enp8s0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp8s0
UUID=453a07fe-1b07-4f29-bc32-f2168e50706a
ONBOOT=yes
HWADDR=XXXXXXXXXXX
MACADDR=XXXXXXXXXX
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

/etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

/etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search customer.marples.midcity.lan
nameserver 10.241.128.1
Gazel
  • 293
  • 1
  • 4
  • 9
  • Since I cannot post a comment because of my low reputation, I'm posting this as an answer, which it is NOT intended to be.

    Can you post the following:

    `/etc/sysconfig/network-script/ifcfg-eth0`
    `/etc/hosts`
    `/etc/resolv.conf`

    You might want to check your configured routes for that specific NIC (found in `/etc/sysconfig/network-scripts/route-`), since this might cause similar errors.

    Did you try `ifdown eth0` and `ifup eth0` instead of `systemctl (re)start network`? Did you disable/uninstall `Network Manager` using `yum remove`
    – Mosh Pit Jan 16 '15 at 23:49
  • Hi, thanks for resupplying. I've updated my question info above, have a look. Yes I did used yum erase to remove the NetworkManager service. I have not tried the ifdown eth0 and ifup eth0, hoever My network connection is still up and running despite removing the networkmanager service and inability to start the network service. – Gazel Jan 17 '15 at 00:49
  • You have `HWADDR=XXXXXXXXXXX` **AND** `MACADDR=XXXXXXXXXX` in your interface config. This seems to be wrong, since it looks like it's intended to be the same. Try one of the things I recommended (commenting this part in your config), restart and try again. Is this CentOS 7 box SELinux enforcing? Are you running this system on a hardware or in a virtual environment? `hosts` and `resolv.conf` look good so far. – Mosh Pit Jan 17 '15 at 00:51
  • Originally I spoofed the MAC in the NetworkManager's GUI, so it added the fake MACADDR in addition to the real HWADDR, so that's why it's there. Should i remove the MACADDR line? The SELinux status reads enabled. Im running it on a hardware. – Gazel Jan 17 '15 at 00:54
  • Try commenting `HWADDR` and/or `MACADDR`, tho I think taking out `MACADDR` should be sufficient. Restart the whole box and look if network is coming up properly. Also, if you don't use `IPv6`, take that crap out there. You could also check your HWADDR by using `cat /sys/class/net/ens192/address` to make sure it's setup properly. – Mosh Pit Jan 17 '15 at 01:08
  • I've commented out all IPV6 lined and both MAC lines, rebooted the box, no luck so far, still fails to start the service. Oh, and I did use yum erase to remove network manager service. – Gazel Jan 17 '15 at 01:21
  • Try just commenting `MACADDR`, leave `HWADDR` as it is, but check it first with `cat /sys/class/net//address`. Did you install `net-tools`? – Mosh Pit Jan 17 '15 at 01:41
  • /sys/class/net/enp8s0/address contains the spoofed MACADDR, and it's read only file. Also commenting out MACADDR didn't fix the prolem. – Gazel Jan 17 '15 at 02:05
  • I've just read about yum erase vs purge and I thing I should have used purge, as it does not leave any service config files, as opposed to erase. I think I'll give it a go, install back and then yum purge the NetworkManager service. – Gazel Jan 17 '15 at 02:14
  • Sounds worth a try. Report back when you're done. – Mosh Pit Jan 17 '15 at 02:31
  • Did you get it up and running now? If so, I'm curious what the problem was in the end and how you figured it out! – Mosh Pit Jan 22 '15 at 15:29
  • I didn't have much time to play with Centos 7 so I just went back to 6, and that is a fix for now. – Gazel Jan 23 '15 at 00:55

11 Answers11

36

In Centos7.0 disabling NetworkManager will leave a dhcp client running configured for NetworkManager. This causes the error message RTNETLINK answers: File exists when the network service is started.

The stale dhclient process has the additional "benefit" that when the lease expires your dhclient will choke, since it cannot reach NetWorkManager, thus removing your IP address.

If you grep for it, you will see that it points to a NetWorkManager configuration file.

[root@host ~]# ps -ef | grep dhc
root      1865   792  0 Apr28 ?        00:00:00 /sbin/dhclient -d -sf \
 /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-eno1.pid -lf\
 /var/lib/NetworkManager/dhclient-c96e56d3-a4c9-4a87-85ca-93dc0ca268f2-eno1.lease\
 -cf /var/lib/NetworkManager/dhclient-eno1.conf eno1

So what you can do is kill the dhclient and only then start your network service.

chicks
  • 3,639
  • 10
  • 26
  • 36
Hans Then
  • 536
  • 4
  • 7
  • Yup, killing dhclient fixed the issue for me. Thanks – MichaelZ Nov 04 '15 at 14:41
  • 7
    I also don't have enough reputation to comment, but I wanted to support Hans's answer and add that I had to change the bootproto to "none" in my ifcfg files. The dhclient was only getting called when trying to restart networking, and killing the dhclient process didn't help, because another would spawn in it's place. Modifying the ifcfg files solved my problem. – onlyanegg Nov 25 '15 at 00:37
9

An IP conflict will also cause this error. Try: systemctl stop network, then ifup eth0.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
spoovy
  • 334
  • 4
  • 14
3

I too faced this today on a CentOS 7.2 cloned virtual machine. This is how I fixed it.

systemctl disable NetworkManager
systemctl enable network

Find MAC address of the interface through command /sbin/ifconfig -a and append that in /etc/sysconfig/network-scripts/ifcfg-<interface_name>. You can use the below commands for the first interface.

nic_file=`ls /etc/sysconfig/network-scripts/ifcfg-e*`
ifconfig -a | grep ether | awk '{ print $2 }' | sed 's/.*/HWADDR=&/' >> ${nic_file}

Then fire reboot to restart the server

vikas027
  • 1,149
  • 2
  • 11
  • 14
2

as it has been already identified - this error pops up with any issue while setting up network: IP conflict, routing issues, etc.

Look at your gateway settings to confirm your gateways are set properly and things are what they need to be with /etc/syscofig/network and each of the /etc/sysconfig/network-scripts/ifcfg-* look for duplicate IP, routes set via /etc/sysconfig/network-scripts/route-* if memory serves me right gateways now can be set in both ifcfg-* and route-* files. So confirm there's no duplication or overlap.

Droopy4096
  • 670
  • 3
  • 7
2

It seems this happens also if you manually configure an interface that isn't connected to the network.

aryeh
  • 151
  • 3
1

A failure to get an IP from DNS will also give this error as I have just found. In fact it looks like any error with networking will cause this error. This appears to be a problem with CentOS 7 in that it gives a very poor error here.

MikeKulls
  • 285
  • 1
  • 2
  • 13
0

Look into network-scripts whether there is no other interface that could crash network.service

do an ifconfig and write down the interface. Compare with the files in network-scripts. If there are more files in network-scripts than interfaces in ifconfig, you can delete the additional useless files and then do a systemctl restart network.

0

Had this error after cloning a virtual server, the clone was given a new hardware address ( MAC ) and the network adapter config still had the old one.

The line looks like: HWADDR=00:00:00:00:00:00

WhoIsRich
  • 381
  • 3
  • 6
0

I ran into this issue, where the server keep giving me RTNETLINK answers: File exists even after removing network manager and triple check all my network configuration.

It appears that an IP was up on another server and that the server filter ICMP (so no ping), first things I tried. So don't rely on ping for testing if an IP is up or not !

When starting, the network script issue this command (change your dev and ip)

/sbin/arping -c 2 -w 3 -D -I eth0 10.196.132.206

Which tell us that a mac address is associated with this IP and fail the network script (ifup or systemctl start network)

Alban M
  • 1
  • 2
0

I also encountered similar problems. To modify the configuration files.(ifcfg-ensxxxx), as follows enter image description here

  • List Commented out "UUID=xxxx-xxxx"
  • Add new option: NM_CONTROLLED=no, it indicates that this interface will be set up using this configuration file, instead of being managed by Network Manager service.

Reference: How to configure a static IP address on CentOS 7

drookie
  • 8,051
  • 1
  • 17
  • 27
-1

I also encountered similar problems. To modify the configuration files.(ifcfg-ensxxxx), as follows:

Add new option: NM_CONTROLLED=no, it indicates that this interface will be set up using this configuration file, instead of being managed by Network Manager service.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296