Sunday, August 15, 2010

Solving Debian (Squeeze) netinst problems with the Lenovo U350


My prayers have been answered. After spending 18 months with the M912 as my main computer, I finally received a Lenovo U350. It's got a bigger keyboard and a bigger screen. I know 13" ain't much nowadays, but it made a helluva difference for me. Now I can do a lot of stuff that I wanted to do ... more effectively and with pleasure.

Since it only comes with an 1.6 GHz ULV (ultra low voltage) processor, I thought I could squeeze an extra bit of processing power out of it by replacing the stock OS, Windows 7, with Debian Linux. Besides, I wanted to run Linux on this thing, goddammit. As I mentioned before, new laptops these days don't come with a DVD-writer, so your installation choice is pretty much limited to netinst with a USB stick. I mentioned this part in an earlier post (here is the link to my blog entry again), and it went smoothly.

BUT, as lucky as I am, there are two problems with the U350 that have to do with the Ethernet and wireless drivers. You won't be able to connect to the net during installation, which pretty much defeats the purpose of netinst. If you have access to a big enough USB stick, you can try to boot the installation from the actual DVD images (you only need the first one, I have been told) in lieu of the netinst iso image. But, if you're like me, stuck with a 512 Mb stick, then you will have to be a little more creative. Places like Linux Laptop Wiki gave me some ideas, and they seemed to have solved the problem, but they didn't really explain in detail how. So ... here it is.

I am assuming that you are installing Debian through a LAN or a wireless network and you have direct access to the hub. As I said before, during the netinst install you will have no network access whatsoever. The most you could do is to install the base system. So ignore all that warning and error messages about you not connecting to the net and let it install the base system for you. Then install your favorite boot loader (e.g., GRUB) and restart. We will first deal with the LAN issue, then we deal with the wireless issue. After that, you will be free to do whatever you need to do. I am assuming that you are doing all these as root.

Getting your LAN to work

The problem with the U350 Ethernet card (Broadcom Netlink BCM57780) has been reported in Debian bug report 553024. There are two drivers, tg3 and broadcom, that have to be loaded in a specific order. The good news is, both drivers are installed on the base system. The bad news is, they are loaded in the wrong order. But another good news is, you can explicitly tell Debian which one to load first.

1. First blacklist the tg3 so that it does not get loaded during boot. Edit the file /etc/modprobe.d/blacklist.conf and add the following line at the end of the file and save:

blacklist tg3

2. Back to the prompt, and update initramfs with the following command:

update-initramfs -u

You will get some warnings about "Possible missing firmware" from your newly blacklisted driver. You don't have to sweat over it.

3. Load the broadcom and tg3 drivers, in this order, so that the Ethernet card gets picked up. You can do this by adding the following 3 lines in the file /etc/modprobe.d/tg3.conf:

install tg3
/sbin/modprobe boradcom
/sbin/modprobe --ignore-install tg3

4. Add the Ethernet interface (eth0) in the file /etc/network/interfaces. I am assuming that you are using DHCP:

allow hotplug eth0
iface eth0 inet dhcp

5. Hook up your U350 to the LAN (yes, you will need an Ethernet cable). Bring up eth0 with the following command:

ifup eth0

If the system appears to have problem picking up the interface (it did happen for my very first attempt, even though it's not supposed to), you can reboot the computer. You can ping some known places like www.debian.org and it should work.

6. Now, you probably want to update your package source listings. So add the following lines to your /etc/apt/sources.list. First comment out (not remove) the existing lines so that you will not be asked to insert your netinst USB stick everytime you update the package listing. Then add the destination for your favorite repository. Here is my sources.list:

#deb cdrom:[Debian GNU/Linux testing _Squeeze_ - Official Snapshot i386 NETINST Binary-1 20100725-09:20]/ squeeze main

deb http://ftp.de.debian.org/debian squeeze main contrib non-free
deb-src http://ftp.de.debian.org/debian squeeze main contrib non-free

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

deb http://www.debian-multimedia.org squeeze main
deb-src http://www.debian-multimedia.org squeeze main

Run apt-update followed by apt-upgrade to update your base system. You will get warning messaging about PGP errors. Right now these problem won't affect what you are about to do. But we will deal with them afterwards.

Getting your wireless card to work

There are two problems with the Debian wireless install on the U350. First is that the Debian wireless install only allows WEP as your security protocal, when most wireless networks out there are already using the WPA protocol, which is more secure. So even if Debian netinst picks up your wireless card, you won't be able to install from it.

The next problem is the on-board Intel 5100 AGN wireless card, which comes with its proprietary firmware. The standard Debian installation, naturally, does not come with the firmware because of it. You have to pick it up yourself on the non-free section of the repository. So while the driver (iwlagn) is loaded, you have to pick up two other packages.

1. With your now-working LAN connection, pick up the packages wpasuplicant and the firmware from the Debian repository:

apt-get install wpasupplicant firmware-iwlwifi

2. Bring down your Ethnernet connection with the command ifdown eth0

3. Reedit the file /etc/network/interfaces. This time, comment out the lines with eth0. Then add your wireless network interface (wlan0):

auto wlan0
iface wlan0 inet dhcp
wpa-ssid [YOUR WLAN ID]
wpa-psk [YOUR PASSPHRASE]

You should know what the WLAN ID and the passphrase. They are usually written on the back on your wireless router. If not, I hope someone else knows, or knows where it is hidden.

4. Bring up the wlan0 interface with the command ifup wlan0. It might take a few attempts depending on how good your wireless connection is.

Congratulations, you now have a working wireless connection on your U350. You can now install your favorite Desktop manager, web browser, and MP3 player (not Amarok 2, I hope).



Getting rid of PGP errors

To get rid of your "PGP error" warnings with apt-update. This happens with the security and multimedia repositories. For the multimedia stuff, all you have to do is to install apt-get install multimedia-keyring.

For the security repository, you will have to jot down the PGP key that came out of the apt-get update warning message. Then issue the following commands to add that to your PGP keyring:

gpg --keyserver pgpkeys.mit.edu --recv-key [PGP KEY]
gpg -a --export [PGP KEY] | apt-key add -

The warning messages should go away the next time you update your package repository.

How do you know what hardware are on your computer

The command lspci will spit out all of your PCI devices that are on your computer. The important stuff of us, obviously, would be the sound cards and network cards, which are usually listed at the end.

What about running Windows in Debian?

Yes, since I don't think I will ever get the hang of OpenOffice.org in the foreseeable future, I will stick with XP for my daily MS needs. I Virtualbox'd it, and Powerpoint runs very smoothly. If you install the Guest Additions, you can even do funky things like dynamic screen resolution and shared folders (with the Debian host). So I guess I can do everything on this computer afterall.

2 comments: