Linux on the Asus EeePC

Author: Michael Minn (see www.michaelminn.com for current contact info)

May 12, 2009

Describes how to set up an Ubuntu 8.04 operating system on a Asus EeePC subnotebook computer.

1. Introduction

This page describes how to install Ubuntu v8.04 on an ASUS Eee PC 1000HD, an inexpensive, highly portable subnotebook/netbook computer manufactured by Pegatron Technology, a manufacturing entity spun off by Asustek in 2007. The first models were introduced in 2007 in response to the One-laptop-per-child XO-1 and featured limited RAM and a solid state hard drive. Later models have expanded features while retaining the small form factor.

The 1000 HD model that I purchased in October of 2008 features:


2. Xandros

The EEEPC can be purchased with the Xandros distribution of Linux, which is fairly easy to use for casual and non-technical users. For those who need something more from life, it's a bit too brain-dead to be satisfying. Among the issues:

Therefore, I chose to wipe out Xandros and install the popular Ubuntu distribution instead.

There is a special release of Ubuntu called Ubuntu EEE that is customized with all the special drivers needed for the Eee PC. However, it uses the tabbed Netbook Remix interface (what's with all these kids and their damned tabs nowadays?!), so I don't recommend it.

BTW - if you are in Xandros and need a command-line X terminal, press CTRL-ALT-T to get an xterm.


3. Creating the Installation Media

Because the Eee PC does not have a CD-ROM drive and Ubuntu (as of this writing) only comes as a live CD image, you will need to create a bootable flash drive to install Ubuntu on the Eee PC.

While the process is not as trivial as doing a dd of the image to the flash drive (and I did try), it is fairly straightforward if you have access to a PC with a CD drive and fast Internet connection. If it's already a Linux PC, so much the better, although it can be a Windoze machine that you reboot with the Ubuntu live CD.

Download: the current Ubuntu release CD image ISO from Ubuntu.com.

Burn: if the machine you are using to create the flash drive is not a Linux machine, you will need to burn the ISO to a CD so you can boot the machine in Linux. Once burned, insert the Ubuntu CD in the drive and reboot. The machine will start Ubuntu from the disk. Start an xterm so you have a command line terminal to work with.

Install Syslinux: Syslinux is the program needed to create bootable media. It is not present on the live CD, but can be installed from the internet repository. The process also installs the mtools package.

	sudo apt-get install syslinux

Download ISOTOSTICK: Download the isotostick.sh script from www.startx.ro/sugar. This script (originally written by a guy from RedHat and tweaked for Ubuntu) handles the different commands needed to create the bootable flash drive. If you want to know all the steps, read the script or see the Ubuntu community installation page. BTW - this script works with ISOs from any vendor (CentOS, Fedora, etc).

Run the Script: Insert the flash drive in a USB port. If running on PC with Linux installed, run the script using the disk image ISO that you downloaded:

 
	sudo ./isotostick --reset-mbr ubuntu-8.04.1.iso

If you are running on a machine that is running Linux from the Ubuntu live CD, you can pull the image directly from the CD:

	sudo .isostick --reset-mbr /dev/cdrom

You can ignore warnings: "cp: failed to preserve ownership". The script will let you know when it's done.


4. Booting the Eee PC in Ubuntu and Installing

Insert the bootable flash drive in a USB port and start the Eee PC. I had some problems with the BIOS seeing the flash drive when rebooting, so you might be advised to boot with a cold start from poweroff rather than a reboot with the machine already running.

Press ESC on powerup to get a menu of acceptable boot devices. The USB drive should be on the list, which you can use the arrow keys to navigate and RETURN to accept your choice. Assuming the boot image can be read, you will see syslinux messages and a boot splash screen. The boot takes a couple of minutes.

Run the installer: There is an icon on the desktop that you can click to start the install. You can also select "Install" from the "System" dropdown menu at the top of the screen. You will be guided through a set of configuration screens:

	Language
	Time Zone
	Keyboard Layout

Prepare Disk Space: I chose the "Guided - Manual" option so I could have /home on a separate partition. This adds security and recoverability by segregating the system files from the user files and also makes future system upgrades easier. I deleted the existing partitions and chose this layout of primary partitions:

	hda1 /boot	ext2	131 MB (format)
	hda2 /		ext3	5000 MB (format)
	hda3 (swap)	swap	1019 MB
	hda4 /home	ext3	73871 MB (remainder of disk - format)

Who Are You: If you will be using this machine in unfamiliar environments where privacy is important, you may want to use something other than your real name as the "name" and "computer name"

Install: Hit return when promted to start the install, which took my system around ten minutes. Five minutes in you will get an error that you can ignore, "An attempt to configure apt to install additional packages from the CD failed".

Reboot: Restart Ubuntu and you should be able to boot from the hard drive rather than the USB stick.


5. Network Card Drivers

The nasty part about installing this particular version of Ubuntu (8.04) on this particular machine was that the wired and wireless network chips were fairly new and the kernel module device drivers are not included in the Ubuntu install image. Therefore, until Ubuntu catches up, the drivers must be downloaded using a separate PC with a working Internet connection.

Different models (and sometimes different versions of the same model) can have different chips even though there are no obvious physical or published difference between machines. Before attempting to set up these drivers, you should use the lspci command to verify that your particular machine has these particular chips.

Build Essentials: In order to compile kernel modules, you must have the build-essential package installed. Download the package to your hard drive and copy it to a flash drive for moving to the Eee PC.

packages.ubuntu.com/hardy/i386/build-essential/download (.deb file)

	dpkg -i build-essential_11.3ubuntu1_i386.deb

Ethernet Chip is an Atheros chip built by their Attansic subsidiary. It is listed in lspci as:

	03:00.0 Ethernet controller: Attansic Technology Corp. 
	        Unknown device 1026 (rev b0)

It is supported by the ATL1E driver (listed in lshw as the pcieport-driver, listed in dmesg at Atheros AR8121/AR8113 PCI-E Ethernet Adapter). Download the tweaked ATL1E driver code (.tar file) from esecuredata.com:

http://www.esecuredata.com/support/downloads/l1e.tar

...compile and install it:

	tar -xvf l1e.tar
	cd l1e*/src
	make
	sudo make install
	sudo depmod
	sudo modprobe atl1e

When the system is powered up while connected to a working ethernet port, the networking subsystem will automatically bring the interface up and get an IP address using DHCP. To bring the interface up manually:

	sudo ifconfig eth0 up
	sudo dhclient eth0

To manually configure the interface so it can be started with the "sudo ifup eth0" command, add the following line to the /etc/network/interfaces file:

        iface eth0 inet dhcp

Wireless: The Atheros AR242x 802.11b/g WiFi Wireless chip (aka the AR5007 series) is a bit tougher to set up. It is listed by lspci as:

	01:00.0 Ethernet controller: Atheros Communications Inc. 
        	AR242x 802.11abg Wireless PCI Express Adapter (rev 01)

Note that this is NOT the Ralink RT2860 used on other Eee PC's, which has Linux drivers available from the vendor. If you have that chip, driver installation is described HERE

The Atheros chip is supported by a version of the MadWiFi driver with tweaked hardware abstraction layer code (changed described here). As of this writing, the version of MadWiFi available in Ubuntu repositories or directly from the madwifi.org download page DO NOT WORK with this chip. Download the special snapshot:

madwifi-hal-0.10.5.6-r3861-20080903.tar.gz

Download, decompress, compile and install:

	tar -zxvf madwifi-hal-0.10.5.6-r3861-20080903.tar.gz
	cd madwifi*
	make
	sudo make install
	sudo depmod
	sudo modprobe ath_pci
	ifconfig

The iwconfig command should show the network interface as ath0:

	lo        no wireless extensions.

	eth0      no wireless extensions.

	wifi0     no wireless extensions.

	ath0      IEEE 802.11b  ESSID:""  Nickname:""
        	  Mode:Managed  Channel:0  Access Point: Not-Associated   
	          Bit Rate:0 kb/s   Tx-Power:0 dBm   Sensitivity=1/1  
        	  Retry:off   RTS thr:off   Fragment thr:off
	          Power Management:off
        	  Link Quality=0/70  Signal level=0 dBm  Noise level=0 dBm
	          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
        	  Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Similarly, the ifconfig command should show the interface:

	ath0      Link encap:Ethernet  HWaddr 00:15:af:ca:26:05  
        	  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        	  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:0 
        	  RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

	lo        Link encap:Local Loopback  
        	  inet addr:127.0.0.1  Mask:255.0.0.0
	          UP LOOPBACK RUNNING  MTU:16436  Metric:1
        	  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
        	  collisions:0 txqueuelen:0 
	          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

	wifi0     Link encap:UNSPEC  HWaddr 00-15-AF-CA-26-05-00-00-00-00-00-00-00-00-00-00  
        	  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	          RX packets:1050 errors:0 dropped:0 overruns:0 frame:54
        	  TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:280 
        	  RX bytes:101312 (98.9 KB)  TX bytes:658 (658.0 B)
	          Interrupt:18 

FYI - the additional wireless device named wifi0 or wmaster0 is a virtual device that is used by madwifi and is not a usable network interfaces.

If the interface is not there, check the output of dmesg system log listing command. If you see a HAL error 13, you do not have the right version of the MadWiFi driver:

	wifi%d: unable to attach hardware: 'Hardware revision not supported' (HAL status 13)

If you get a HAL erro 3, you probably had another version of the HAL running and you will need to reboot.

	MadWifi: unable to attach hardware: 'Hardware didn't respond as expected' (HAL status 3)

Further installation and troubleshooting info is available from the MadWiFi Wiki

Reboot. The driver should be started automatically during the boot process and the interface be visible in iwconfig. You can use one of the standard graphical wireless network selection utilities to select an access point to connect to. Or, if you're old-school, you can use the command line. ifconfig starts the interface and iwlist shows the available networks:

	sudo ifconfig ath0 up
	sudo iwlist ath0 scan

When you find an ESSID you'd like to connect to, set up the interface to use it and then call dhclient to connect and get an IP address:

	sudo iwconfig ath0 essid <essid>
	sudo dhclient ath0

If you use a specific ESSID regularly, you can add an entry for it to the /etc/network/interfaces file (replace ESSID with the name appropriate to your network):

	iface ath0 inet dhcp
	wireless-essid ESSID

Then the network interface can be started simply with the ifup command

	sudo ifup ath0

Encrypted Connections - WEP: When accessing wireless networks with that use the older (and less secure) Wireless Encryption Protocol (WEP), you can set the passphrase from the command line using iwconfig, AFTER you have loaded the wlan_wep module. If you attempt to set the key without loading the wlan_wep module, you will get an "invalid argument" message:

	modprobe wlan_wep
	iwconfig wlan0 key s:<passphrase>

Encrypted Connections - WPA: When accessing wireless networks that use the more advanced WPA protocols, you will need to start the wpa_supplicant daemon prior to bringing the interface up and getting an IP address from the DHCP server. Because there are so many steps, I put the commands in a script listed below. Replace ESSID and PASSPHRASE with the values appropriate to the secure network you are trying to access.

	ifconfig ath0 up
	iwlist ath0 scan
	wpa_passphrase "ESSID" PASSPHRASE > /tmp/wpa_supplicant.conf
	chmod 0640 /tmp/wpa_supplicant.conf
	wpa_supplicant -Bw -Dwext -iath0 -c/tmp/wpa_supplicant.conf
	dhclient ath0

6. TrueType Fonts

The X window server contains native support for TrueType (tm) fonts, although installing them via the command line is a bit more cumbersome than with an installer program or package. If you've got some on a Windoze box, TrueType fonts tend to look quite a bit better than the fonts that come with the distributions. And if you're doing any web development, you need them to have at least a guess as to what your pages look like on a Windoze box.

Unfortunately, the FontPath configuration that specifies the directories where fonts are located is compiled into the X binary and is not configurable. While "xset +fp" can add a directory to the font path, that setting is not permanent and is lost when you reboot. xset cannot be added to a local configuration file like .xinitrc. This is not a problem for newer applications that use fontconfig, but this may represent an issue for older applications that only use the X font paths. The kludge is to copy the fonts you want to add into one of the configured truetype font directories.

Copy the fonts into a shared font directory: You can do an "xset -q" to find the configured Font Paths for your X configuration:

	xset -q

Chose one of the directories listed in "Font Path" and copy your .ttf font files into that directory. In my case, I chose to use /usr/share/fonts/X11/misc. While you could create a new directory under /usr/share/fonts, fonts installed there would not be visible to xlsfonts or older X applications.

	sudo cp your-fonts/*.ttf /usr/share/fonts/X11/misc

Then run mkfontscale to create the fonts.scale file and mkfontdir to create the fonts.dir files used by the X server. You should also change the owner of all the files to root to avoid permission problems. The mkfontscale and mkfontdir steps are critical if you want to be able to list your fonts with xlsfonts or other legacy X applications.

	cd /usr/share/fonts/X11/misc
	sudo mkfontscale
	sudo mkfontdir
	sudo chown root:root *

You can check to verify the fonts are loading by starting an X application (like gimp). The xlsfonts command lists fonts available directly from X and the fc-list command lists fonts available through fontconfig.

	xlsfonts | less
	fc-list | less

The listing will likely be long, but if the fonts are loading correctly, you will see X font names like these (for Arial and Garamond, respectively):

	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-1
	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-10
	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-15
	-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-2

	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-1
	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-10
	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-15
	-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-2

7. Video Monitor

There is a 15-pin VGA socket on the right side of the machine that can be used to connect an external video monitor or projector. Usually the monitor will communicate with the card and adjust everything accordingly so connection is plug-and-play. If the monitor resolution is greater than the LCD, the automatic adjustment may expand the resolution beyond the height of the LCD display. The external monitor will be fine but the LCD display bottom will be cut off.

You may need to use the xrandr command to tweak the X rotate and resize extension. xrandr with no arguments will give a list of acceptable modes for the LCD display and any connected external monitors:

	Screen 0: minimum 320 x 200, current 1024 x 600, maximum 1024 x 1024
	VGA connected 800x600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
	   1024x768       60.0 +   75.1     70.1     60.0     43.5  
	   832x624        74.6  
	   800x600        72.2*    75.0     60.3     56.2  
	   640x480        75.0     72.8     66.7     60.0  
	   720x400        87.8     70.1  
	LVDS connected 1024x600+0+0 (normal left inverted right x axis y axis) 220mm x 129mm
	   1024x600       60.0*+   65.0  
	   800x600        60.3  
	   640x480        59.9  
	TV disconnected (normal left inverted right x axis y axis)

LVDS is the Eee-PC's LCD display. VGA is the external device. If you have no device connected, you will not get a listing of VGA modes.

If you are getting no external video, you may need to manually set the output mode. The xrandr man page describes the options. For example, to set the output mode to 1024x768:

	xrandr --output VGA --mode 1024x768

8. Installation Tweaks

Update Your Package Repository: Once you get the machine on the internet, you should update your application package repository with a list of the latest security patches and repository updates. This may take a few minutes.

	sudo apt-get update

External Mouse: The touchpad on this machine is a bit difficult to use because of the small size of the machine and the unusually stiff mouse buttons. If you are going to be using this machine for an extended period of time in a fixed place, you should seriously consider getting an external USB mouse. They are truly plug-n-play since the X windows system automaticallly detects and enables them.

Low Speaker Volume: The speakers in this machine are not very powerful, but you will need to use the alsamixer or some other ALSA-enabled mixer program to set the volume so that audio is at least audible. There is no volume knob anywhere on the machine. Type "alsamixer" at a terminal to start alsamixer with curses interface. Use the arrow keys to adjust the controls. You will need to adjust THREE controls to get maximum volume: Master, PCM and Front.

Poweroff Problem: When powering off Ubuntu, this machine does not actually halt, but seems to stay in standby mode with the blue power light staying on. This can be fixed by adding the following line to your /etc/init.d/halt script somewhere in the do_stop() function.

	rmmod snd-hda-intel

It removes an ALSA sound module before halting. Not sure why this causes the poweroff to hang, but it works.

Flash Player: The Adobe Flash Player is pretty much essential for anything other than the most cursory web browsing nowadays. Firefox can handle the download and installation of the Flash player by itself. When navigating to a website with a Flash object, it will ask you if you want to install the plugin. You can also actively initiate installation from the Tools -> Add Ons dropdown in Firefox.

Turning off Unnecessary Services: By default Ubuntu turns on a number of services at boot time that you may not need. Disabling unneeded services increases system security and decreases boot time.

Services are turned on by links in the various /etc/rcX.d directories that point to scripts in the /etc/init.d directory. /etc/rc2.d has links to scripts that are run during the single user mode phase of the boot and /etc/rc5.d has links to scripts that are run during an X windows boot. /etc/rcS.d has links to scripts run regardless of boot level. You can change a prefix from an 'S' to a 'K' to disable a service.

Below are the services I turned off in /etc/rc2.d:

Below are the services I turned off in /etc/rcS.d:

Laptop Mode Disk Spindown Problem: The kernel provides a feature called "laptop mode" that groups disk writes and spaces them chronologically so that the hard drive can spin down periodically and reduce the use of battery power. There is a bug with some drives where the SMART (Self-Monitoring, Analysis and Reporting Technology) settings are too aggressive, causing the drive to spin down and park too quickly, resulting in unnecessary additional disk cycles (up to 1000 a day) that reduce drive life. I'm not sure if this particular machine is affected, but I chose to just disable laptop-mode by turning off the service (S99laptop-mode) that enables it...see above.

Removing Splash Screen. I prefer to see what's going on with my machine rather than have the boot messages hidden behind the splash bitmap. Unlike RedHat, which provides a runlevel 3 text login, Debian distribution runlevels always start the GUI. So the process is a bit more complicated than changing /etc/inittab (which doesn't exist in Debian).

The splash screen is started by GRUB (the Grand Unified Boot Loader). To disable it, as superuser edit /boot/grub/menu.lst and change:

	# defoptions=quiet splash

	to

	# defoptions=

Also, further down in the file in the menu options, remove the "quiet splash" from the end of the "kernel" line and remove the "quiet" line, changing:

	title  Ubuntu 8.04.1, kernel 2.6.24-19-generic
	root   (hd0,0)
	kernel /vmlinuz-2.6.24-19-generic root=UUID=xxxx ro quiet splash
	initrd /initrd.img-2.6.24-19-generic
	quiet

...to this...

	title  Ubuntu 8.04.1, kernel 2.6.24-19-generic
	root   (hd0,0)
	kernel /vmlinuz-2.6.24-19-generic root=UUID=xxxx ro
	initrd /initrd.img-2.6.24-19-generic

Then, as superuser run the update-grub command to update the grub binary from the changed configuration file.

	sudo update-grub

Text Login the graphic login screen is started in runlevel 2 at boot time by the gdm script. Disable it by changing the S to a K:

	sudo mv /etc/rc2.d/S30gdm /etc/rc2.d/K30gdm

After these changes, on boot you will see the system startup messages and then be greeted with a console login prompt. After logging in, you can use the startx command to start the graphical desktop.

	startx

If you get an "X: user not authorized to run the X server, aborting" error message at startx, you need to change permissions on X so it runs as superuser:

	sudo chmod 6755 /usr/bin/X 

When you first do a text login, you are greeted with a rather austere and legalistic Message of the Day. To change it, you can edit /etc/motd.tail.

Removing the Desktop: If you're hard core command line and don't want the clutter and delay of the Ubuntu desktop, you might consider getting rid of the desktop altogether and just using a window manager to manage xterms and X applications started from the xterms. This will speed your boot time a bit and get rid of some annoying background daemons. I've used the venerable Motif Window Manager (MWM) for a number of years. It comes in the motif-clients package. Do not use the alternative lesstif package, which lacks some features.

	sudo apt-get install motif-clients

.xinitrc is a file that is executed when X is started. Create a .xinitrc in your home directory (/home/<username>) and type the following lines. This creates a single terminal window, puts a clock window at the bottom of the screen, sets the "desktop" color to blue and starts the window manager. When you type "startx", from the text login, it will start an xterm, in which you type commands to start other programs. You can create additional terminal windows from a popup menu when you right-click on the desktop.

	xterm &
	xclock -d -update 1 -face Helvetica-10 -geometry -1-1 &
	xsetroot -solid navy
	exec mwm

Flash Drive in fstab: If you get rid of the desktop, you will also lose your automount daemon and pluggin in a flash drive won't automatically mount it. However, you can add this line to your /etc/fstab file to preconfigure a mount point and enable non-superuser mounting:

	/dev/sdb1	/mnt/flash	vfat	noauto,user,exec	0	0

Create the mountpoint:

	sudo mkdir /mnt/flash

After inserting a flash drive, type the following to mount it:

	mount /mnt/flash

Before removing the flash drive:

	umount /mnt/flash

Additional Packages: The additional packages you install will, of course, depend on your specific needs. I find the default Ubuntu install to be surprisingly complete, but below are some additional packages I needed. The packages are installed with apt-get:

	sudo apt-get install <package_name>

We must, between periods of digging in the dark, endeavour always to transform our tears into knowledge. (Arthur Schopenhauer)