Installing Debian on an Apple Xserve
December 15, 2022
Back to Self-Hosted Mastodon Project Description
I picked up two old Apple Xserve computers from ebay. I think that they are really great-looking machines, and am consistently a bit bummed that Apple stopped producing this type of product. These are fairly old computers, and aren't able to natively run a modern version of macOS. But they are able to run linux, so that's what I'm going to try to do!
Installing Debian on an Apple Xserve
I have two machines - two different models. Picked them up off ebay. I think it's a really great hardware design, and too bad that they were discontinued.
- Xserve 1,1
- Xserve 2,1
They're both somewhat old-ish (2008-2009 or so) and are super unsupported when it comes to native operating systems. But they're workable enough and can actually run the most recent version of Debian.
These are intel macs, so they actually don't need as much finangling to get to work. But still a bit of a process
Caveats
- This is meant to describe my process - but no guarantees of how well it will work for you and in all cases. So it's less of a full tutorial. But hopefully will be helpful/interesting
- This is not an efficient way to run things at all. Part of them being old hardware is that they're pretty power hungry, etc. The way I see it, they're bascially really expensive space heaters that also happen to run linux
- I am indebted to countless other online resources. I try to link those whenever I mention them, but I also am re-hosting a lot of code here - just to possibly help someone out in the future if another site disappears
Overview
The basic steps are this:
- Boot a linux installation media (hold option)
- Install linux to the hard drive, including installing a GRUB partition
- Make some modifications to the GRUB config so that the system boots reliably
- Install and config like any other linux installation
Or at least, that's how it would work, in theory. In practice it got a bit messier!
These next parts describe installation of 32-bit and 64-bit Debian. In either case, my end goal was to end up with a working installation of Debian 11 64-bit. These are divided out into the steps I had to do for each machine. I think it's more a matter of whether the EFI on each machine is 32-bit or 64-bit, and that's what determines which one you need to follow.
Xserve 1,1 (32-bit installation, followed by 64-bit crossgrade)
create a Debian netinstall USB drive (I had tried to burn a DVD at first but wow what a PITA)
run the installation as usual, but once we reach the end step, escape out of the installer and drop into a shell
- edit the file /target/boot/grub/grub.cfg
- find the kernel line and add
console=ttyS0,115200n8 nokaslr nomodeset radeon.modeset=0
- the kernel line is the one that begins with
linux
and tells the computer how it should boot linux. My specific line looks like:
/boot/vmlinuz-5.10.0-19-amd64 root=UUID=aadf3ee1-fa97-4e8e-bfee-986aea06a395 ro console=ttyS0,9600n8 nokaslr nomodeset radeon.modeset=0 quiet
- the console lines come from this guide I was following (https://pixilic.com/debian-headless-2009-xserve), which uses the serial port. Probably not necessary but I'm leaving it in
- the nomodeset / radeon is necessary to actually get the screen to display properly when booting. If your xserve doesn't have the stock radeon graphics care YMMV
- the kernel line is the one that begins with
- reboot the machine - and cross your fingers that it worked! If so, there's a few small adjustments to make sure that we keep working as expected:
Create the file /etc/modprobe.d/ipmi.conf with these two lines:
blacklist ipmi_si
blacklist ipmi_msghandler
Edit the file /etc/default/grub and edit the GRUB_CMDLINE_LINUX variable so that it looks like this:
GRUB_CMDLINE_LINUX="console=ttyS0,9600n8 nokaslr nomodeset radeon.modeset=0"
Run these commands:
depmod -a
update-initramfs -u
update-grub
Thankfully, the video card works and I'm able to actually see what I'm doing and work directly with a USB keyboard. One of the sites that I was referencing had ended up using the serial console to start of the linux installation, which sounds like quite the hassle!
After making those adjustments, reboot the system.
For the above commands, you will likely need to be the root user for them to work properly:
su - root
We now have a working installation of Debian 11. If I was happy with a 32-bit OS, I could end right here. But I want to add more RAM later on, so I'm gonna have to do a 64-bit crossgrade. Yeesh.
32-bit to 64-bit Crossgrade
Again, I was following the instructions at: https://pixilic.com/debian-headless-2009-xserve
You are now running Debian 10 for i386. To migrate to an amd64 kernel:
dpkg --add-architecture amd64
apt update
apt install linux-image-amd64
sudo apt remove linux-image*686*
Reboot the system. If you want to migrate to an amd64 userspace:
Follow the Debian wiki instructions on crossgrading, but do not reboot! (https://wiki.debian.org/CrossGrading)
Ensure the grub-efi-ia32 package is installed.
Edit /etc/default/grub
and restore the changes you made to GRUB_CMDLINE_LINUX
above, if they are missing.
dpkg-reconfigure grub-efi-ia3
2; when
asked “Force extra installation to the EFI removable media path,” select
Yes. When asked “Update NVRAM variables to automatically boot into
Debian,” select No.
Run update-grub
for good measure.
Now reboot the system.
This was such a difficult process for me - This site's intstructions is where I ended up finding most success: https://stbuehler.de/blog/article/2017/06/28/debian_stretch__upgrade_32-bit_to_64-bit.html
The key step was reinstalling dash and bash first
For whatever fucked up reason the dash preinst script uses bash; and bash of course “Pre-Depends” on dash. There is a good chance this breaks later, and if one of them gets removed you’re in big trouble (xxd -r might help you restoring binaries from another system). So we update these first:
apt-get clean
apt-get -y --no-install-recommends --download-only install dash:amd64 bash:amd64
dpkg --install /var/cache/apt/archives/*.deb
dpkg --install /var/cache/apt/archives/dash_*.deb /var/cache/apt/archives/bash_*.deb
After that, I was able to install the package installation tools correctly.
Now we change the host architecture by installing the new packaging tools. This should work without aptitude too if you don’t want it.
apt-get clean
apt-get -y --no-install-recommends --download-only install dpkg:amd64 apt:amd64 aptitude:amd64 apt-utils:amd64
dpkg --install /var/cache/apt/archives/*.deb
dpkg --install /var/cache/apt/archives/dpkg_*.deb
And their suggestion for removing old i386 packages worked too - though it had to run a few times.
apt-get clean
apt-get --download-only -y --no-install-recommends install
dpkg -l | grep '^.i' | awk '{print $2}' | grep :i386 | sed -e 's/\(.*\):i386/\1:i386- \1:amd64/'
dpkg --install /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/perl*.deb
dpkg --configure -a
Alternating that step with sudo apt --fix-broken install
helped repair the situation.
IMPORTANT: Make sure to be running this over SSH - if you had a GNOME desktop session, it will get killed during this process.
Network adjustments
I was running into an issue where the network interfaces wouldn't always come back up after a reboot. I had to edit my /etc/network/interfaces
file to enable the interfaces:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto enp5s0f0
iface enp5s0f0 inet dhcp
You can figure out the name of the network interface by running ip a
Xserve 2,1 (64-bit installation)
I had expected to have to run through the whole situation above on the other machine. But lo and behold, my USB drive with Debian 11 i386 netinst on it wasn't recognized. WTF. On a whim, I tried creating the drive with the amd64 installer and yep it showed up right away.
So in some ways, this actually made things a lot simpler.
create a Debian netinstall USB drive
run the installation as usual, but once we reach the end step, escape out of the installer and drop into a shell
- edit the file /target/boot/grub/grub.cfg
- find the kernel line and add
console=ttyS0,115200n8 nokaslr nomodeset radeon.modeset=0
- the console lines come from this guide I was following (https://pixilic.com/debian-headless-2009-xserve), which uses the serial port. Probably not necessary but I'm leaving it in
- the nomodeset / radeon is necessary to actually get the screen to display properly when booting. If your xserve doesn't have the stock radeon graphics care YMMV
reboot the machine - and cross your fingers that it worked! If so, there's a few small adjustments to make sure that we keep working as expected:
Create the file /etc/modprobe.d/ipmi.conf
with these two lines:
blacklist ipmi_si
blacklist ipmi_msghandler
Edit the file /etc/default/grub and edit the GRUB_CMDLINE_LINUX variable so that it looks like this:
GRUB_CMDLINE_LINUX="console=ttyS0,9600n8 nokaslr nomodeset radeon.modeset=0"
Run these commands:
depmod -a
update-initramfs -u
update-grub
Reboot the system.
For the above commands, you will likely need to be the root user for them to work properly:
su - root
But when I rebooted - the got the dreaded "Disk and question mark error" - meaning that the machine couldn't find an operating system to boot from. The real confusing part is that every 3-5 reboots, the system would boot. The built-in EFI just wasn't consistently finding the GRUB partition on the hard drive.
(General boot order is EFI -> GRUB -> Linux)
Damn. I thought I was going to possibly call it quites on this machine entirely.
USB Bootloaders / Startup Stability
I found this guy's tutorial: https://blog.christophersmart.com/2009/07/23/linux-on-an-apple-xserve-efi-only-machine/
He had made an entire custom ISO to load linux installers. I loaded this onto a USB flash drive - and yes the machine would reliably boot into a basic GRUB system from this drive. But it wasn't loading any other ISOs
BUT... this did mean that I could possibly use this to get the machine to see my GRUB partition on the hard drive.
So I modified grub.cfg
on this flash drive to include:
insmod part_gpt
insmod ext2
set root=(hd0,gpt2)
search --no-floppy --fs-uuid --set=root aadf3ee1-fa97-4e8e-bfee-986aea06a395
I determined these values by checking what the installation had in its own grub.cfg
file - which in some cases I had to access by booting the original
installer USB and entering rescue mode to mount the filesystem.
I also ended up doing somethign similar for the Xserve1,1 - but it ended up being slightly different with the disk and partition.
Editor's Note: I'm still having some inconsistent booting with the Xserve1,1 - sometimes it just isn't able to find the EFI partition (even with the USB stick) and stalls on the "OS not found" screen. But after a few reboots, it is able to successfully boot. So that's a fun project for me to work on.... eventually
Front Panel CPU Lights
The Xserve has a series of blue LEDs on the front panel which are used to display current CPU activity. Well, they used to be used to display CPU activity. The most recent macOS versions removed this functionality. And of course linux has nothing at all for it...
This project is a simple C program to re-enable the functionality: https://github.com/castvoid/xserve-frontpanel
I couldn't get it to compile for linux - at least not with the primary project.
This fork of the project includes a specific 'linux' branch: https://github.com/ryandesign/xserve-frontpanel
I was able to get it to compile on the Xserve 2,1 - but not on the Xserve 1,1. But after copying the compiled binary over, it seemed to work. Strange. You can download a copy of the compiled binary here: (xserve-front-lights) MD5: 8a09b46c909b777ac5a86a233fa08708
I set this to run after bootup in cron
like so:
@reboot /usr/bin/sleep 30 && /home/bpettis/front-lights &
It's incredibly satisfying to see the 'blinkenlights' at play!
Custom Icons in macOS "Network" window
In the macOS Finder, you can browse the network and see machines that are broadcasting themselves. Depending on the type of computer, we'll get an icon that matches its hardware. It's not strictly needed for anything, but it's a fun way to make these Frankenstein linux-macs feel more like real Macs. It's also a neat way to have an at-a-glance check if the server is up.
First, install avahi-daemon
and netatalk
with a simple sudo apt-get install avahi-daemon netatalk
But linux is just a boring default view of a generic computer. Let's trick Macs on the network into thinking it's a different kind of device.
- create an avahi afp service
sudo nano /etc/avahi/services/afpd.service
Yes I'm lame and use nano deal with it
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=MacPro1,1</txt-record>
</service>
</service-group>
We can fill in MacPro1,1
with really any mac model - e.g. I did one Mac Pro and one Xserve
And... finally! That's about all it takes to get Debian up and running on an old Apple Xserve. I didn't mention this at the beginning, but I gotta say - this is really not a recommended route at all. These machines are likely so power hungry and I expect to regret doing this once I see my next power bill. But hey, it is the winter, so at the very least I can just say that they're incredibly fancy space heaters...