This post could very well be titled “How to install Linux on a Lenovo IdeaCentre Q180.” It was the purchase of one of the Lenovo IdeaCentre Q180 devices that triggered my quest to find the solution to the data packet loss I was experiencing. The Q180 comes with Windows 7 pre-installed which is a great Operating System to use as a media centre, but I had plans to turn the Q180 into a super-tiny test web server and Subversion/Git repository which definitely requires Linux.
The installation of Ubuntu Server 11.10 on the machine goes without a single hitch and the OS itself functions (almost) perfectly. It was when I tried to connect to the Internet or to SSH into the server from my laptop that the packet loss issue became most apparent. In fact, my SSH connection would die after 20 seconds requiring me to restart the session – at times it even required a reboot of the Server itself.
To test the connection, I would begin a continuous ping from my laptop to the Server’s IP address. Initially the ping would return a steady response but after about 20 – 30 seconds I would get “Destination host unreachable” as a response. The ping would then sporadically get a response before the host would be unreachable again. This unstable connection immediately kills any SSH session.
After much investigation (along with installs, re-installs, config changes and reading of websites) I found out that the Realtek 8168B ethernet controllers are actually incorrectly supported within the Linux kernel as far back as 2.4.x – I’m running Ubuntu Server 11.10 based on the 3.0.x Linux kernel myself.
So what exactly is the issue? It seems that during installation, Linux incorrectly installs the drivers for the Realtek 8169 ethernet controller which allows the 8186 to function but barely. The level of communication is akin to me using my Afrikaans to become a Dutch translator – I’d get the basics right but with a lot of problems along the way.
The solution, in hindsight, is painfully simple – simply uninstall the 8169 driver and install the Realtek RTL8168 drivers.
Firstly, confirm you actually have the r8168 controller. (I recommend running all commands as root).
If so, you’ll need to download the latest driver from the Realtek driver website. Alternatively, run the following command in your Home directory:
Next we need to remove the r8169 drivers from the kernel.
Now we get to the good bit – compile and install the Realtek r8168 drivers:
tar xvf r8168-8.026.00.tar.bz2 cd r8168-8.026.00/ sudo modprobe -rfv r8169 sudo make sudo cp src/r8168.ko /lib/modules/$(uname -r)/kernel/drivers/net/ sudo depmod -a sudo modprobe -v r8168
Confirm everything went as planned and the driver is installed.
lsmod | grep r8168
You now have to blacklist the r8169 driver by editing /etc/modprobe.d/blacklist.conf and inserting
Test the success by rebooting your server and pinging it from another machine. This is how I tested it and after updating the driver my ping returned a consistent response. In fact, the response was much quicker as the r8169 driver also capped the ethernet controller at 100MBits.