Ubuntu – Failed to start raise network interface on Ubuntu 16.04

dnsmountnetwork-managernetworkingserver

All of sudden I am getting failed to start raise network interface error messages in Ubuntu. Any feedback will be great help.

I tried the following steps but still the problem exists:

root@storage:~# systemctl stop network
Failed to stop network.service: Unit network.service not loaded.

root@storage:~# systemctl disable network
Failed to execute operation: No such file or directory

root@storage:~# /etc/init.d/networking restart
[....] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.
 failed!

root@storage:~# ping 192.168.0.227
PING 192.168.0.227 (192.168.0.227) 56(84) bytes of data.
64 bytes from 192.168.0.227: icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from 192.168.0.227: icmp_seq=2 ttl=64 time=0.059 ms
64 bytes from 192.168.0.227: icmp_seq=3 ttl=64 time=0.054 ms
^C
--- 192.168.0.227 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.022/0.045/0.059/0.016 ms
root@storage:~# 

root@storage:/home/bsaitechnosales# systemctl status networking.service
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/generator/networking.service.d
└─50-insserv.conf-$network.conf
Active: failed (Result: exit-code) since Thu 2018-01-11 12:50:20 +0545; 10min ago
Docs: man:interfaces(5)
Process: 15534 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 15529 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm
Main PID: 15534 (code=exited, status=1/FAILURE)

Jan 11 12:50:20 storage ifup[15534]: Failed to bring up lo.
Jan 11 12:50:20 storage ifup[15534]: RTNETLINK answers: File exists
**Jan 11 12:50:20 storage ifup[15534]: Failed to bring up enp1s0.**
Jan 11 12:50:20 storage ifup[15534]: run-parts: failed to exec /etc/network/if-up.d/iptables: Exec format error
Jan 11 12:50:20 storage ifup[15534]: run-parts: /etc/network/if-up.d/iptables exited with return code 1
Jan 11 12:50:20 storage systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Jan 11 12:50:20 storage ifup[15534]: /sbin/ifup: post-up script failed.
Jan 11 12:50:20 storage systemd[1]: Failed to start Raise network interfaces.
Jan 11 12:50:20 storage systemd[1]: networking.service: Unit entered failed state.
Jan 11 12:50:20 storage systemd[1]: networking.service: Failed with result 'exit-code'.

Best Answer

Maybe a bit late, but I had the same issue, but then with ip6tables that gave an error :

$ sudo ifup ens160
run-parts: failed to exec /etc/network/if-pre-up.d/ip6tables: Exec format error
run-parts: /etc/network/if-pre-up.d/ip6tables exited with return code 1
Failed to bring up ens160.

My /etc/network/if-pre-up.d/ip6tables looked like this:

ip6tables-restore < /etc/ip6tables.conf

I solved the issue by adding a shebang on top of the script to make it look like this:

#!/bin/sh
ip6tables-restore < /etc/ip6tables.conf

Now my interface is willing to come up. I hope this solution might help you (and others that stumble across this post).

Related Question