Title Silent PC
Status Completed
Start Date 8-2003
End Date 12-2003

The Silent PC HOWTO






	A silent computer is definitely a pleasure to own. You can leave
it on all the time so it is always ready for use, it consumes much less
power than other computers, and you won't be distracted by noise. There
are a few feasible strategies for making a silent computer. One is to use
embedded devices, but this doesn't really count as a PC. Another way is
to use water cooling, but this doesn't address the hard drive issue.

Hardware
	With VIA's release of the C3 motherboards and the steady drop in ram
prices, it is now possible to make a very useful, totally silent computer for
under $300. Here are the parts that I used:
- VIA C3 ITX Motherboard 533MHz		$100 from axiontech.com
- Cubit Case				$70 from axiontech.com
- 512MB PC133 DIMM RAM			$30 from pcboost.com
- 256MB Sandisk Compact Flash Card	$50 from staples
- CF to IDE adapter			$20 from mesanet.com
- Linksys 2port KVM Switch (optional)	$30 from newegg.com
- Temporary Hard Drive			$0 borrowed from old computer
My total cost was $300. The motherboard was selected because the built-in
processor is passively cooled. Warning: VIA advertises this motherboard as 
capable of supporting 1GB of RAM, but the chipset has a bug, and it can
only handle 1 512MB PC133 stick. I heard that someone got 1GB by using
PC100 sticks, but I can't confirm this. It comes with a heat sink installed and
it requires no additional fans. The case comes with an external laptop style power
supply that also has no fan.
	The idea is to install linux and any desired programs to a partition on
the hard drive, just as if you were setting up a normal system, and then create
an image of the root filesystem from that partition and load it into a ramdisk
to get silent operation. Properties : cant save (lose on reboot) can ssh -X.

Preparing the Hard Drive
	The easiest way to build the root filesystem image is to have two free
sectors on the hard drive. The larger one will contain a full installation of
linux and the smaller one will be used as the source for the root filesystem
image, and will have a minimal linux installation. I used the Debian network
install CD to install to both partitions. On the smaller one, I opted not to 
run dselect at the end of the installation so that only the base system was
copied. The Debian base system took up about 67MB including some apt cache
that could be deleted. The second OS installation will overwrite the first
OS's boot sector, which will prevent you from booting to the first partition.
To fix this, edit /etc/lilo.conf and copy the block correspoding to the newly
installed partition, but add the line 'root=/dev/hda1' after the image= line if
for example the first OS partition is 1. In order to easily switch between 
installations, uncomment 'prompt' so that a menu will appear at boot time.
Then type 'lilo' to write the changes in lilo.conf to the boot sector.

Creating the Root Filesystem
	To create a useful system with X windows and programs like a web browser
and a text editor, I used "apt-get install ". Before this is run, you
have to add an apt source to /etc/apt/sources.list by adding the line
'deb ftp://ftp.debian.org/debian stable main contrib non-free'
and the run 'apt-get update' to download package lists. The packages I chose to
install were:
{ssh,wget,xserver-xfree86,xfonts-base,fluxbox,aterm,xfonts-75dpi,libgtk1.2,
gcc,make,libc6-dev,xlibs-dev,gaim,xmms,nedit,ftp,xloadimage,bzip2,lsof}
And I used wget to obtain Mozilla Firebird and Macromedia FlashPlayer.

Configuring X
	It took some work to get X running. Debian's install did not 
autoconfigure the video card, so I had to hack the /etc/X11/XF86Config-4 
file manually.
	
If you are using a KVM, and have installed gpm, you may experience ramdom 
motion of the mouse cursor. To prevent this, type 'gpm -k' at a terminal to 
kill the console mouse daemon. This will fix the problem until the next
reboot. To fix it premanently, uninstall gpm.
	Do any configuration of your workspace now, because there won't
be any way to save changes after the root filesystem snapshot is taken without
taking a new snapshot. In fluxbox, I configured the menu

	Once the filesystem was complete, I deleted the apt cache files from 
/var/cache/apt/archives to save space, and deleted /root/.bash_history for 
cleanliness. Then with the filesystem frozen, I ran 'updatedb' so that I 
could use locate.


Setup
Boot to first partition to create the root filesystem image:
	dd if=/dev/zero of=rootfs bs=1k count=358400
	mke2fs rootfs
	mount -o loop rootfs /initrd
	mount /dev/hda2 /mnt
	cp -a /mnt/* /initrd/
	[edit /initrd/etc/fstab and change /dev/hda2 to /dev/ram1 ]
	umount /initrd
	umount /mnt

	Next, write the root filesystem image to the boot medium in 
	compressed form:
	mount /dev/hdc1 /mnt
	gzip -c rootfs > /mnt/rootfs.gz

The kernel can not copy large ramdisk images into ram. This is 
probably something that could be changed in future versions of the kernel.
 As for linux kernel 2.2, we can bootstrap a large ramdisk by first booting
 a small one (4MB).
	[create initrd - then copy something like the linuxrc in the download to its root]
	gzip -c initrd > /mnt/initrd.gz
	
Finally, setup the boot sector on the boot medium with lilo:
	[edit /mnt/etc/lilo.conf - be sure to use the version from
	the second installation so that it has boot=/dev/hdc ]
	Add entry before others: 
	image=/vmlinuz
		root=/dev/ram0
		initrd=/initrd.gz
		append="boot=/linuxrc"
	lilo -C /mnt/etc/lilo.conf
	umount /mnt
	reboot, change BIOS to boot to compact flash

When the system starts booting, it will first copy the 4MB initial ramdisk
into /dev/ram0, then run /linuxrc from that ramdisk. This script/program will
copy the large root filesystem image into /dev/ram1. This part will probably
take a minute or two. Then linuxrc does a chroot call so that the root
filesystem image becomes the root for the system and normal booting commences.

When booting this way, init does not go into the si entry in /etc/inittab, 
so on a normal system this means it won't run /etc/init.d/rcS. You can hack
the init scripts to force it to run this script, but I found that the only
important thing is that it sets the PATH environment variable. So I copied
the PATH= line and the 'export PATH' line to /etc/init.d/rc so that it would
set them when it enters runlevel 2 upon booting.