Ubuntu – Ethernet DHCP stopped working on Ubuntu 18.04.1 LTS

dhcpethernet

I have a notebook running Ubuntu 18.04.1 LTS for a few months and Ethernet has been working great. Today I just powered on and it fails connecting.

I keep seeing the message Connection Failed: Activation of network connection failed popping-up. Information about the system is displayed below.

ethtool:

sudo ethtool enp3s0f1
Settings for enp3s0f1:
    Supported ports: [ TP MII ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: Symmetric Receive-only
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                         100baseT/Half 100baseT/Full 
    Link partner advertised pause frame use: Symmetric Receive-only
    Link partner advertised auto-negotiation: Yes
    Link partner advertised FEC modes: Not reported
    Speed: 100Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    Supports Wake-on: pumbg
    Wake-on: d
    Current message level: 0x00000033 (51)
                   drv probe ifdown ifup
    Link detected: yes

lshw:

sudo lshw -C network
  *-network                 
       description: Wireless interface
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 14.3
       bus info: pci@0000:00:14.3
       logical name: wlo1
       version: 10
       serial: d4:6d:6d:81:35:08
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-33-generic firmware=34.0.0 ip=192.168.0.109 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:16 memory:a4314000-a4317fff
  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0.1
       bus info: pci@0000:03:00.1
       logical name: enp3s0f1
       version: 12
       serial: 80:fa:5b:58:1f:2d
       size: 100Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8411-2_0.0.1 07/08/13 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
       resources: irq:18 ioport:3000(size=256) memory:a4214000-a4214fff memory:a4210000-a4213fff
  *-network:0
       description: Ethernet interface
       physical id: 1
       logical name: enx00142dfffffe
       serial: 00:14:2d:ff:ff:fe
       capabilities: ethernet physical
       configuration: broadcast=yes driver=rndis_host driverversion=22-Aug-2005 firmware=RNDIS device link=yes multicast=yes
  *-network:1
       description: Ethernet interface
       physical id: 2
       logical name: docker0
       serial: 02:42:dd:36:7d:0e
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=no multicast=yes

If I try to assign static IP, I am unable to ping the gateway. There are several other computers in the network, getting IP addresses assigned via DHCP, and I can ping the gateway from them, as well as access internet.

I had a look at dmesg and there seems to be an issue, but I'm not sure it's related:

[  512.317670] ------------[ cut here ]------------
[  512.317674] NETDEV WATCHDOG: enp3s0f1 (r8169): transmit queue 0 timed out
[  512.317704] WARNING: CPU: 4 PID: 0 at /build/linux-81MBYC/linux-4.15.0/net/sched/sch_generic.c:323 dev_watchdog+0x221/0x230
[  512.317706] Modules linked in: rfcomm ipt_MASQUERADE nf_nat_masquerade_ipv4 nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 xt_addrtype iptable_filter xt_conntrack nf_nat nf_conntrack libcrc32c br_netfilter bridge stp llc overlay aufs ccm cmac bnep binfmt_misc nls_iso8859_1 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic arc4 uvcvideo btusb videobuf2_vmalloc snd_hda_intel btrtl videobuf2_memops snd_hda_codec snd_hda_core videobuf2_v4l2 btbcm wmi_bmof iwlmvm mxm_wmi serio_raw videobuf2_core snd_hwdep btintel input_leds mac80211 snd_pcm videodev intel_rapl media x86_pkg_temp_thermal intel_powerclamp coretemp bluetooth snd_seq_midi snd_seq_midi_event rtsx_pci_ms iwlwifi kvm_intel mei_me snd_rawmidi memstick mei ecdh_generic kvm
[  512.317808]  snd_seq irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel snd_seq_device snd_timer snd aes_x86_64 soundcore crypto_simd glue_helper cfg80211 shpchp wmi intel_pch_thermal cryptd intel_cstate intel_hid intel_rapl_perf acpi_pad sparse_keymap joydev mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid i915 rtsx_pci_sdmmc i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm psmouse r8169 ahci rtsx_pci mii libahci video
[  512.317880] CPU: 4 PID: 0 Comm: swapper/4 Not tainted 4.15.0-33-generic #36-Ubuntu
[  512.317883] Hardware name: Notebook                         N8xEJEK                         /N8xEJEK                         , BIOS 1.05.02RNS1 04/13/2018
[  512.317888] RIP: 0010:dev_watchdog+0x221/0x230
[  512.317891] RSP: 0018:ffff912d2d303e58 EFLAGS: 00010286
[  512.317895] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  512.317897] RDX: 0000000000000007 RSI: 0000000000000092 RDI: ffff912d2d316490
[  512.317900] RBP: ffff912d2d303e88 R08: 0000000000000001 R09: 00000000000003b5
[  512.317902] R10: ffff912d2d303ee0 R11: 0000000000000000 R12: 0000000000000001
[  512.317905] R13: ffff912d2a8ce000 R14: ffff912d2a8ce478 R15: ffff912d1ed06480
[  512.317909] FS:  0000000000000000(0000) GS:ffff912d2d300000(0000) knlGS:0000000000000000
[  512.317912] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  512.317914] CR2: 000055e53468f438 CR3: 000000019be0a002 CR4: 00000000003606e0
[  512.317917] Call Trace:
[  512.317919]  <IRQ>
[  512.317927]  ? dev_deactivate_queue.constprop.33+0x60/0x60
[  512.317935]  call_timer_fn+0x30/0x130
[  512.317942]  run_timer_softirq+0x3fb/0x450
[  512.317947]  ? ktime_get+0x43/0xa0
[  512.317954]  ? lapic_next_deadline+0x26/0x30
[  512.317959]  __do_softirq+0xe4/0x2bb
[  512.317965]  irq_exit+0xb8/0xc0
[  512.317969]  smp_apic_timer_interrupt+0x79/0x130
[  512.317976]  apic_timer_interrupt+0x84/0x90
[  512.317978]  </IRQ>
[  512.317985] RIP: 0010:cpuidle_enter_state+0xa7/0x2f0
[  512.317988] RSP: 0018:ffffb19d4196fe68 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff11
[  512.317992] RAX: ffff912d2d322880 RBX: 000000774883164c RCX: 000000000000001f
[  512.317995] RDX: 000000774883164c RSI: fffffffcf772266b RDI: 0000000000000000
[  512.317997] RBP: ffffb19d4196fea8 R08: 00000000ffffffff R09: 0000000000000020
[  512.318000] R10: ffffb19d4196fe38 R11: 00000000000041dd R12: ffff912d2d32cc48
[  512.318002] R13: 0000000000000002 R14: ffffffffbc171bb8 R15: 0000000000000000
[  512.318010]  ? cpuidle_enter_state+0x97/0x2f0
[  512.318016]  cpuidle_enter+0x17/0x20
[  512.318022]  call_cpuidle+0x23/0x40
[  512.318027]  do_idle+0x18c/0x1f0
[  512.318033]  cpu_startup_entry+0x73/0x80
[  512.318038]  start_secondary+0x1ab/0x200
[  512.318044]  secondary_startup_64+0xa5/0xb0
[  512.318047] Code: 38 00 49 63 4e e8 eb 92 4c 89 ef c6 05 a7 13 d9 00 01 e8 c3 36 fd ff 89 d9 48 89 c2 4c 89 ee 48 c7 c7 e8 7d d9 bb e8 1f d6 80 ff <0f> 0b eb c0 90 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 
[  512.318133] ---[ end trace 756930854e9fb9cc ]---

As an additional information, the Wi-Fi interface is working. The described issue is only affecting Ethernet.

Currently installed kernel version is 4.15.0-33-generic:

uname -a
Linux leo 4.15.0-33-generic #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I have tried booting from 4.15.0-32-generic and 4.15.0-30-generic which are also installed but the issue persists.

Any help debugging this issue is appreciated.

Edit:

I have also tried the mainline kernel 4.18.5-041805-generic downloaded from the Ubuntu archive and installed as described in the MainlineBuilds article, but the issue persists. Everything else worked well.

I have also installed 4.15.0-29-generic and 4.15.0-24-generic using apt (including headers, modules and modules-extra packages) and none of those solved the issue.

Edit 2:

dmesg | grep enp:

dmesg | grep enp
[    1.844976] r8169 0000:03:00.1 enp3s0f1: renamed from eth0
[    6.947489] IPv6: ADDRCONF(NETDEV_UP): enp3s0f1: link is not ready
[    6.998162] r8169 0000:03:00.1 enp3s0f1: link down
[    6.998165] r8169 0000:03:00.1 enp3s0f1: link down
[    6.998237] IPv6: ADDRCONF(NETDEV_UP): enp3s0f1: link is not ready
[    9.088158] r8169 0000:03:00.1 enp3s0f1: link up
[    9.088166] IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0f1: link becomes ready
[  149.998558] NETDEV WATCHDOG: enp3s0f1 (r8169): transmit queue 0 timed out
[  150.025064] r8169 0000:03:00.1 enp3s0f1: link up
[  494.222007] r8169 0000:03:00.1 enp3s0f1: link down
[  496.328283] r8169 0000:03:00.1 enp3s0f1: link up
[  551.660533] r8169 0000:03:00.1 enp3s0f1: renamed from eth0
[  551.692682] IPv6: ADDRCONF(NETDEV_UP): enp3s0f1: link is not ready
[  551.771981] r8169 0000:03:00.1 enp3s0f1: link down
[  551.772077] IPv6: ADDRCONF(NETDEV_UP): enp3s0f1: link is not ready
[  553.887435] r8169 0000:03:00.1 enp3s0f1: link up
[  553.887463] IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0f1: link becomes ready

Edit 3:

I am able to make the Ethernet work, but with a very specific workaround procedure:

To install r8168-dkms as suggested by @chili555, I would have to disable secure boot in the system BIOS. I never came to install it, but I did disable secure boot and upon reboot the Ethernet network just connected and worked as expected.

I have further rebooted and noticed that the issue persisted, which was when I discovered the following:

  • My BIOS configuration is being kept upon reboot. The Secure Boot feature is disabled, no matter how many times I reboot.
  • If I enter the BIOS configuration, change nothing at all, choose the save and reset option, and wait for the system to boot, Ethernet works.
  • Even with Secure Boot disabled, if I don't do the procedure described in the previous step, Ethernet don't work.
  • This is reproducible booting with regular Ubuntu latest kernel and mainline kernel previously tested (4.15.0-33-generic, 4.18.5-041805-generic).

I have checked early kernel messages using dmesg and the following diverge from success and fail:

When Ethernet works:

...
[    0.000000] efi:  ACPI 2.0=0x7a039000  ACPI=0x7a039000  SMBIOS=0x7a99b000  SMBIOS 3.0=0x7a99a000  ESRT=0x7521af98  MEMATTR=0x7520f018
...
[    0.000000] esrt: Reserving ESRT space from 0x000000007521af98 to 0x000000007521afd0.
...
[    0.000000] BRK [0x3e413f000, 0x3e413ffff] PGTABLE
[    0.000000] BRK [0x3e4140000, 0x3e4140fff] PGTABLE
[    0.000000] BRK [0x3e4141000, 0x3e4141fff] PGTABLE
[    0.000000] BRK [0x3e4142000, 0x3e4142fff] PGTABLE
[    0.000000] BRK [0x3e4143000, 0x3e4143fff] PGTABLE
[    0.000000] BRK [0x3e4144000, 0x3e4144fff] PGTABLE
[    0.000000] BRK [0x3e4145000, 0x3e4145fff] PGTABLE
[    0.000000] BRK [0x3e4146000, 0x3e4146fff] PGTABLE
[    0.000000] BRK [0x3e4147000, 0x3e4147fff] PGTABLE
[    0.000000] BRK [0x3e4148000, 0x3e4148fff] PGTABLE
...
[    0.000000] Memory: 16143384K/16628012K available (12300K kernel code, 2470K rwdata, 4244K rodata, 2408K init, 2416K bss, 484628K reserved, 0K cma-reserved)
...

When Ethernet fails:

...
[    0.000000] efi:  ACPI 2.0=0x7a039000  ACPI=0x7a039000  SMBIOS=0x7a99b000  SMBIOS 3.0=0x7a99a000  ESRT=0x7521cd18  MEMATTR=0x7520f018
...
[    0.000000] esrt: Reserving ESRT space from 0x000000007521cd18 to 0x000000007521cd50.
...
[    0.000000] BRK [0x125d3f000, 0x125d3ffff] PGTABLE
[    0.000000] BRK [0x125d40000, 0x125d40fff] PGTABLE
[    0.000000] BRK [0x125d41000, 0x125d41fff] PGTABLE
[    0.000000] BRK [0x125d42000, 0x125d42fff] PGTABLE
[    0.000000] BRK [0x125d43000, 0x125d43fff] PGTABLE
[    0.000000] BRK [0x125d44000, 0x125d44fff] PGTABLE
[    0.000000] BRK [0x125d45000, 0x125d45fff] PGTABLE
[    0.000000] BRK [0x125d46000, 0x125d46fff] PGTABLE
[    0.000000] BRK [0x125d47000, 0x125d47fff] PGTABLE
[    0.000000] BRK [0x125d48000, 0x125d48fff] PGTABLE
...
[    0.000000] Memory: 16143392K/16628012K available (12300K kernel code, 2470K rwdata, 4244K rodata, 2408K init, 2416K bss, 484620K reserved, 0K cma-reserved)
...

Edit 4:

As requested by @heynnema following is the output of dkms status (the output is the same when executing with sudo):

dkms status
Error! Could not locate dkms.conf file.
File:  does not exist.

The output of sudo lshw -c network is already provided above and has not changed since the question was originally posted.

Edit 5:

Output from ls -al /var/lib/dkms

leonardo@leo:~$ ls -al /var/lib/dkms
total 16
drwxr-xr-x  3 root root 4096 set  3 14:16 .
drwxr-xr-x 78 root root 4096 ago 21 08:45 ..
-rw-r--r--  1 root root    6 ago 31  2016 dkms_dbversion
drwxr-xr-x  3 root root 4096 jun 18 09:50 nvidia

Output from ls -al /var/lib/dkms/nvidia

leonardo@leo:~$ ls -al /var/lib/dkms/nvidia/
total 12
drwxr-xr-x 3 root root 4096 jun 18 09:50 .
drwxr-xr-x 3 root root 4096 set  3 14:16 ..
drwxr-xr-x 4 root root 4096 jun 18 08:36 390.67
lrwxrwxrwx 1 root root   31 jun 18 08:36 kernel-4.13.0-45-generic-x86_64 -> 390.67/4.13.0-45-generic/x86_64

p.s. I'm currently using Nouveau open-source driver instead of this nvidia-driver-390.

Output of ls -al /usr/src:

leonardo@leo:~$ ls -al /usr/src
total 64
drwxr-xr-x 16 root root 4096 set  4 06:59 .
drwxr-xr-x 13 root root 4096 jun 18 12:06 ..
drwxr-xr-x 24 root root 4096 set  3 16:37 linux-headers-4.14.67-041467
drwxr-xr-x  8 root root 4096 set  3 16:38 linux-headers-4.14.67-041467-generic
drwxr-xr-x  8 root root 4096 set  3 16:39 linux-headers-4.14.67-041467-lowlatency
drwxr-xr-x 27 root root 4096 set  3 11:27 linux-headers-4.15.0-24
drwxr-xr-x  8 root root 4096 set  3 11:27 linux-headers-4.15.0-24-generic
drwxr-xr-x 27 root root 4096 set  3 11:05 linux-headers-4.15.0-29
drwxr-xr-x  8 root root 4096 set  3 11:05 linux-headers-4.15.0-29-generic
drwxr-xr-x 27 root root 4096 ago 20 06:51 linux-headers-4.15.0-32
drwxr-xr-x  8 root root 4096 ago 20 06:51 linux-headers-4.15.0-32-generic
drwxr-xr-x 27 root root 4096 ago 24 06:54 linux-headers-4.15.0-33
drwxr-xr-x  8 root root 4096 ago 24 06:54 linux-headers-4.15.0-33-generic
drwxr-xr-x 24 root root 4096 set  3 10:39 linux-headers-4.18.5-041805
drwxr-xr-x  8 root root 4096 set  3 10:39 linux-headers-4.18.5-041805-generic
drwxr-xr-x  8 root root 4096 set  3 10:39 linux-headers-4.18.5-041805-lowlatency

Information about the other Ethernet interfaces listed in sudo lshw -C network: *-network:0 is an USB RNDIS interface (which I have unplugged to do all testing and make sure is unrelated) and an interface created by Docker (which I have stopped and disabled the service to make sure is unrelated).

Best Answer

I had a similar ethernet problem crop up.

Try a different ethernet cable, and a different port on your switch/hub/router, and see if your link stays up at 1000mbs.

I'm not sure this is a 100% fix, but it's what I did, and my ethernet is working now.

In terminal...

cd /etc/netplan

sudo pico config.yaml # create the .yaml file and add the following text


network:
  version: 2
  renderer: NetworkManager


sudo netplan generate

sudo netplan apply

reboot