Score:0

Ethernet not working in Ubuntu 20.04

in flag

I'm a complete novice at Linux. I tried running Ethernet on Ubuntu 20.04 and it didn't run, I got nothing, not even wired unmanaged. Ethernet is working fine on Windows 10. The Output of

lshw -c network 

  *-network
     description: Ethernet interface
     product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
     vendor: Realtek Semiconductor Co., Ltd.
     physical id: 0
     bus info: pci@0000:05:00.0
     logical name: enp5s0
     version: 15
     serial: 2c:f0:5d:66:42:09
     size: 1Gbit/s
     capacity: 1Gbit/s
     width: 64 bits
     clock: 33MHz
     capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
     configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.11.0-27-generic duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
     resources: irq:45 ioport:f000(size=256) memory:fe904000-fe904fff memory:fe900000-fe903fff

It was disabled earlier, but after following this solution, it showed wired unmanaged. I've tried various other solutions. None works for me so far. Some solutions are specific to Ubuntu 18.04 or older.

Terrance avatar
id flag
You can try https://askubuntu.com/a/1321823/231142 but I think it needs some sort of internet to work so if you have Wifi working it should work fine.
in flag
@Terrance , I followed that solution and ended up getting network Disabled in lshw -c network, for which I used sudo ifconfig epn5s0 up, but now it doesn't even show "wired unmanaged"
in flag
oof, So it works now, the solution that worked for me is [this](https://askubuntu.com/questions/882806/ethernet-device-not-managed) The second answer (upvote wise) by vlada
Terrance avatar
id flag
What driver does it show it is using? The reason I ask that is that the `r8169` is very unstable on the `RTL8168` chipset.
in flag
@Terrance , For now, it is r8168. So, Ig the solution is what you mentioned + the link I've shared in the previous comment. Thank you for helping me on this
Terrance avatar
id flag
That is good to know. You can write up what you did as an answer as it was multiple things that helped you. :)
heynnema avatar
ru flag
@Terrance Please see my answer.
Score:0
ru flag

After your fixes, you may find that ethernet is either intermittent, or only works after booting into Windows.

MSI/MSIX interrupts were enabled for certain ethernet cards in Ubuntu 20.xx. This can cause intermittent ethernet operation. Here's a patch to fix it. Follow the embedded instructions to install.

#!/bin/sh

# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1779817

# filename: r8169_disable_msi

# Drop it in /etc/initramfs-tools/scripts/init-top and chmod a+x it. Add 'r8169_disable_msi'
# to your kernel command line (/etc/default/grub, GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# usually.) 

# sudo -H gedit /etc/default/grub # to edit the file

# Remember to update-initramfs and update-grub as necessary.

# sudo update-initramfs -c -k $(uname -r)
# sudo update-grub
# reboot

# For the moment it disables MSI on everything with the ID 0x10ec:0x8168, as there seems to
# be no way to get the MAC version from userspace - and certainly not before the driver is
# loaded. Other PCI IDs may need adding..

PREREQ=""
prereqs()
{
    echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
    prereqs
    exit 0
    ;;
esac

disable_msi () {
    for i in /sys/bus/pci/devices/*; do 
        if [ $(cat $i/vendor) = "0x10ec" -a $(cat $i/device) = "0x8168" ]; then
            echo 0 >$i/msi_bus
        fi
    done
}

for x in $(cat /proc/cmdline); do
        case ${x} in
        r8169_disable_msi)
        disable_msi
        break
                ;;
        esac
done
in flag
I'm actually a novice at Linux, So, I don't understand even these simple instructions quite enough, I'll try to figure that out. Besides, is this solution for r8169 driver? Now, I'm using r8168
heynnema avatar
ru flag
@ChiragMehta We were all Linux novices at some time :-) If your ethernet is stable and reliable, then you don't need to do this patch. If you find that ethernet doesn't work, or doesn't work after suspend/resume, or only works after booting to Windows first, then you'll need this patch. It applies to either the r8169 or r8168-dkms driver.
in flag
My ethernet is stable but for some reason I'm getting around 135 mbps download on Ubuntu, while it's around 250 mbps on windows.
heynnema avatar
ru flag
@ChiragMehta Is that with VPN on? How are you testing this?
in flag
Yes, it's with VPN on, but it's from my ISP's end (my college). I tested speed on [Ookla](https://www.speedtest.net/) and [Cloudflare](https://speed.cloudflare.com/). I use Cloudflare's WARP sometimes to bypass restrictions but the speed is indistinguishable.
heynnema avatar
ru flag
@ChiragMehta VPN speeds will always be lower, mostly depending on where their server is located, how busy the server is, and the fact that it's VPN. Do you run a VPN app, or use CLI, to bring VPN up/down? Are you able to test with VPN down?
in flag
VPN is on my ISP's end, not on my device. It's same for windows and Ubuntu. Since the server belongs to my Institute (IIT-Hyderabad), the ping is ~3 ms. I'm not using any VPN on my end to test speeds on both Windows and Ubuntu. I use CLI (cloudflare's WARP) when I need to surpass the restrictions put by my Institute, the speed tests conducted are without the use of CLI.
heynnema avatar
ru flag
@ChiragMehta The only way to really test speed is without VPN. Do you have access to another network connection that doesn't use VPN, just to test?
in flag
No, the college doesn't provide any other network for any purposes, but, I don't understand why the speed would be different for Ubuntu and Windows despite having the same source and the same VPN from Institute.
heynnema avatar
ru flag
@ChiragMehta It's difficult to compare Windows vs Linux... as they do the same things slightly differently. Do you connect wireless or wired? Do you have access to another network besides the college?
in flag
I'm connecting to wired network provided by college. Apart from that I've cellular data, i can use mobile hotspot.
heynnema avatar
ru flag
@ChiragMehta Although I expect slow results, go ahead and speedtest cellular/hotspot.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.