Saturday, June 27, 2009

Setting Up a D945GSEJT Server with Debian Lenny

I previously blogged about the QNAP Turbo Station as a possible candidate for a low power home server. The big problem with that solution was the loud fan, which seemed to be a real show stopper. Searching for an alternative solution, I found the recently released Intel D945GSEJT motherboard. With a TDP below 20W (apparently ~10W when idle) and being totally fanless, it is ideal for the task. I combined this with two 1TB Western Digital Caviar Green discs (cool, quiet and with low energy consumption) in an Emko EM-153 case with a built-in, fanless 60W power supply.

The resulting build is a completely passively cooled, extremely low power, fully functional home server. I installed Debian Lenny, the currently stable release of Debian, which is known to be very robust, and will allow me to easily configure the machine as an SSH server, web server with LAMP, etc. With the disks set up as RAID1 and an encrypted LVM partition containing all but /boot, it is first and foremost the perfect solution for secure file storage.

This setup took quite some effort, which is why I will document the critical points I encountered, for my own reference, and hopefully to help anyone who comes across this entry dealing with a similar setup.

The first problem was that of setting up the OS. I had more or less decided on using Debian, since I am running Ubuntu on my desktop machines. With no optical disc drive connected to the system, I considered installing Debian from USB. The problem with this solution is that the Debian Lenny installer is unable to recognize the Realtek 8111DL Ethernet controller (previous versions of the Debian Lenny installer, read this update about the latest version of the installer). I realized after the install was finished that it would probably be possible to load the correct kernel module manually during the install, which is of course a more elegant solution than the one I ended up using. Ubuntu 9.04 (Jaunty) Server, which I considered as an alternative, also had problems with the NIC (I found a reference that this would work, but I had no success myself). Intel lists some Linux distributions that they have tested on the board, one of which is Ubuntu 8.10 (Intrepid). The installer for Ubuntu 8.10 Server indeed recognized the NIC, so beside the fact that I would settle for an earlier distribution, and not solve the network problem permanently, it could have worked.

However, a problem with pre-Lenny Debian installers, like the one for Ubuntu 8.10, is that the partition editor has a serious flaw in that it cannot correctly handle encrypted partitions set up on a RAID device. There is a workaround for this, which I tried, and unfortunately did not get to work.

My brute force solution, growing tired of the problems I encountered, was to hook up the hard drives to my AMD 64 X2 4850e desktop computer, and perform the installation of Debian Lenny using the DVD drive and network card (another Realtek NIC that the installer could handle) of that machine. A small bump in the road was that the installer hanged when booting, which I solved by specifying the option acpi=off to the kernel. I found a reference to another person having the same problem, in which case the problem was solved by specifying pci=off. For me, this resulted in being able to boot, but prevented the detection of my SATA DVD burner. I now was able to set up the partitioning correctly, and let the installer percolate for about 24 hours, since the 1TB encrypted RAID partition had to be initialized with random data.

With the discs still wired to the desktop computer, I booted into the new system, and used the working network connection to dowload and compile the correct kernel module for the Ethernet adapter. The instructions for doing this can be found here. Although in that case the Intel D945GCLF2 board was used, which has the RTL8111C NIC, the D945GSEJT features the RTL8111DL Ethernet controller, which is handled by the same kernel module (r8168), as can be seen on the Realtek download page for the drivers. After following all of the advice given in the mentioned blog entry, including the module blacklisting, the kernel kept loading the wrong (ie r8169) module when I moved the discs to the Intel Atom board. I tracked this issue down to the file /etc/udev/rules.d/70-persistent-net.rules, which listed the r8169 module, which was the correct module for the desktop AMD computer NIC. Commenting out all the lines in this file and rebooting, udev reconfigured the network setup, and I finally had everything working correctly on the mini-ITX server.

One artefact from the installation procedure was that the acpi=off option made its way from the installer to the final install. Removing this option worked fine on the Intel board, and enabled me to use frequency scaling, which of course is a very desirable feature for an always-on system as this one.

So there you have it. Lots of obstacles along the way, but the end result was well worth it. I hope this can serve to ease the burden of anyone else planning on a similar setup.