Ethernet Cable Unplugged in Ubuntu 20.04 while it works in Windows

8,563

Have you tried adding sudo ifconfig enp6s0 down && sudo ifconfig enp6s0 up in /etc/profile as a temp solution.

Share:
8,563

Related videos on Youtube

mr.bjerre
Author by

mr.bjerre

Updated on September 18, 2022

Comments

  • mr.bjerre
    mr.bjerre over 1 year

    Sorry but I am no linux expert what so ever.

    I just bought a new motherboard; ASUS ROG Strix B550-f Gaming (Wifi) and I'm having trouble with both wifi and ethernet in Ubuntu 20.04. I have both Ubuntu and Windows on my machine and in Windows everything works flawless.

    I've just disabled fast boot in BIOS, booted into Windows, restarted and booted into Ubuntu and now Wifi seems to be working. Although it does seem very random.

    I've also tried various stuff to get ethernet working but 90% of the time I have "Cable Unplugged". Some times it is working though which is very odd. Here are some debug values

    ❯ uname -sr
    Linux 5.4.0-53-generic
    
    ❯ ifconfig   
    br-ac361f0ce01c: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            inet 192.168.49.1  netmask 255.255.255.0  broadcast 192.168.49.255
            ether 02:42:f6:16:5e:18  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    br-c6025e770d8b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 172.23.0.1  netmask 255.255.0.0  broadcast 172.23.255.255
            inet6 fe80::42:38ff:fe34:66b3  prefixlen 64  scopeid 0x20<link>
            ether 02:42:38:34:66:b3  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 188  bytes 28806 (28.8 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
            ether 02:42:11:c5:bc:8d  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    enp6s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            ether 24:4b:fe:5b:75:e9  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device memory 0xfc200000-fc2fffff  
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 1986  bytes 192527 (192.5 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 1986  bytes 192527 (192.5 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    veth6cf3b52: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet6 fe80::50fe:f9ff:fee2:8d22  prefixlen 64  scopeid 0x20<link>
            ether 52:fe:f9:e2:8d:22  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 234  bytes 34831 (34.8 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    wlp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.9.127  netmask 255.255.255.0  broadcast 192.168.9.255
            inet6 fe80::da03:df99:d9b4:2c69  prefixlen 64  scopeid 0x20<link>
            ether a8:7e:ea:33:04:eb  txqueuelen 1000  (Ethernet)
            RX packets 319841  bytes 465543077 (465.5 MB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 45130  bytes 6174880 (6.1 MB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    ❯ dmesg | grep eth
    [    1.168629] igc 0000:06:00.0 eth0: MAC: 24:4b:fe:5b:75:e9
    [    1.169098] igc 0000:06:00.0 enp6s0: renamed from eth0
    [   14.753497] br-c6025e770d8b: port 1(veth6cf3b52) entered blocking state
    [   14.753500] br-c6025e770d8b: port 1(veth6cf3b52) entered disabled state
    [   14.753579] device veth6cf3b52 entered promiscuous mode
    [   14.753705] br-c6025e770d8b: port 1(veth6cf3b52) entered blocking state
    [   14.753706] br-c6025e770d8b: port 1(veth6cf3b52) entered forwarding state
    [   14.754075] br-c6025e770d8b: port 1(veth6cf3b52) entered disabled state
    [   14.999187] eth0: renamed from vethd33a5f6
    [   15.035135] IPv6: ADDRCONF(NETDEV_CHANGE): veth6cf3b52: link becomes ready
    [   15.035175] br-c6025e770d8b: port 1(veth6cf3b52) entered blocking state
    [   15.035176] br-c6025e770d8b: port 1(veth6cf3b52) entered forwarding state
    
    ❯ sudo lshw -c network                             
      *-network                 
           description: Wireless interface
           product: Wi-Fi 6 AX200
           vendor: Intel Corporation
           physical id: 0
           bus info: pci@0000:05:00.0
           logical name: wlp5s0
           version: 1a
           serial: a8:7e:ea:33:04:eb
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
           configuration: broadcast=yes driver=iwlwifi driverversion=5.4.0-53-generic firmware=48.4fa0041f.0 ip=192.168.9.127 latency=0 link=yes multicast=yes wireless=IEEE 802.11
           resources: irq:33 memory:fc400000-fc403fff
      *-network
           description: Ethernet interface
           product: Intel Corporation
           vendor: Intel Corporation
           physical id: 0
           bus info: pci@0000:06:00.0
           logical name: enp6s0
           version: 02
           serial: 24:4b:fe:5b:75:e9
           capacity: 1Gbit/s
           width: 32 bits
           clock: 33MHz
           capabilities: pm msi msix pciexpress bus_master cap_list ethernet physical 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=igc driverversion=0.0.1-k latency=0 link=no multicast=yes port=twisted pair
           resources: irq:37 memory:fc200000-fc2fffff memory:fc300000-fc303fff
      *-network:0
           description: Ethernet interface
           physical id: 1
           logical name: docker0
           serial: 02:42:11:c5:bc:8d
           capabilities: ethernet physical
           configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=no multicast=yes
      *-network:1
           description: Ethernet interface
           physical id: 2
           logical name: veth6cf3b52
           serial: 52:fe:f9:e2:8d:22
           size: 10Gbit/s
           capabilities: ethernet physical
           configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s
      *-network:2
           description: Ethernet interface
           physical id: 3
           logical name: br-c6025e770d8b
           serial: 02:42:38:34:66:b3
           capabilities: ethernet physical
           configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.23.0.1 link=yes multicast=yes
      *-network:3
           description: Ethernet interface
           physical id: 4
           logical name: br-ac361f0ce01c
           serial: 02:42:f6:16:5e:18
           capabilities: ethernet physical
           configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=192.168.49.1 link=no multicast=yes
    
    ❯ cat /etc/NetworkManager/NetworkManager.conf
    [main]
    plugins=ifupdown,keyfile
    
    [ifupdown]
    managed=false
    
    [device]
    wifi.scan-rand-mac-address=no
    
    ❯ cat /etc/resolv.conf                       
    # This file is managed by man:systemd-resolved(8). Do not edit.
    #
    # This is a dynamic resolv.conf file for connecting local clients to the
    # internal DNS stub resolver of systemd-resolved. This file lists all
    # configured search domains.
    #
    # Run "resolvectl status" to see details about the uplink DNS servers
    # currently in use.
    #
    # Third party programs must not access this file directly, but only through the
    # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
    # replace this symlink by a static file or a different symlink.
    #
    # See man:systemd-resolved.service(8) for details about the supported modes of
    # operation for /etc/resolv.conf.
    
    nameserver 127.0.0.53
    options edns0 trust-ad
    

    I hope someone are able to spot what the issue is. I've also tried to manually set DHCP, netmask and gateway.

    Update 1

    I just tried

    ❯ sudo ifconfig enp6s0 down  
    ❯ sudo ifconfig enp6s0 up
    ❯ sudo /etc/init.d/network-manager restart
    

    which partially fixed ethernet. Now my cable actually connected to my router (which connects to a bridged router) but the internet didn't work. However if I manually changed the DNS nameserver to 8.8.8.8 in

    ❯ sudo nano /etc/resolv.conf
    

    then it works. I realize the first line in resolv.conf states

    This file is managed by man:systemd-resolved(8). Do not edit.
    

    So how should I actually do this instead? Also; I bet the ethernet won't work if I reboot but maybe someone knows how to make it work now?

    Update 2

    I've set the DNS to 8.8.8.8 which works just fine. But on reboot it still says cable unplugged which I manually solve by

    sudo ifconfig enp6s0 down && sudo ifconfig enp6s0 up
    

    I'd tried adding auto enp6s0 to /etc/network/interfaces but that doesn't work. FYI; /etc/network/interfaces didn't exist before