Installing ArchLinux on the Eee PC 4G

07/11/2012 by Sylvain Hallé

Eee PC 4G

My trusty Eee PC 4G has been my only laptop and my travel computer for years. I brought it with me on a zillion trips from Australia to Finland's Arctic Circle: that thing is just indestructible. Pedigree of the beast:

However, these modest performances means it has always somehow choked running Windows XP, and I had to use my imagination to cramp what I needed on its tiny (4 GB) solid-state drive. With an upcoming trip abroad and the wish to travel light, I decided it was time to revamp it and try one of these "lightweight" Linux distributions.

There exist a few distributions such as SliTaz or Puppy Linux that are very lightweight… but perhaps too much, in terms of available packages. Ultimately, my choice fell on ArchLinux, that has a small core install but can grow to become a fully-featured desktop OS on par with Ubuntu and friends. Here are the detailed instructions I followed to get Arch up and running on my Eee; this page is more meant as a reminder for myself, but feel free to use it if it is of any help to you.

You should not try these instructions unless you have at least minimal knowledge of Linux (folder structure, devices, mount points, permissions, etc.). However, if you do know those base concepts, installing ArchLinux turns out to be a good way to learn about the internals of a Linux operating system.

Some of these instructions are direc copy-paste from the official Arch install guide; however, I added things in some places and changed the order of some steps, so that this document is self-contained. For more info, refer to the basic instructions for an EeePC install.

Boot from USB

Create a bootable USB stick. Press Esc repeatedly at boot time to be shown the boot menu, and select the USB stick. You boot at a command line (yikes!).

Create the partitions

The Eee's internal hard drive is /dev/sda. Wipe everything there and then create one partition, which will be called /dev/sda1. The following instructions show how to create an ext2 partition using fdisk. We choose ext2 as the file system because of its absence of journaling, thereby saving the Eee's SSD from extra write cycles.

Open fdisk:

fdisk /dev/sda

In fdisk, type n (for new partition), p for primary, 1 to create the first partition, and the default values for first and last sector (don't type anything, just press enter). Then make the partition bootable by typing a and selecting partition number 1 (the one you just created). Type p to show the information; you should see something like this:

   Device Boot      Start        End      Blocks    Id  System
/dev/sda1   *        2048    8388607     4193280    83  Linux

Then press w to write the changes to the hard drive.

Those steps only created the partition, but did not lay out the file system itself. Back on the command line, type

mkfs.ext2 /dev/sda1
to create the ext2 filesystem.

Mount the partition

Simply:

mount /dev/sda1 /mnt

Install the base system

Make sure you are connected to the Internet. If you have a cable this should be as simple as plugging it in. There are instructions if you want to use a wireless connection, but cable is much simpler.

Use pacstrap to install the base system. This will roughly download a bunch a things (including the GRUB bootloader) and put it on your hard drive using the well-known Linux directory structure (/etc, /home, /var, etc.).

pacstrap /mnt base base-devel grub-bios

Generate fstab

The system does not yet have the /etc/fstab file that says what partitions to mount where at boot. Generate a first version of that file using:

genfstab -p /mnt >> /mnt/etc/fstab

chroot and configure

Chroot into the system:

arch-chroot /mnt

From now on, you are "into" the system with directory /mnt being used as the root. We then mostly follow the instructions in the Arch documentation.

Configure GRUB

There are multiple options, I only detail the one I used. We assume the package grub-bios is already install (this is supposed to be done with the pacstrap instruction we typed earlier). Then type this:

modprobe dm-mod
grub-install --target=i386-pc --recheck --debug /dev/sda
mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Generate a configuration for GRUB2:

grub-mkconfig -o /boot/grub/grub.cfg

If you want to change GRUB's configuration (such as use the Eee PC's custom kernel at boot), see the instructions later on.

Install a few last packages before reboot

For the Eee PC, install:

pacman -S wireless_tools netcfg

First boot

If you are still in the chroot environment type exit or press Ctrl+D in order to exit. Earlier we mounted the partitions under /mnt. In this step we will unmount them:

umount /mnt

Then reboot:

reboot

If everything went well, you should see the GRUB menu, and then boot to a command line as root. Congratulations! You have a Linux system up and running.

Update repositories for pacman

To sort mirrors in the mirror list by speed one may use rankmirrors. Faster mirrors will dramatically improve pacman performance, and the overall Arch Linux experience. In a nutshell:

cd /etc/pacman.d
cp mirrorlist mirrorlist.backup
rankmirrors -n 6 mirrorlist.backup > mirrorlist

The last command takes a while to execute, as it tests every mirror repository.

Add a non-root user

Type:

adduser

You will be asked to enter some information in an interactive way:

Login name for new user []: archie
User ID ('UID') [ defaults to next available ]:
Initial group [ users ]:
Additional groups (comma separated) []: audio,games,lp,optical,power,scanner,storage,video,wheel
Home directory [ /home/archie ]:
Shell [ /bin/bash ]:
Expiry date (YYYY-MM-DD) []:

The additional groups are important. This diverges from the official instructions as I also add the user to the group wheel. This will be important if you want to use sudo later on. Here is the list of possible groups.

Install X

Command line is nice, but we could use a graphical environment. Install Xorg with:

pacman -S xorg xf86-input-keyboard xf86-input-synaptics xf86-video-intel

The last two packages are Eee-specifics: the first manages the trackpad, and the second the video driver.

Then install the base packages:

pacman -S xorg-server xorg-xinit xorg-server-utils mesa

If you are not installing to the Eee PC, find out your video driver with:

lspci | grep VGA

As a fallback, you may always install xf86-video-vesa as a generic driver.

To install in VirtualBox:

Then install a basic window manager to check that X indeed starts:

pacman -S xorg-twm xorg-xclock xterm

Remove the file .xinitrc, if any is installed in your home folder. Then install the message bus and start its daemon:

pacman -S dbus
rc.d start dbus

Make sure the daemon is started at boot by editing /etc/rc.conf, and adding dbus in the list of daemons:

DAEMONS=(... dbus ...)

Then start X:

startx

You should see something like this:

Screenshot of twm

Install LXDE

twm is nice, but for a full-featured, yet lightweight desktop environment, we will install LXDE an "an extremely fast-performing and energy-saving desktop environment", "especially designed for cloud computers with low hardware specifications, such as netbooks".

pacman -S lxde gamin obconf
mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/menu.xml /etc/xdg/openbox/rc.xml /etc/xdg/openbox/autostart ~/.config/openbox

Then, configure X so that the startx command loads LXDE. To do so, open the file ~/.xinitrc and write:

exec ck-launch-session startlxde

Run X again to check that it works:

startx

You should see something like this:

Screenshot of LXDE

Install LXDM

At the moment, the login process at boot is still handled through the console; X is only started once you are logged in. We will use LXDM as the (lightweight) display manager to have GUI login. LXDM is already installed per the previous instructions. You must set it up so that it starts at boot:

  1. Edit /etc/inittab and find the line that looks like this:
    id:3:initdefault:
    and modify the 3 for a 5
  2. Add the line
    x:5:respawn:/usr/sbin/lxdm >& /dev/null
    at the very end (and comment out any similar lines that may not be)
  3. Add the line
    xt:5:wait:/usr/bin/chvt 7
    if you don't want to see the text login prompt for a split-second at boot (this is mostly cosmetical)

Change keyboard layout

Edit ~/.xinitrc and add:

setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll ca
where ca can be replaced by your layout. (NOTE: "ca" is actually the (good) French-Canadian layout; there is no "cf" as one would expect.) Restart X to effect the changes.

Install screensaver

Warning: this step consumes 150 MB of hard disk. First install the packages:

pacman -S gnome-screensaver gnome-session

Then create file ~/.config/autostart/gnome-session.desktop and add:

[Desktop Entry]
Exec=/usr/bin/gnome-session

Log back in to effect the changes.

Setup sudo

<

p>If you're used to Ubuntu, you may miss sudo. Install the sudo package to regain this functionality. For users to be able to run the command, they must be in the /etc/sudoers file. Normally you should not edit this file directly, but the change we do is minimal, so just open it, locate and uncomment the line:

%wheel      ALL=(ALL) ALL

This allow members of group wheel sudo access (remember the group wheel in our earlier setup). Make sure you add yourself to the group wheel. Finally, remember that sudo wants your password, not root's!

By now, you have pretty much a vanilla Linux booting the graphical LXDE environment by default. From then on, the rest of the setup is mostly similar that what you would do in other Linuxes.

Spare the Eee's SSD

Enable hotkeys

Instructions on the Arch Linux page don't work. Don't install those packages. Here are instructions to manually implement hotkey functionality.

Toggle VGA out (Fn+F5)

  1. Download sh-cycle-display.sh and sh-set-display.sh and copy to /usr/local/bin
  2. In ~/.config/openbox/lxde-rc.xml, add to the <keyboard> section:
     <keybind key="XF86Display">
       <action name="Execute">
         <execute>sh-cycle-display.sh</execute>
       </action>
     </keybind>
    

Volume controls (Fn+F7/8/9)

  1. Download volume.sh (this is an Eee-customized version of this script) and copy to /usr/local/bin
  2. In ~/.config/openbox/lxde-rc.xml, add to the <keyboard> section:
     <keybind key="XF86AudioMute">
       <action name="Execute">
         <execute>volume.sh mute</execute>
       </action>
     </keybind>
     <keybind key="XF86AudioLowerVolume">
       <action name="Execute">
         <execute>volume.sh down</execute>
       </action>
     </keybind>
     <keybind key="XF86AudioRaiseVolume">
       <action name="Execute">
         <execute>volume.sh up</execute>
       </action>
     </keybind>
    

Windows key + Run dialog

Like above:

 <keybind key="Super_L">
   <action name="Execute">
     <execute>lxpanelctl menu</execute>
   </action>
 </keybind>
 <keybind key="A-F2">
   <action name="Execute">
     <execute>lxpanelctl run</execute>
   </action>
 </keybind>

Useful packages

First install yaourt to be able to install packages from the ArchLinux User Repository (AUR). In /etc/pacman.conf, add:

[archlinuxfr] 
Server = http://repo.archlinux.fr/$arch
and then run
pacman -Sy yaourt

Tweak Gimp to run on a netbook

Instructions here

Quirks

No sound with Linux stock kernel?

Despite the volume being at 100%, you don't here anything. It is just that the individual volume for speakers is set at 0. Open alsamixer, travel to the Speaker tab and raise the volume.

comments powered by Disqus

Navigation