As a few people are aware this site and a few others of my own and some friends are hosted on an XServe G4 running Debian Lenny served from the DCG Amsterdam datacenter within the ColoClue network infrastructure.
Why Debian? ‘Cause I like to snuggle up with it at night? Partially because I just love Debian plain and simple and because it is one of the few distributions which has decent powerpc support. Yes powerpc, what did you think was†inside†my XServe G4? Exactly, a dual-CPU G4 IBM PowerPC.
Unfortunately, running on exotic hardware does bring a few issues with it such as serial console access and remote†power-cycling. Next up some details on how to get the whole†shebang†to work.
Keep in mind: all the following commands are executed as root. This is achieved by either su’ing to root or issuing the sudo -s command.
The first thing you want to do is, obviously, install the SMP kernel so you can actually take advantage of the fact that you have two CPU’s:
~# apt-get install linux-image-2.6-powerpc-smp linux-headers-2.6-powerpc-smp
After that give it a reboot and boot into the SMP kernel and enjoy the added power.
The next two things you want to fix when your server is far far away is a serial console so you can access your server even when it doesn’t respond over SSH anymore and being capable of rebooting your server by power-cycle in case it hangs.
Let’s start with the power-cycle since that one is actually easy to fix. What we need to do is tell the Apple PMU (Power Management Unit) that it needs to operate in server mode, basically keeping the PSU (Power Supply Unit) online so it can restart after a†power failure†which is basically what a power-cycle is.
This is achieved by issuing the following command:
~# echo "server_mode=1" > /proc/pmu/options
~# cat /proc/pmu/options
The second command should return server_mode=1. If it returns server_mode=0 it means the echo command failed, probably because you didn’t execute it as root as instructed.
Now, once you’ve rebooted the server the PMU will be aware of what to do and power-cycling from a powerbar or whatever function your colocater provides for it will work as expected though I do suggest you test it out.
Now, serial console access. This one was tough because the normal way to achieve it by editing openfirmware variables had a bit of a funny effect on my XServe, namely that it did transfer the keyboard output to the serial console but not the VGA/console output itself which is less than useless since you need to have both available if you want to be able to do anything over serial console. After a lot of tinkering and fidgeting with yaboot itself a solution was found. It’s a bit of a hack and will disable screen and keyboard output and input locally until the kernel is fully booted but on the bright side, serial console will be fully functional.
Please keep in mind the following: the speed for my serial console is set to†57600 on the serial console server. This probably is different from your serial console server. You should ask your colocater what the speed is and edit accordingly.
Second: read the WHOLE post first BEFORE making any changes to your system.
Third: If following this guide blows your XServe’s installation, don’t come cry to me. This is delivered ‘as is’ with absolutely no guarantees.
First, we need to figure out what the heck the device names of our serial consoles are.
Issue the following command:
~# dmesg | grep tty
You should get output similar to this:
[1726561817.613595] ttyPZ0 at MMIO 0x80013020 (irq = 22) is a Z85c30 ESCC - Serial port
[1726561817.629215] ttyPZ1 at MMIO 0x80013000 (irq = 23) is a Z85c30 ESCC - Serial port
Keep in mind, my serial consoles are located on ttyPZ0 and ttyPZ1, this might be different on your XServe so from here on, replace my ttyPZ0 entries accordingly to your dmesg output.
One other note: dmesg gives us two devices, only the first is actually active in my experience so I’ll be using ttyPZO.
For starters, edit the following file: /etc/inittab
Then, a little below line 60 you’ll see a section like this:
# Example how to put a getty on a serial line (for a terminal)
If the examples are not commented out, comment them out by adding a # to the fron of every line and add the following:
T0:23:respawn:/sbin/getty -L ttyPZ0 57600 vt100
Now save the file and quit your editor.
Next up, we need to edit /etc/securetty
At the top of the file, there will be a line similar to this:
# Standard serial ports
Replace the ttyS0 and ttyS1 entries with these:
ttyPZ0
ttyPZ1
Great succes, we’ve just done the easy part. Nope, not kidding, that was the easy part. Now for the nasty stuff.
The first thing we want to do is tell yaboot that when it boots a kernel, it needs to throw that output to the serial console. here’s how we do it.
Edit the file /etc/yaboot.conf
It should look something like this:
boot=/dev/hde2
device=/pci@f2000000/AppleKiwi@15/@0/disk@0:
partition=3
root=/dev/hde3
timeout=50
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot-serial
enablecdboot
image=/boot/vmlinux
label=Linux
read-only
initrd=/boot/initrd.img
append="console=ttyPZ0,57600n8"
image=/boot/vmlinux.old
label=old
read-only
initrd=/boot/initrd.img.old
append="console=ttyPZ0,57600n8"
Please add the append= accordingly to your yaboot.conf file and DO NOT FORGET to change the magicboot=/usr/lib/yaboot/ofboot line to magicboot=/usr/lib/yaboot/ofboot-serial
Now save yaboot.conf and quit your editor.
Now, when yaboot will boot a kernel it will throw the output to the serial console so you can see what happens and if necessary interact with it.
This however is not sufficient in my case. I need to get access to the serial console before yaboot decides to boot a kernel as I want to be able to select the ‘old’ kernel in case the ‘Linux’ once blows up or edit the kernel startup parameters.
So, here’s how I did it:
~# cp /usr/lib/yaboot/ofboot /usr/lib/yaboot/ofboot-serial
Now open /usr/lib/yaboot/ofboot-serial in your editor and go down to about line 323. Around there you should see a line like this:
\" screen\" output
Change that line and ONLY that line to:
\" scca\" output
Save the file and quit your editor.
Now it is time to write yaboot to its partition so yaboot is aware of our changes to the bootloader. This is achieved by issuing the command:
~# ybin
Time to reboot the XServe:
~# reboot
Now, hands to the keyboard, once it reboots, press and hold down: Command+Option+O+F / Alt+Apple+O+F and don’t let go of those keys until you get the OpenFirmware prompt.
Here, issue the following command:
setenv input-device scca
This will basically tell the XServe that its primary input device is the serial console instead of the keyboard attached to the server. For most people it also works to issue:
setenv output-device scca
That should throw all console output over serial console and hence you wouldn’t need to edit the magicboot line in yaboot and create that second file, however this failed for me so that’s why I hacked up this solution.
Time to write the changes and boot:
mac-boot
And there we go. With all this, I got my XServe G4 to fully operate over serial console at the time yaboot is started, so you can select what kernel to boot and how to boot it.
I’m not saying this is an elegant or full-proof solution but the fact is, it works for me, I’m happy with it and maybe it will work for you or help you out.
Anyhow, good luck with it, getting an XServe to work as expected without Mac OS X Server on it is a bitch!





Thanks for this post.
I’m running also a Xserve G4 DP on debian, it runs more stable than osx sever – strange enough.