Friday, August 18, 2006

Ubuntu Revisited

Ubuntu LinuxI was able to get my hands on a currently unused Dell Latitude D505 laptop at work. I installed Ubuntu 6.06 on it. I continue to be impressed.

Most everything just works. You press the power key and you're prompted with a menu with options to Restart, Lock the screen, Switch Users, Logoff, Power Down, Hibernate or Suspend. You close the lid, plugged in, and the screen blanks & locks. You close the lid on battery and it automatically suspends. You want to modify the volume: Fn+PageUp/Down (just like Windows). You go on battery & a new icon appears with the amount of estimated battery time left. You move your finger up and down across the right side of the trackpad and windows scroll. I did have to work hard to make the wireless card work. It also took some effort to watch DVD movies & Youtube videos. Keep reading for more on that.

If I didn't already have a Mac, I'd take back my Inspiron 8600 from my wife and install Ubuntu on it.

But I do have a Mac. So, I'll continue to use it. But, I'm going to play with this laptop until it's needed at work again.

First, the wireless card. It's not Linux's fault that I have to jump through hoops to make this work. Blame Broadcom. Blame Dell. Blame Apple and Intel and all of the other vendors using or making hardware with no documentation and limited support for non-Microsoft or Apple Operating Systems. One of the main reasons I'm such a supporter for the OpenBSD project is their commitment to using and supporting documented hardware with non-blob drivers and firmware.

I found many how-tos (many on Ubuntu's forums) about getting my wireless card working. And, by following many of them to the letter, nothing worked. I download many of the linked Broadcom drivers. They just didn't work. I used bcm43xx-fwcutter to "cut" the firmware from the driver. No dice. I tried using ndiswrapper. No dice. Well, not at first.

I downloaded the latest drivers for my TrueMobile 1400 from Dell's Support site. Neither extracting firmware or using ndiswrapper, could I get the card to work. I got furthest with ndiswrapper, but I kept getting an ntoskrnl error in /var/log/messages.

Then, I had an epiphany. Try older drivers. So I found the oldest driver on Dell's Support site. It worked with ndiswrapper:

  1. Create and change to a temporary directory in Terminal

  2. Run: unzip [filename.exe]

  3. Run: sudo ndiswrapper -i bcmwl5.inf

  4. Run: sudo ndiswrapper -m

  5. Run: sudo modprobe ndiswrapper

  6. Assuming no network security, run: sudo ifdown eth1 ; sudo ifup eth1


But, the driver I tested with was from 2003. So, I downloaded all of the TrueMobile 1400 drivers under the D505 section for Windows XP. R94827.EXE worked for me. Between each test, I'd run "sudo rmmod ndiswrapper; sudo ndiswrapper -e bcmwl5" and then follow the process above.

Next came WPA (for my home network). Ubuntu comes with wpa_supplicant. Using documentation from Ubuntu's wiki plus some improvisation, I got it working. I ran wpa_passphrase to help creating my /etc/wpa_supplicant.conf file (with modification found through Google):
# allow frontend (e.g., wpa_cli) to be used by 'admin̢۪ group
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=admin
ap_scan=2
#
network={
  ssid="My SSID"
  psk=pskgeneratedbywpa_passphrase
  scan_ssid=0
  proto=WPA
  key_mgmt=WPA-PSK
  group=TKIP
  pairwise=TKIP
}


Then, I ran wpa_supplicant (with "-B -ieth1 -Dndiswrapper -c/etc/wpa_supplicant.conf"). It connected to my Linksys immediately, but did not automatically recognize the need to renew an IP address. "sudo ifdown eth1 ; sudo ifup eth1" fixed that.

To make these changes permanent, I edited the /etc/network/interfaces file (eth1 part shown):
auto eth1
iface eth1 inet dhcp
pre-up /sbin/wpa_supplicant -B -ieth1 -Dndiswrapper \
    -c/etc/wpa_supplicant.conf
pre-up sleep 5


Then I rebooted to make sure it would work upon bootup. Success!

To make DVDs and Flash (for Youtube, etc) work, I referred to Ubuntu's User Documentation. It's pretty straightforward.

Finally, to fix one annoyance (click on tap), I edited my /etc/X11/xorg.conf so that the Synaptics Touchpad InputDevice section now looks like:
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "MaxTapTime" "0"
Option "MaxTapMove" "0"
Option "TapButton0" "0"
Option "TapButton1" "0"
Option "TapButton2" "0"
EndSection


Another major think I like about the way Ubuntu works: sudo vs. root. The root account is, by default, disabled. To do things as root, you (as the first installed user & a member of the admin group) can run commands with sudo (eg. "sudo vi /etc/passwd"). New users are not added to the admin group by default. To give them the ability to run commands as root with sudo, add them to the "admin" group. Any admin type functions in the GUI prompt you for your password (like sudo).

One last comment about Ubuntu (for this article at least). For writing this document, I typed "man interfaces" to get the syntax for the file. See, on my machine the wpa_supplicant line fits on one line, but for this web page, I wanted to have it wrap across two lines with "\". So, "man interfaces" did what it should. It displayed the man page for /etc/network/interfaces. From my experience with Redhat, that is not always the case. No man page for ifcfg-eth0, ifcfg, ifdown or ifup. There were some files in /etc on my Ubuntu machine that did not have man pages, but many did. Many more, it seems, than Redhat.

Yes, that was a lot of work to get my wireless card working (especially). But, I could definitely see buying a known compatible laptop with a working wireless card, loading Ubuntu on it for my Mother-in-law. Once I got it set up, it'd just work. For everything she'd need. Firefox, Email, DVDs, Digital Pictures, ... Don't worry, family, I'm not going to rock that boat... yet.

Finally, I should add that I posted this from Firefox, wirelessly, from Ubuntu.