box.matto.nl

home/

Roll your own 100% silent GNU/Linux workstation from an USB pen

Last edited

Build your own silent Linux machine

Linux is a very versatile operating system. Many high performance systems are build on a Linux OS. However, Linux can bring life to a low end machine. This way you can build your own silent Linux computer!

Running Linux from an USB pen on an EPIA motherboard results in a 100% silent workstation

photo of Epia board

Run a GNU/Linux workstation from an USB drive

I use a cheap 128 Mb USB pen (just € 10) to boot GNU/Linux from. It is a X workstation, the windowmanager of my choice is ratpoison.

The motherboard I use is a Via EPIA ME6000. For more information on this board, see my VIA EPIA ME6000 LVDS Mini-ITX-page. This board is 100% silent (no fans) and it requires very little power. Therefor it can be powered from an 100% silent power-supply. So by eliminating the use of hard disks, the USB pen boot makes it possible to have a totally silent workstation.

The processor on the EPIA ME6000 runs at 600 MHz, so this is no board to edit DVD's on. For my daily use however, it is totally sufficient.

My typical use of this workstation is to have some terminal-windows (I use rxvt for this) and a graphical webbrowser for the occasional view of websites (I use firefox for this, most of the time however, I use elinks - a text mode tabbed browser).

Occasionally, when I have to do things that require many resources, I boot up a more powerful workstation, but most of the time this EPIA USB pen driven machine is more then enough, saving a lot of electric power and being totally quiet as a great benefit.

Creating a Linux bootable USB pen (memory stick)

It is not difficult to create a bootable USB pen and install Linux on it. You too can run GNU/Linux from a USB pen drive. All it takes is an USB memory stick that you can boot from, and some work installing GNU/Linux on it.

Build a silent Linux workstation in 4 steps

Here are the steps to create a bootable USB pen running Linux:

  • Partition the USB pen
  • Build a small bootable image
  • Get it running
  • Install additional applications

Below follows the outline how to build a bootable USB pen X workstation like I did. Maybe this can help you to get your own workstation running from an USB memory stick or inspire you to build some silent Linux system. If you have any questions, feel free to contact me (please use GPG to ensure your mail will pass my spamfilter).

Partitioning scheme of the USB pen

When the system boots up from the USB pen an image is loaded into ramdisk. This constitutes the main system. Because this main system runs in ramdisk, it is very responsive. The bigger this image is, the longer the time it takes to boot. (Booting from USB pen is rather time consuming.) Therefor I have added a second partition, which will be mounted after the initial load of the ramdisk.

This is my current setup:

Disk /dev/sda: 126 MB, 126353408 bytes
32 heads, 32 sectors/track, 241 cylinders
Units = cylinders of 1024 * 512 = 524288 bytes
Device Boot    Start       End    Blocks   Id  System
/dev/sda1   *           1          24       12272    4  FAT16 <32M
/dev/sda2              25         241      111104   83  Linux
  • /dev/sda1
    The first partition is loaded as the initial ramdisk and mounts to /
  • /dev/sda2
    The second partition is mounted to /usr/X11R6

Building the system

Download busybox, build it, after this there is a directory called _install. Add a complete directory-hierarchy to this and populate /dev with the appropriate devices. Don't forget to add a /proc directory. Also add sshd and some startup-script that loads the required modules, setup the network and starts sshd.

Build a compressed image from the _install-tree:

  • dd if=/dev/zero of=my_image bs=1k count=18000
    This builds an empty image of 18 Mb
  • mkfs.ext2 my_image
  • mount -o loop my_image /mnt
  • cp -Rpfd _install/* /mnt/
  • umount /mnt
  • gzip -9 my_image

Create a small partition on the USB pen, FAT16 and make it bootable. Remove the USB pen from your system and put it back in. (Some USB pen models require this last step.)

Add a syslinux.cfg file to this partition:

cat syslinux.cfg 
default vmlinuz root=/dev/ram0 initrd=image.gz
append PSLEEP=25 ramdisk_size=24000 vga=0x307


and run syslinux on this partition:

syslinux /dev/sda1

Copy the image to this partition and name it image.gz, and add a kernel to this partition, name it vmlinuz.

Boot from this USB pen and resolve any problems.

Expand the _install-tree with applications.

Preparations for using shared libs:

  • Copy ldd and ldconfig to the _install-tree.
  • Create a /etc/ld.so.conf in the _install-tree.

Copy the required application to the _install-tree. It never hurts to strip it first:

strip /path/to/application/application

then add it to your tree:

chroot _install
ldd /path/to/application/application 

Check for missing libs (grep "not found"). Exit the chroot, add the libs, chroot again and run ldconfig.

After adding the required application, create the image.gz again and copy it to your USB-pen (replace the former image.gz). You don't have to run syslinux again. Boot from the USB pen, test and repeat until everything is satisfactory.

Adding a second partition

You can add a second partition, where you can store more libs and applications. Everything that is needed to boot must be in the compressed image, all other stuff can go here. First think where you will mount this second partition to. I used /usr/X11R6, but e.g. /usr/local could also be a good option.

Make this second partition an ext2 partition. The number of writes to the memory of the USB pen is limited (typical a few thousand times) so you don't want a journaling filesystem (like ext3). I mount my second partition read-only just to be sure.

Setting up X

To keep everything small, I don't use xinit and no big windowmanager. I first start Xvesa with a xterm. From this xterm I start ratpoison:

# ls -l /usr/X11R6/bin
-rwsr-sr-x    1 root     1000       768860 Apr 21 10:40 Xvesa
-rwxr-xr-x    1 root     root        21935 Apr 21 11:07 ratmenu
-rwxr-xr-x    1 root     root       107012 Apr 21 11:07 ratpoison
-rwxr-xr-x    1 root     root       132396 Apr 21 19:58 rxvt
-rwxr-xr-x    1 root     root           91 Apr 22 08:42 startx
-rwxr-xr-x    1 root     1000        32636 Apr 21 10:40 xauth
-rwxr-xr-x    1 root     root        10080 Apr 22 09:22 xhost
-rwxr-xr-x    1 root     root        22380 Apr 21 20:01 xrdb
-rwxr-xr-x    1 root     1000         4688 Apr 21 10:40 xsetpointer
-rwxr-xr-x    1 root     root        11728 Apr 21 20:00 xsetroot
lrwxrwxrwx    1 root     root            4 Apr 22 12:39 xterm -> rxvt

Xvesa don't uses a config-file, configuration is done through the command line switches. This I do in startx:

# cat /usr/X11R6/bin/startx 
/usr/X11R6/bin/Xvesa -screen 1280x1024x24 -mouse /dev/input/mice,4 &
/usr/X11R6/bin/xterm

Being a heavy GNU Screen user, I have found ratpoison to be a great windowmanager for me. You can choose another windowmanager off course, go for the smallest footprint and least memory-hungry manager.

Firefox

I got lazy and copied the firefox-tree from a Slackware 10.2 install to /usr/X11R6/lib. After adding the appropriate libs, and adding /etc/gtk-2.0, /etc/pango and /etc/fonts (all just plain copies from the Slackware 10.2) and some fonts (I used the 75dpi directory from the Slackware install) firefox can be used. (it complains about some font-conversions at startup, but it runs OK).

Other applications

On my 128 Mb USB stick there is still plenty of space, so more applications can be added. If you go for a larger USB pen (like 512 Mb), then your system can be populated with more applications then you will probably use.

So for you too it is possible to run a completely silent workstation.