In this article, I will explain you about the possible reasons for "Failed to restart network service: Unit network service not found" error and will also show you all the possible solutions that can be done to solve this issue. As you might be aware this error is very frequent whenever you change some network configuration and then try to restart the service. Ideally, this error could occur due to multiple reasons like incorrect network configuration file, network interface not responding etc.
Failed to restart network.service: Unit network.service not found in RHEL 7/8
You might be aware of using service network restart
command to restart your network service after performing any change in the network configuration file.
[root@localhost ~]# service network restart Restarting network (via systemctl): [ OK ]
In Recent RHEL/CentOS based Systems, you might be aware of using systemctl
command to restart your network service.
[root@localhost ~]# systemctl restart network
If you now try to check the Network service status by using systemctl status network -l
command, you can see that service is up and running fine.
[root@localhost ~]# systemctl status network -l ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: active (exited) since Thu 2020-06-11 19:43:30 EDT; 13s ago Docs: man:systemd-sysv-generator(8) Process: 27215 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 27374 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Jun 11 19:43:30 localhost.localdomain systemd[1]: Stopped LSB: Bring up/down networking. Jun 11 19:43:30 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking... Jun 11 19:43:30 localhost.localdomain network[27374]: Bringing up loopback interface: [ OK ] Jun 11 19:43:30 localhost.localdomain network[27374]: Bringing up interface enp0s3: Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8) Jun 11 19:43:30 localhost.localdomain network[27374]: [ OK ] Jun 11 19:43:30 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.
But sometimes it might happen that when you try to restart your network service then you end up with error "Failed to restart network.service: Unit network.service not found"
.
How to fix “Failed to restart network.service: Unit network.service not found” in RHEL 7
You might have seen Failed to restart network.service: Unit network.service not found error in RHEL 7 based systems due to some network configuration or network interface issues. To resolve this error, first you need to check the network interface status. In this example my network interface is enp0s3 so we need to run ifconfig enp0s3
command to check the status of interface enp0s3.
[root@localhost ~]# ifconfig enp0s3 enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.103 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::a00:27ff:fe1d:8e54 prefixlen 64 scopeid 0x20<link> ether 08:00:27:1d:8e:54 txqueuelen 1000 (Ethernet) RX packets 105385 bytes 129825301 (123.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 28452 bytes 4965590 (4.7 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
NOTE:
enp0s3
. You might have different interface name like eth0
, eth1
etc. You can replace the interface name accordingly while running ifconfig
and other relevant commands as discussed in the below sections.Now you can bring down the interface using ifdown enp0s3 and bring up again using ifup enp0s3 command as shown below.
[root@localhost ~]# ifdown enp0s3 [root@localhost ~]# ifup enp0s3
Next you can restart the network and check if the network is active or not.
[root@localhost ~]# systemctl restart network [root@localhost ~]# systemctl is-active network active
Now if you check the network status you can see that network service is up and running.
[root@localhost ~]# systemctl status network ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; generated) Active: active (exited) since Fri 2020-06-12 07:01:58 EDT; 23min ago Docs: man:systemd-sysv-generator(8) Process: 1068 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Jun 11 19:43:30 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking... Jun 11 19:43:30 localhost.localdomain network[1068]: WARN : [network] You are using 'network' service provided by 'network-scripts', which are now deprecated. Jun 11 19:43:30 localhost.localdomain network[1089]: You are using 'network' service provided by 'network-scripts', which are now deprecated. Jun 11 19:43:30 localhost.localdomain network[1068]: WARN : [network] 'network-scripts' will be removed in one of the next major releases of RHEL. Jun 11 19:43:30 localhost.localdomain network[1090]: 'network-scripts' will be removed in one of the next major releases of RHEL. Jun 11 19:43:30 localhost.localdomain network[1068]: WARN : [network] It is advised to switch to 'NetworkManager' instead for network management. Jun 11 19:43:30 localhost.localdomain network[1091]: It is advised to switch to 'NetworkManager' instead for network management. Jun 11 19:43:30 localhost.localdomain network[1068]: Bringing up loopback interface: [ OK ] Jun 11 19:43:30 localhost.localdomain network[1068]: Bringing up interface enp0s3: [ OK ] Jun 11 19:43:30 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.
How to fix “Failed to restart network.service: Unit network.service not found” in RHEL 8
If you are using NM_CONTROLLED=NO
in your network interface configuration file then you won't be able to bring up the interface using ifup command.
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none #IPADDR=172.18.70.39 #NETMASK=255.255.254.0 #GATEWAY=172.18.70.1 #DNS1=172.18.70.1 #DNS2=8.8.8.8 DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=no IPV6_DEFROUTE=no IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp0s3 UUID=5f643886-9a8a-4d2e-b3b8-a5193bf08077 DEVICE=enp0s3 ONBOOT=yes NM_CONTROLLED=NO
You need to install network-scripts
package using dnf install network-scripts
command as shown below. Since it is already installed in my system so it will show that the package is already installed.
[root@localhost ~]# dnf install network-scripts CentOS-8 - AppStream 11 kB/s | 4.3 kB 00:00 CentOS-8 - Base 9.2 kB/s | 3.9 kB 00:00 CentOS-8 - Extras 2.0 kB/s | 1.5 kB 00:00 Extra Packages for Enterprise Linux Modular 8 - x86_64 4.5 kB/s | 7.8 kB 00:01 Extra Packages for Enterprise Linux 8 - x86_64 2.9 kB/s | 5.5 kB 00:01 Extra Packages for Enterprise Linux 8 - x86_64 670 kB/s | 6.9 MB 00:10 Google Cloud SDK 210 B/s | 454 B 00:02 Google Cloud SDK 2.9 MB/s | 37 MB 00:12 Package network-scripts-10.00.4-1.el8.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete!
Now you can check from RPM DB if network service is available in the network-scripts package list using rpm -ql network-scripts | grep "/etc/init.d/network"
command as shown below.
[root@localhost ~]# rpm -ql network-scripts | grep "/etc/rc.d/init.d/network" /etc/rc.d/init.d/network
Once it is confirmed that network service is available you can ifup enp0s3
command to bring up the interface.
[root@localhost ~]# ifup enp0s3 WARN : [ifup] You are using 'ifup' script provided by 'network-scripts', which are now deprecated. WARN : [ifup] 'network-scripts' will be removed in one of the next major releases of RHEL. WARN : [ifup] It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well.
Also you need to restart your service either using service network restart
or systemctl restart network
command as shown below. Once service is restarted you can check the status by running systemctl is-active network
command.
[root@localhost ~]# systemctl restart network [root@localhost ~]# systemctl is-active network active
Now if you check the network status then you can see that network service is up and running. You can check the status by running systemctl status network
command as shown below.
[root@localhost ~]# systemctl status network ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; generated) Active: active (exited) since Fri 2020-06-12 07:01:58 EDT; 23min ago Docs: man:systemd-sysv-generator(8) Process: 1068 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Jun 11 19:43:30 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking... Jun 11 19:43:30 localhost.localdomain network[1068]: WARN : [network] You are using 'network' service provided by 'network-scripts', which are now deprecated. Jun 11 19:43:30 localhost.localdomain network[1089]: You are using 'network' service provided by 'network-scripts', which are now deprecated. Jun 11 19:43:30 localhost.localdomain network[1068]: WARN : [network] 'network-scripts' will be removed in one of the next major releases of RHEL. Jun 11 19:43:30 localhost.localdomain network[1090]: 'network-scripts' will be removed in one of the next major releases of RHEL. Jun 11 19:43:30 localhost.localdomain network[1068]: WARN : [network] It is advised to switch to 'NetworkManager' instead for network management. Jun 11 19:43:30 localhost.localdomain network[1091]: It is advised to switch to 'NetworkManager' instead for network management. Jun 11 19:43:30 localhost.localdomain network[1068]: Bringing up loopback interface: [ OK ] Jun 11 19:43:30 localhost.localdomain network[1068]: Bringing up interface enp0s3: [ OK ] Jun 11 19:43:30 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.
Hopefully, this article has helped you in solving "Failed to restart network service: Unit network service not found" error. Please let me know your feedback on the comment box.
Popular Recommendations:-
How to Compare Strings in Python
How to Enable or Disable SELinux Temporarily or Permanently on RedHat/CentOS 7/8
10 Popular Examples of sudo command in Linux(RedHat/CentOS 7/8)
9 useful w command in Linux with Examples
12 Most Popular rm command in Linux with Examples
Failed to restart network.service: Unit network.service not found in RHEL 8
Solved: Failed to restart network.service: Unit network.service not found in RHEL 8
Solved: Failed to restart network.service: Unit network.service not found in RHEL 8
Thank you so much
it works with RHEL 8
it really helps
thank you so much