Repair Hardware Failure After Ubuntu Upgrade


Some of you might found a hardware failure after had Ubuntu upgrade. In Matthew Helmke case, his network wireless card didn’t work after he had upgrade his Ubuntu from 11.04 to 11.10. Although this post discusses the network card, but I think to fix the other hardware is not much different.

Lets starts the lesson, kid :)
Knowing your hardware

Before we could do anything, we needed to learn a bit about our hardware; in this case the model of wireless network card we had. This is easily accomplished using a few commands in the terminal.

We start with the nm-tool command, which is a utility that provides information about NetworkManager, device, and wireless networks.
Note: For all examples, I am logged in as matthew on a computer named seymour (after Seymour Cray) and am issuing the commands shown in bold. Output follows the commands. The output may be abridged for space, but all important details are shown.

matthew@seymour:~$ nm-tool
NetworkManager Tool
State: disconnected
- Device: ra0 ----------------------------------------
Type: 802.11 WiFi
Driver: rt2800pci
State: disconnected
Default: no
HW Address: E0:69:95:29:06:FD

Capabilities:

Wireless Properties
WEP Encryption: yes
WPA Encryption: yes
WPA2 Encryption: yes

Wireless Access Points (* = current AP)

IPv4 Settings:

Here you can see that the 802.11 WiFi network interface is named ra0 and is disconnected. It is using the rt2800pci driver. That raises the question as to whether it is the correct driver for the hardware I have on the machine.

We can check the hardware model using the lshw command, which is a utility to list hardware devices and details about them. We need to use sudo as lshw requires super user privileges. The -C network part of the command limits the output to networking devices.

matthew@seymour:~$ sudo lshw -C network
[sudo] password for matthew:
*-network
description: Wireless interface
product: RT2860
vendor: Ralink corp.
physical id: 0
bus info: pci@0000:01:00.0
logical name: ra0
version: 00
serial: e0:69:95:29:06:fd
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=RALINK WLAN driverversion=2.4.0.0 ip=192.168.1.105 latency=0 multicast=yes wireless=Ralink STA
resources: irq:16 memory:f7ff0000-f7ffffff

Two devices were found, but I do not include the information from my wired network device in the output above, just to save space.

What we learn above is that my device is an RT2860 from Ralink corp. This is similar, but not identical to the name of the driver from the previous command, rt2800pci. The wrong driver was installed, and this is the cause of my inability to use the wireless network card.

Finding the correct driver

What I did was search the internet using the terms "linux driver rt2860." I found the official Ralink company website and driver download location and downloaded the correct driver -- it is listed as RT2860PCI/mPCI/CB/PCIe(RT2760/RT2790/RT2860/RT2890). The site requires that you enter your name and email address, but the driver download is free of charge. Download the provided tar file and unpack the archive wherever you like (for example, I did it in /home/matthew/ralinkdriver).

matthew@seymour:~$ tar -xvf 2010_07_16_RT2860_Linux_STA_v2.4.0.0.tar

If you download a newer version of the driver, the filename will reflect that and will therefore be a bit different.

Installing the driver

The driver is made available is source form, and it must be compiled and installed. This section lists the steps I needed to take to install and use this driver.

Note: To compile and install the driver, you must have a compiler and kernel headings installed. You may install these by installing the build-essential package from the Ubuntu software repositories, using this command or your favorite alternative method:

matthew@seymour:~$ sudo apt-get install build-essential

Step 1

Enter the new directory created by unpacking the tar archive.

matthew@seymour:~$ cd ~ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0

Step 2

Edit a config file for the driver to inform it that wpa_supplicant is available, without which you will not be able to use WPA encryption. This is shown using the nano text editor, but you may use any editor you prefer.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ nano os/linux/config.mk

Find these lines, which are set to n by default, and change them to y, as shown.

HAS_WPA_SUPPLICANT=y
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=Y

Save the file (control+x in nano).

Step 3
Next, edit another config file, for the same reason.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ nano common/cmm_wpa.c

Use control+W in nano to search and find the line with the command MIX_CIPHER_NOTUSE in it. Replace the entire line with this one:

WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES;

Save the file.

Step 4

Compile and install the driver.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo make
matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo make install

Step 5

We must remove the currently-used driver. First, take the interface down.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo ifconfig ra0 down

Note: some systems may use wlan0 instead of ra0. You will know based on the output lshw earlier. Look for this line: logical name: ra0.

Next, remove the incorrect module and rename the module file.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo rmmod rt2860sta

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo mv /lib/modules/$(uname -r)/kernel/drivers/staging/rt2860/rt2860sta.ko /lib/modules/$(uname -r)/kernel/drivers/staging/rt2860/rt2860sta.ko.dist

Step 6

Now, we will generate the new module for the new driver with the running kernel, make sure it is being used, and then bring up the wireless network.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo depmod -a

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo modprobe rt2860sta

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo ifconfig ra0 up

If all goes well, you should now have the ability to use your wireless card to connect to networks. If so, you will want to make this permanent with one last step.

Step 7

Copy the driver you just compiled into its permanent home, then edit the list of modules loaded by default at boot time to include it.

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo cp os/linux/rt2860sta.ko /lib/modules/$(uname -r)/kernel/drivers/staging/rt2860/

matthew@seymour:~/ralinkdriver/2010_07_16_RT2860_Linux_STA_v2.4.0.0$ sudo nano /etc/modules

Add rt2860sta on a new line at the end of the file and save it. When you reboot, the module should be loaded automatically and your wireless network card should function normally.

That's it how to repair the hardware failure after Ubuntu upgrade. In this post, we use network wireless card, but it might different with your cases. What the important is the guidelines for any hardware failure are almost same.
Hope it useful :)
Via ITWorld.

2 comments: