Disappearing LAN?

Today, my “internet stopped working”. At least I could no longer connect through my Ubuntu box - but my WinXP laptop over WiFi, and my wife’s Ubuntu box over WiFi worked fine. Strange.

Basically, it looked like I couldn’t “talk” to the router. I wasn’t getting an IP address and I could not ping my router. Sometimes I could ping, but at 70+% packet loss. Very strange behavior.

Cycled the power on the router a few time, no help. Swapped out the LAN cable, no help. Rebooted the box a few times. Plugged the LAN cable into the WinXP laptop, and it worked fine there. So that pretty much narrowed it down to the LAN interface on my Ubuntu box.

It’s a motherboard LAN, a Realtek RTK8111/8168B PCI Express Gigabit Ethernet controller (you can use lspci to view hardware info - sudo lspci -vvmm gives detailed info.)

I found a few bug reports about the LAN card being powered down from Windows, and Ubuntu could not power it back up - the “wake on LAN” feature. However, since I don’t dual-boot I didn’t think this would buy me anything.

I also read that removing and reapplying the driver would help? This is something like:

$sudo rmmod r8169
$modprobe r8169

This did something, but didn’t fix the problem. Finally, following something I read related to the dual-boot thing (which is supposed to re-set the network card by making sure it has no power) I did this:

1. Shutdown and power off
2. Unplug power cord from box
3. Press power button (this supposedly “flushes” any power in capacitors or something? Sounds sketchy to me.)
4. Plug back in and power on

Well, it seems to have worked. I’ve been back on the ‘net for a few hours now no problem. Still not sure about this one, but hopefully it is resolved.

Edited to add:

It is NOT resolved. eth0 continues to drop out, and I’m not sure why. One time just doing:

$sudo ifconfig eth0 down
$sudo ifconfig eth0 up

…seemed to work. After a left to watch a movie and came back, though - it was down again.

Then I tried lots of similar things, including the two things above that appeared to work, but they didn’t this time. THIS time, it seems like:

$sudo /etc/init.d/networking restart

…did the trick.

It’s clear that there is SOME sort of problem with eth0, but I’m afraid I’m not sure what. Searching on the internet reveals a lot of similar issues with the kernel, Debian, Ubuntu, and other Linux distros and even some non-Realtek chipsets, so this is a frustrating issue.

Even more edited to add:

I think this is resolved. (sigh)

I followed the steps in this blog post to use a different driver. The last part about editing rc.conf is not necessary in Gutsy (a nice person in #ubuntu helped me through this as well).

STILL editing to add:

Although I thought the editing rc.conf was not necessary, the problem returns if the r8169 driver is loaded - and it will be. It wouldn’t be blacklisted in either /etc/modprobe.d/blacklist or /etc/modprobe.d/blacklist-network, both of which were mentioned.

However, I ran across this launchpad bug report, which gave detailed instructions on removing r8169 (in his case the new driver is r1000, but in mine it is r8168, substitute as appropriate):

Now, let’s find out if r8169 is loaded as well…

# lsmod | grep r8169

If it is loaded then there’s the chance that r8169 has grabbed the NIC … however, you can force r1000 to be used by a small “hack”.

# sudo mv /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko ~/
This will move the r8169 kernel module into your home directory.

# sudo depmod -a
Rebuild the kernel module dependencies.

# sudo mv /boot/initrd.img-`uname-r` /boot/initrd.img-`uname -r`.ubuntu
make a backup of the original initrd.

# sudo mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
Create a new initrd WITHOUT the r8169 module

# sudo gedit /etc/modules

Add “r1000″ (without the quotes) at the end of the file.

Save the file.

Upon reboot you are using r1000 for sure as there’s no more r8169.

One Response to “Disappearing LAN?”

  1. Upgrade to Hardy « Me and U(buntu) Says:

    [...] I mentioned in this post about my “Disappearing LAN“, I had removed the default kernel driver for my motherboard Ethernet adapter, and installed [...]

Leave a Reply