Tuesday, July 01, 2008

Installing Ubuntu Eee (Hardy Heron) on the EeePC 900


DISCLAIMER: All the information in this post can be found on the internet: though Google, or by following links from the site http://www.eeeuser.com/ and http://www.ubuntu-eee.com/. I simply wrote this because when I installed Ubuntu, there was no straightforward list of things to do, and some suggestions conflicted with others. So I simply am writing down the steps I took which resulted in a nearly perfect system.

My Macbook Pro kicked the bucket a week after moving to Italy. In need of something to tide me over while I'm here (and not wanting to send my expensive laptop through the Italian post for repair) I went and purchased an EEEPC 900. There's some bait-and-switch fiasco going on with the battery, but I'm happy to report that mine came with a 5800mAh battery.

The Xandros OS was fine for a while, especially when I switched to advanced desktop mode, but I didn't like the fact that the Asus repository for packages was pretty out of date. For example, to run Firefox 3 you need gtk 2.10 or above, and the EEE comes with gtk 2.8, as many people have noted on forums.

I just want Firefox, why not just build gtk 2.10 instead of installing a whole new OS? I guess it's because I'm a lazy Linux user. I like the fact that Linux is mostly free, and infinitely configurable, but I really hate doing it. The thing I love about Ubuntu (and maybe other distros, I wouldn't know) is the automatic package manager is just like the software update on the Mac; unlike maintaining the RedHat Enterprise machine at work, which requires manual package compatibility and requirement checking, the Synaptic package manager does all that for you, and "just works".

I chose to install Ubuntu Eee, a streamlined version of Hardy Heron (8.0.4) designed specifically for the Eee. The instructions on the Ubuntu Eee Wiki are somewhat wrong, at least in my experience. First of all, I found that my 16GB Corsair Voyager wasn't recognized by the BIOS as a bootable device; instead I used a 1GB USB key. Here's what I did, on a plain desktop Ubuntu 8.0.4 system.

INSTALLATION
  1. Download the ISO from the Ubuntu Eee site. There's also a torrent link.

  2. Stick the USB drive in the machine (make sure there's nothing on it you want to keep) and let the machine auto-mount it. When it does, use the file browser to find the path (mine was /media/disk) then type in a terminal
    mount | grep /media/disk
    which should spit something out like,
    cwu@ceeepc:~$ mount | grep /media/disk
    /dev/sdd1 on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
    So now I know the drive is /dev/sdd1, although yours may be different. Now I'm going to unmount it (it's about to be erased...) and get to work.
    cwu@ceeepc:~$ umount /media/disk

  3. First we need some helper programs. Do:
    sudo -s
    apt-get install syslinux
    wget http://startx.ro/sugar/isotostick.sh
    chmod +x isotostick.sh
    parted /dev/sdX
    The first command will ask you for your password, this way you don't have to use sudo each time. The second command retrieves a set of tools from the net, and the third retrieves a script with which we can install the ISO image onto the USB stick. The fourth command makes the script executable, and finally we launch the partitioning program on the USB stick. Make sure to replace X with whatever drive letter you had from the previous step.

  4. Here's where my method departs from the instructions in the Wiki. For some reason, mkfs.vfat doesn't create a partition 1 for me... I have no idea why. So in parted, you get a prompt. Here's what to do. First, take a look at the partition table. On my key, it looks like this (I'm recreating the steps with the 16GB drive):
    (parted) print                                   

    Disk /dev/sdd1: 16.1GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number Start End Size Type File system Flags

    (parted)
    Now, create a partition:
    (parted) mkpart                                   
    Partition type? primary/extended? primary
    File system type? [ext2]? fat32
    Start? 1
    End? 16.1GB
    (parted) print

    Disk /dev/sdd1: 16.1GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number Start End Size Type File system Flags
    1 32.3kB 16.1GB 16.1GB primary lba

    (parted)
    Now we have to format this partition.
    (parted) mkfs                                      
    Partition number? 1
    File system? [ext2]? fat32
    (parted) print

    Disk /dev/sdd1: 16.1GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number Start End Size Type File system Flags
    1 32.3kB 16.1GB 16.1GB primary fat32 lba

    (parted)
    Finally, we have to make this partition bootable.
    (parted) toggle 1 boot                             
    (parted) print

    Disk /dev/sdd1: 16.1GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number Start End Size Type File system Flags
    1 32.3kB 16.1GB 16.1GB primary fat32 boot, lba

    (parted)

  5. Now quit from parted, and we install the Ubuntu image onto the key with:
    ./isotostick.sh ubuntu-eee-804.iso /dev/sdX
    syslinux /dev/sdX
    (replace X with your drive letter as before) The first command takes a while, as it has to copy a 700MB ISO image onto the key. The second command has something to do with the booting from the key, I'm not totally sure.

  6. Once this is done, you stick the key in your Eee and reboot. As the first EeePC splash screen comes up, press the ESC key a bunch of times to make the boot selector come up. Choose your USB key, and it will boot into Ubuntu. Installation is really easy, the only thing I changed was the partition management:

  7. My EeePC has two drives, a 4GB SSD and a 16GB SSD. when asked for the partition setup, I did the following: I removed the swap, for reasons of SSD longevity (debatable, given the average life cycle of an electronic gadget these days) I mounted the 4GB drive a / with an EXT2 filesystem (no journaling, for aforementioned reasons) and the 16GB mounted to /home, also EXT2.

  8. The installation takes about 10 minutes, and when it's done, it asks you to reboot the system with the USB key removed. Assuming you don't want to re-install, your USB key is now free.
POST-INSTALL TWEAKS

  1. Auto-Update
    Pretty much everything works out of the box. The wired network, wireless, screen resolution all seemed fine, and I let Synaptic update the system with the newest packages, which took a good hour because it had about 160MB of stuff to download (including the release version of Firefox 3!).

  2. Camera
    I noticed that the webcam still wasn't working with Skype even after I re-enabled it in the BIOS (somehow when I installed Ubuntu it turned itself off), so I found a fix for this on the net, which I'll summarize below:
    sudo aptitude install subversion
    svn co svn://svn.berlios.de/linux-uvc/linux-uvc/trunk linux-uvc
    cd linux-uvc
    sudo make
    sudo make install
    sudo modprobe -r uvcvideo
    sudo mv /lib/modules/$(uname -r)/ubuntu/media/usbvideo/uvcvideo.ko /lib/modules/$(uname -r)/ubuntu/media/usbvideo/uvcvideo.ko.original
    sudo cp uvcvideo.ko /lib/modules/$(uname -r)/ubuntu/media/usbvideo/uvcvideo.ko
    sudo modprobe uvcvideo
    This makes the webcam with with skype, although at around 5fps. (not a Macbook Pro)

  3. Reducing Disk Writes, and Automounting the SD Card Slot
    This requires modifying the /etc/fstab file so that it looks something like this:
    # /etc/fstab: static file system information.
    #
    #
    proc /proc proc defaults 0 0
    # /dev/sda1
    UUID=718516b9-c26d-470d-b99d-231ecd0927aa / ext2 relatime,errors=remount-ro 0 1
    # /dev/sdb1
    UUID=e5be350e-f189-4503-a992-bd8c9c9217a0 /home ext2 relatime 0 2
    # /dev/sdc1 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
    tmpfs /var/log tmpfs defaults,noatime 0 0
    tmpfs /tmp tmpfs defaults,noatime 0 0
    tmpfs /var/tmp tmpfs defaults,noatime 0 0
    Specifically, comment out the line beginning with /dev/sdc1, that tries to mount SD cards as CD drives and fails, then add the three tmpfs lines below. This writes things to RAM instead of the SSD.

  4. The Shutdown Process, Audio and Hotkeys
    Next, I followed the instructions here (a slightly cleaner solution) to make the Eee shut down properly.

    Then to get audio to work, add:
    options snd-hda-intel model=auto
    to the file /etc/modprobe.d/snd-hda-intel or create it if it doesn't exist. To make all the Hotkeys work, I created the file /etc/acpi/eeepc-hotkeys.sh containing
    #!/bin/sh

    code=$3

    case $code in
    # Fn+F2 -- enable/disable wifi
    0000001[01])
    /etc/acpi/actions/wireless-toggle.sh
    ;;
    # Fn+F7 -- mute/unmute speakers
    00000013)
    acpi_fakekey 113
    ;;
    # Fn+F8 -- decrease volume
    00000014)
    acpi_fakekey 114
    ;;
    # Fn+F9 -- increase volume
    00000015)
    acpi_fakekey 115
    ;;
    esac
    then made it executable with
    chmod a+x /etc/acpi/eeepc-hotkeys.sh
    Then, I created the file /etc/acpi/events/hotkey containing
    event=hotkey ATKD
    action=/etc/acpi/eeepc-hotkeys.sh %e
    and rebooted the system.

  5. Boot Speed and Battery Life, Wifi LED
    I'm not sure how much of a difference these things make, but I first I changed the writeback interval by adding the lines
    vm.dirty_writeback_centisecs=1500
    dev.wifi0.ledpin=1
    dev.wifi0.softled=1

    to the file /etc/sysctl.conf. (I slipped in the Wifi LED fix)

    Then, I changed this line, appending the clocksource=hpet
    # defoptions=quiet splash clocksource=hpet
    to the file /boot/grub/menu.lst. You need to reload the file with
    sudo update-grub
    Finally, I profiled the bootup by following the instructions here. I don't know how fast it's supposed to be, but I boot up in about 50 seconds.


Vodafone HSDPA USB Modem (Huawei E272)

At my current apartment, I don't have a fixed internet connection, so I went to Vodafone and purchased a 3G USB modem. The plan's pretty good; it's pay-as-you-go, 15€ a month for 30 hours unlimited data per month, and the first month is free and I get 100 hours. The modem is a Huawei E272, the latest and greatest and cost 200€, and it seems to be unlockable from what I'm reading on the net. I considered the key-style E172, but decided against it because if I ever get a Macbook Air, I've heard the larger dongles have problems fitting in the single (sigh) USB port of the Air. Besides, the E272 has an external antenna connector.What worried me about buying the newest modem (instead of the E220, which can't go as fast) is it might not be supported in Linux yet. But, I took a chance. In Synaptic, I installed the Vodafone Mobile Connect software version 1.99.17 (search "vodafone") which also installed a few python packages. I know there's a beta 3 version 2.0 on the net, but I figured I'd go with the stable version given it claimed to have been tested with the E272.

The first time I launched the program (Applications -> Internet) I accidentally jiggled the USB connector and lost connection, and after that the program would hang on the first splash screen. I found the solution was to excecute
rm -rf ~/.vmc2
to remove any preferences files. After that, the software correctly recognized the modem as an E272, and everything works fine. I don't even need to reboot the Eee with the modem plugged in. The only problem seems to be that since I am dialing up with wvdial and bypassing the Ubuntu Network Manager, Firefox starts up in offline mode. It's not a real problem, I just change that and go.

That's pretty much it, it's a very light sturdy computer, it's not exactly as cheap as it was promised to be, but I feel a lot better carrying this around and the diminutive AC adapter than my MBP. It's running a full desktop OS (minus the bells and whistles) and does everything I need, with aplomb.