Score:0

Ethernet fails to connect: "No IP config"

ng flag

After a few hours of troubleshooting I was finally able to dual boot the latest version of Kubuntu (21.04) alongside Windows. Completely fresh install, nothing changed, tampered with, etc. However, there's no internet. It tries connecting for a while, but then fails with the error "No IP configuration available". After following tutorials and really not understanding what was going on I found out that ifap wasn't even installed. My best guess is that some linux kernel headers are missing as one guy said who had the exact same issue. I don't know which headers to install, or even how to at this point. I checked and I still have the network folder with some files in it, but the interfaces file itself was missing. I also have netplan since 18.04 and up use that as far as I know. Either way, I'm missing some interfaces and I have no idea what to do.

sudo lshw -C network outputs:

*-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:07:00.0
       logical name: enp7s0
       version: 0c
       serial: e0:d5:5e:6a:e9:11
       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-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.11.0-25-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.1.194 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:18 ioport:d000(size=256) memory:f7100000-f7100fff memory:f2200000-f2203fff

cat /etc/netplan/*.yaml outputs:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

dkms status shows nothing.

heynnema avatar
ru flag
Edit your question and show me `sudo lshw -C network` and `cat /etc/netplan/*.yaml`. Start comments to me with @heynnema or I'll miss them. Thanks!
Frappy avatar
ng flag
Hi @heynnema thanks for your comment. I've actually already figured out the problem. My motherboard has a Realtek RTL8111/8168/8411 ethernet controller, which is an exact model that Ubuntu installs a broken driver for. Namely R8169. The working one is R8168. Without internet however, there's little I can do. I don't even know how to manually install a driver in the first place and it all seems like a big headache. TL;DR, I can't use Ubuntu unless I get a new MB or buy a WiFi adapter or something. Sucks.
heynnema avatar
ru flag
The problem probably isn't with the ethernet controller itself. You probably don't need a new motherboard. I have more info that might help get you going. Does your Windows still boot? Does ethernet work under Windows? Are you typing these comments from Windows, or from another computer? Do you have a USB flash key available? Try and answer my two data requests above.
Frappy avatar
ng flag
@heynnema Well yes it's not the ethernet controller itself but it's the broken driver that's causing this. Windows still boots, ethernet works flawlessly under Windows, yes these comments are from Windows, yes I have a USB flash key - although putting the Kubuntu ISO on it with Balena Etcher made it into 2 different partitions and I'm NGL I don't know how to format it, it's write protected.
heynnema avatar
ru flag
The driver probably isn't your only problem with ethernet under Ubuntu. You probably also have a MSI/MSIX interrupt problem, for which I have a patch. But I'm waiting to get the info from my previous comments. You should be able to format the USB key with the `Disks` or `gparted` app... but be careful to select the proper drive to format... also... show me the output of `dkms status`.
Frappy avatar
ng flag
@heynnema Yeah, I wouldn't be surprised if that was the case. Anyways, give me a sec and I'll get the stuff you wanted. Forgot to include it in the previous comment.
heynnema avatar
ru flag
Don't put that output into comments... edit it into your question.
Frappy avatar
ng flag
@heynnema Updated my post. Okay so here's the deal. I'd given up on this after realizing the driver thing. I now installed Kubuntu again and somehow ethernet works. I don't know how, there were errors when booting from the USB, GRUB was broken so I had to run DPKG and update it from recovery mode and after updating everything from the discovery store it's asking me to restart which I suspect will then break my ethernet. Something is clearly different because the installation also took 2x times longer than my previous, more broken installations.
heynnema avatar
ru flag
The ethernet will fail again. It's an intermittent problem. Let me know if/when it fails again and I'll give you the MSI/MSIX patch.
Frappy avatar
ng flag
@heynnema yes, give me the patch. What's an intermittent problem and an MSI/MSIX path though if you wouldn't mind explaining?
heynnema avatar
ru flag
An intermittent problem is one that doesn't always occur. MSI/MSIX interrupts were enabled in Ubuntu 20.xx, and cause problems for many of these ethernet cards. This patch disables these interrupts.
Score:0
ru flag

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
#
# Attached is a work-around for the in-kernel driver that is as unhacky as I can make it.

# 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.) 

# 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..

# Still hoping we can cherry pick the in-driver workaround for bionic...?

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
Frappy avatar
ng flag
I don't understand half of this, but I'll try to make it work. I do have a question though that can't go w/o an answer. What's the script below? Do you mean I put the script in the file named `r8169_disable_msi` and then drop that file into /etc/initramfs-tools/scripts/init-top? What do you mean by "Still hoping we can cherry pick the in-driver workaround for bionic...?". Sorry if I'm being annoying. I'm planning on switching to Linux full time and I just want to understand everything. Oh and what language is the script in? What extension does the file need to have in order to work?
heynnema avatar
ru flag
@Frappy The script disables MSI/MSIX interrupts for the ethernet card. Yes, the script goes into that directory, and then `sudo chmod a+x` to make it executable, Ignore the "Still hoping..." line, it's just for historical purposes. The script is a command shell... type `man sh` for more info. No extension.
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.