Sunday, December 28, 2008

Done with Yellow Dog Linux

After using Yellow Dog 6.0 for a couple of months on my iBook G4, I tired of it, and sold the iBook. It worked fairly well, but I got tired of using gnash as a Flash substitute: too many sites require Flash these days. And it was noisy: the fan control was overzealous, which is probably good, but it mostly blew cool air out of the laptop. I'm ready to buy a laptop that's made for Linux - I'm thinking of getting the HP Mini 1000, once the Linux version comes out.

The Perfect Home Server: MSI Wind Desktop

Introduction

For a long time my desktop computer running Arch Linux performed double duty as a home server. The Arch computer isn't very stable, and it has a Core 2 Duo processor, which is overkill for a server. As a result, I decided to set up a seperate home server for the following uses: ssh gateway, music server (mpd + icecast), IRC client, downloading server and backup server. The requirements: stability, low power consumption and low noise.

Hardware

The MSI Wind Desktop is a bare bones system, based on the Atom chipset. All of the hardware works perfectly under Linux, making it a great home server platform. It includes the following:
  • Atom 1.6 Ghz CPU
  • 2 SATA slots (3.5" and 5.25")
  • Gigabit Ethernet
  • Intel 945GC integrated graphics, with VGA output
  • Realtek ACL858 8 channel audio
  • SD/MMC/MS/XD card reader
  • Internal Compactflash slot
  • Mini PCI slot
In addition, I added a 750GB hard drive for file storage, a 8GB Compactflash card for the operating system, and 1GB RAM. The total cost is around $250.

The Atom chipset is very effecient, so the MSI Wind only has a single case fan for cooling, resulting in a very quite machine.

The hardware installation was simple. The only annoyance: I had to unscrew the motherboard to install the Compactflash card.

Software

Operating System:

I decided to use Debian Lenny stable, (Release Candidate 1). I also briefly considered CentOS, but my love of apt won out. Even though my goal is stability, I couldn't bring myself to use the current Etch, since it's going to be replaced soon (I hope). This a simple headless server, so I only installed the basic server package set. Since I didn't buy an optical drive, I used a USB CD drive. It's also possible to install Debian from a flash USB drive - Debian has an installer for this here.

To minimize noise and power consumption, I installed Debian to the Compactflash card. Since flash memory has a limited write life, I was worried that this might be a mistake. However, after researching the issue thoroughly, I couldn't find a single report of this happening in actual practice. All the same, I took the following precautions to avoid excessive writes:
  • No swap partition
  • ext2 for the OS partition (journaling file systems like ext3 need to write frequently)
  • In case of failure, all the important OS files are backed up to the hard drive daily with cron and rsync

I created a single ext3 parition on the hard drive. Since the hard drive is not in constant use, I installed hdparm, and set the hard drive to spin down after 10 minutes of idle time with hdparm -S 120.

In addition to the basic debian installation, I added some of my favorite command line utilities: screen for managing multiple terminal screens, nmap and iptraf for network troubleshooting, vim for editing text, irssi for chatting on IRC, rtorrent (and wget) for downloading, and elinks for basic web browsing.

SSH:
To improve security, I disabled password authentication, and root SSH access. Using public key authentication prevents bruteforce attacks. It also allows you to login in without a password/passphrase, but this must be used carefully. I also forward port 22 from router, to allow outside access

Backup Server:
To automatically back up my desktop, I use rsync with ssh:
  1. I created a second user on the server called "rbackup". On my hard drive, I created a backup directory, group owned by "rbackers", which includes my regular user and "rbackup". The "rbackup" user has an ssh key with requires no passphrase, which is necessary for automating backups.

  2. On my desktop, I set up a simple backup script using this rsync command: rsync -avz --exclude-from excludefile.txt -e "ssh -i $KEY" $BDIR $USER@$SERVER:$RPATH |tee backuplog.txt
  3. Using cron, the backup script is run twice a day.

  4. In addition, I manually run a second script occasionally that syncs with deletion. It does a dry run first, which I look over for important files (rsync -avzn --delete --exclude-from $EXCLUDES -e "ssh -i $KEY" $BDIR $USER@$SERVER:$RPATH|tee synclist.txt)

Of course, there are many backup solutions that I could of used: amanda, zmanda, bacula, rsnapshot, and more. I decided that for my purposes, something simpler would be best.

Streaming with MPD and Icecast
In my opinion MPD (Music Player Daemon) is by far the best way to play music in Linux. You can can use multiple front ends to control it, even over a network: GMPC or Sonata from Gnome, Pitchfork over the web, ncmpc or ncmpcpp from the command line. ncmpcpp is my favorite, even on my desktop. MPD can play to multiple outputs, including sound cards outputs, and streaming servers. In this case, I set up outputs for Icecast and ALSA. To allow streaming from anywhere, I forward port 8080 from my router to the server.

Conclusion

The MSI Wind is a perfect home server. Combined with Debian, it has been extremely stable: I've only rebooted for kernel updates. There's something magical about booting a computer, without the hard drive spinning up. Considering the the price of a 750GB external hard drive is around $175, paying about $75 more to get a full blown computer and network storage device is a great deal. The Atom chipset is perfect for this. Right, there are only a couple of Atom desktops available: the EEE Box from Asus, which is too small to use with a 3.5" hard drive, and more expensive. There's also the Shuttle X27, which is a nice option, but lacks the Compactflash slot, and it costs a bit more. It's a shame that there's not models aimed specifically at light server use out there, but the home Linux nerd market is pretty small.

Monday, June 30, 2008

Yellow Dog Linux 6.0 on an iBook G4

I was excited to hear about the release of Yellow Dog Linux 6 a couple months ago - I have an iBook G4 that I've been eager to switch to Linux. Since Apple switched to Intel a couple years ago, the number of Linux distros supporting PPC has dropped off fast. Before that, Yellow Dog was focused on providing Linux on Apple hardware - now their focus has shifted to the Playstation 3, although they continue to support PPC based Apple hardware. I put off installing it for quite a while, since I couldn't find a single review of YDL 6 on Macs - only PS3. Their Mac community has shrunk considerably looking at their forums - most new posts are focused on the PS3. So, here's a brief run down of my experience installing YDL 6.0:

The install process is quite painless - since it's Red Hat based, the anaconda installer is quite easy to follow. I initially only installed the Enlightenment desktop environment, but after getting annoyed trying to configure E17 I installed Gnome as well.

After completing in the installation, I was pleased to find that power management worked perfectly - closing the laptop puts it to sleep, and it resumes when opened, just like in OS X. It also dims the screen when idle, and there are alternate settings for running on battery power. Since Apple considers two trackpad buttons aesthetically offensive, the right mouse button is emulated using F11. There's no trackpad scrolling for this model iBook, even though it possible to get this working in OS X with the iScroll2 driver, so that's a little disappointing. The battery indicator works fine, and battery life appears even better than in OS X: around 4 hours with an older battery. If the CPU is maxed out for a while, the fans will start going within a few minutes, even before the laptop feels hot. Under OS X, it gets quite hot before the fans start. Better safe than sorry I guess - I know it's possible to tweak the fan settings in some config file, but it seems fine to me.

There were a couple problems after the installation finished. Number one, I had trouble with yum. I was able to update software using the "Software Updater" GUI frontend in Gnome, but running yum update and yum upgrade reported that there was nothing to update. Also, yum search and install failed even on packages that should be in the repos. I ended up adding fedora-extra, livna and dribble repos for extra packages and giving up. In addition, whenever yum runs it maxes on the CPU for a few minutes before installing. I'm used to using apt and pacman, so I'm not sure if this is normal or not - you would think Yellow Dog would get it right since yum was originally their creation (yum stands for Yellowdog Updater Modified).

The second problem was the wireless, which illustrated the problem with the missing Apple community in YDL since the switch to Intel. After searching for a couple of hours, I finally figured out that the driver is included and working in the kernel, but the firmware is not. I installed bcm-fwcutter with yum, which extracts the firmware from Broadcom's proprietary drivers - you can point it your OS X partition if you have one. I ended downloading the driver off some random site I've forgotten. After running bcm-fwcutter drivername, copying the extracted files to /lib/firmware, and rebooting, the wireless worked fine. I was amazed that YDL's documentation didn't include any notes about this, and also that I couldn't find anything on their forums about it.

In addition to my problems with yum, my only complaint is that some of the packages they include are a bit old - Gnome dates back to 9/07 with version 2.16 and Gimp is 2.22 - the current version is 2.51.

All in all, I'm quite happy with YDL - I hate dealing with tuning Linux performance for a laptop, and they have that covered. Now that Apple's decided to stop supporting the PPC architecture with their next version of OS X (Snow Leopard), I hope YDL will keep working to give old Apple hardware new life.

The purpose of this blog

After using Linux for a couple years, and inevitably running in to many problems, I've created this blog as a place to dump notes on how to fix problems I've encountered. Although I've tinkered with web design, including some web apps, I'm too lazy to bother creating anything fancy, so I figured a blogspot account would work just fine. Maybe I'll post a few thoughts as well.

The Rockhoppper is one of the penguin species that hasn't been claimed as a distro name yet as far as I know. Of course, there are other Linux projects named after it - there's only 17 penguin species after all, and a gazillion Linux developers . . .