10

I've noticed that every time I turn on my PC, there is a line in red. My PC is pretty fast so I don't get to read the problem. I haven't experienced or noticed any problem with my system, but I'm curious.

I've run systemctl --failed and I get the following output.

UNIT               LOAD   ACTIVE SUB    DESCRIPTION                                  
● networking.service loaded failed failed Raise network interfaces                     

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

systemctl status networking.service then outputs the following.

networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled
   Active: failed (Result: exit-code) since Sun 2019-07-14 20:59:05 AWST; 4min 27s ago
     Docs: man:interfaces(5)
  Process: 799 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE
 Main PID: 799 (code=exited, status=1/FAILURE)</code></pre><pre><code>sudo journalctl _SYSTEMD_UNIT=networking.service</pre><code><pre><code>
-- Logs begin at Sun 2019-07-14 20:59:03 AWST, end at Sun 2019-07-14 21:06:14 AWST. --
Jul 14 20:59:05 debian dhclient[863]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 20:59:05 debian dhclient[863]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 20:59:05 debian ifup[799]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 20:59:05 debian ifup[799]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 20:59:05 debian ifup[799]: All rights reserved.
Jul 14 20:59:05 debian ifup[799]: For info, please visit https://www.isc.org/software/dh
Jul 14 20:59:05 debian dhclient[863]: All rights reserved.
Jul 14 20:59:05 debian dhclient[863]: For info, please visit https://www.isc.org/softwar
Jul 14 20:59:05 debian dhclient[863]: 
Jul 14 20:59:05 debian ifup[799]: Cannot find device "eth0"
Jul 14 20:59:05 debian dhclient[863]: Failed to get interface index: No such device
Jul 14 20:59:05 debian ifup[799]: Failed to get interface index: No such device
Jul 14 20:59:05 debian ifup[799]: If you think you have received this message due to a b
Jul 14 20:59:05 debian ifup[799]: than a configuration issue please read the section on 
Jul 14 20:59:05 debian ifup[799]: bugs on either our web page at www.isc.org or in the R
Jul 14 20:59:05 debian ifup[799]: before submitting a bug.  These pages explain the prop
Jul 14 20:59:05 debian ifup[799]: process and the information we find helpful for debugg
Jul 14 20:59:05 debian ifup[799]: exiting.
Jul 14 20:59:05 debian dhclient[863]: 
Jul 14 20:59:05 debian dhclient[863]: If you think you have received this message due to
Jul 14 20:59:05 debian dhclient[863]: than a configuration issue please read the section
Jul 14 20:59:05 debian dhclient[863]: bugs on either our web page at www.isc.org or in t
Jul 14 20:59:05 debian dhclient[863]: before submitting a bug.  These pages explain the 
Jul 14 20:59:05 debian dhclient[863]: process and the information we find helpful for de
Jul 14 20:59:05 debian dhclient[863]: 
Jul 14 20:59:05 debian dhclient[863]: exiting.
Jul 14 20:59:05 debian ifup[799]: ifup: failed to bring up eth0</code></pre>

What is happening? Is anything wrong with my system?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
George G.
  • 245
  • 1
  • 2
  • 7
  • Check the log file `/var/log/boot.log`. You should find all the boot-time messages in there. The output of `systemctl list-unit-files` should be much longer than that: note that `systemctl` will automatically pipe its output through `less` if you aren't redirecting the output anywhere else. The outputs of `systemctl status networking.service` and `journalctl _SYSTEMD_UNIT=networking.service` might be more useful in troubleshooting your problem. – telcoM Jul 14 '19 at 12:35
  • Thank you @telcoM. Now I've added more information to the question. You are right about `systemctl list-unit-files` but there is not enough space to add all. – George G. Jul 14 '19 at 13:15

2 Answers2

7

The underlying problem seems to be:

Jul 14 20:59:05 debian ifup[799]: Cannot find device "eth0"

You should run ip link show to verify the names of your network interfaces. Your system might be using the new predictable network interface names, and so if your NIC is built in to the system's motherboard, it might be eno1 instead of the classic eth0. But if the DMI data within the system firmware does not properly declare the NIC as an integrated, it might be something like enp#s# where # represents numbers corresponding to the PCI bus and slot IDs of the NIC.

Since the message comes from ifup, you apparently aren't using NetworkManager, so if the name of the network interface is not eth0, you'd only need to edit the /etc/network/interfaces file and/or any files in directory /etc/network/interfaces.d/ to specify the correct name of the network interface to configure.

If, on the other hand, the ip link show output only lists the loopback interface, like this:

# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

Then the system has failed to automatically load the correct kernel module to drive your NIC. In that case, the output of lspci -nn (or just the line identifying your NIC) would be helpful in identifying the exact make and model of your NIC.

telcoM
  • 87,318
  • 3
  • 112
  • 232
  • What if the only line in `/etc/network/interfaces` is `source-directory /etc/network/interfaces.d` and then in `/etc/network/interfaces.d/setup` two lines shows `auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp` – George G. Jul 14 '19 at 14:11
  • Then also check any files in directory `/etc/network/interfaces.d` for references to `eth0`, and replace them with the actual name of your NIC. – telcoM Jul 14 '19 at 14:12
  • Should i replace `auto eth0 iface eth0 inet dhcp` with `auto nameofactualnameofnic iface nameofactualnameofnic inet dhcp` – George G. Jul 14 '19 at 14:18
  • all seems to have worked but now I am getting another error `NetworkManager-wait-online.service loaded failed failed` – George G. Jul 14 '19 at 15:11
  • Yes, your replacement strategy looks correct. The failure of `NetworkManager-wait-online.service` is expected if NetworkManager is not used. To get rid of the message, you can use `systemctl reset-failed NetworkManager-wait-online.service`, then `systemctl mask NetworkManager-wait-online.service` to stop it from happening again. If you install NetworkManager later, then use `systemctl unmask NetworkManager-wait-online.service` to allow that service to run again. – telcoM Jul 14 '19 at 16:08
  • Now I don't get a failure anymore but `a start job is running for Raise network interfaces` takes at least 1 minute and it makes the boot process really slow. Is there anything else I can do? – George G. Jul 15 '19 at 04:59
  • 1
    From your `systemctl status networking.service` output, it looks like something is still trying to find `eth0` and would need to be updated to use the actual name of your NIC. It might be some script in `/etc/network/if-*.d/` directories. I'd suggest running a `grep -r eth0 /etc |less ` and checking all the places it finds. – telcoM Jul 15 '19 at 06:21
3

User telcoM's suggestion of grepping for eth0 helped me resolve this issue when I encountered it. In file /etc/network/interfaces.d/setup, I found two references to eth0 and changed them to enp0s3, which is the Ethernet interface on the system I'm working with (Debian 10.0 running on VirtualBox's Intel PRO/1000 MT Desktop adapter.)

The contents of this file now look like this:

auto lo
iface lo inet loopback

# auto eth0
# auto eth0 inet dhcp
auto enp0s3
iface enp0s3 inet dhcp

Hopefully this will be useful to someone else. Thanks, telcoM!

ichabod
  • 319
  • 1
  • 2
  • 8
  • Sure this fixed the network fail problem but now something else broke and I don't have internet. So reverted the change. – h3dkandi Nov 22 '20 at 01:25
  • This morning I didn't have network connection. Decided to make the change you suggested again. After restarting PC now I have internet. I just dunno what is going on. When I go to settings -> network it says my wired connection is unplugged. So people reading this answer should check for them selves if it works for them or not. – h3dkandi Nov 22 '20 at 13:17
  • 1
    OK so after your fix I needed to do this https://askubuntu.com/q/1115117. To make my connection managed. Edit `/etc/NetworkManager/NetworkManager.conf` and set `managed=true` – h3dkandi Nov 22 '20 at 15:55