Reviving a Power Mac G4 with Ubuntu Server

I had been considering building my own server for a home network and decided to buy an old garage Power Mac G4 400. This is a good computer and will work great as a server definitely so I decided to install Ubuntu Server on it. I’m a Gentoo user normally but being the adventure that I am I decided to try something new.

Ubuntu official doesn’t support PowerPC documentation or installation-CDs anymore but the community do still produce installtion-CDs.

The best place to begin with an old computer is to test the hardware. Apple has done a good thing and made their PowerPC Hardware Test CDs available for download. You’ll need Mac OS X to burn CD dmg images though, I’ve tried various Windows (MagicISO) and Linux utilies (dmg2iso, dmg2img, acetoneiso2) that don’t work.

I’m building a server to use as a firewall so all the hardware is there except an additional network card. Another network card will be needed to route to another computer. Here’s good list of Power Mac G4 network cards that work in OS X, check and see if there is a Linux driver for them. The card listed above does.

Update Firmware

The firmware will need to be updated to the most recent available. You can check this by booting into Open Firmware (Apple + Option + O + F) at boot and looking at the OF version on the top then compare it to the newest on Apple’s website.

This firmware update requires Mac OS 9.1, luckily I have an old iBook 9.0 install disk that installed. The old software update panel doesn’t work any more though but the 9.1 update can be downloaded. I downloaded the files onto my Linux desktop and burned them to disk:

If this doesn’t work, change the RAM. Either add or remove a stick then zap the PRAM (Apple+Option+P+R), wait for three chimes. After that shutdown, add/remove the RAM and start again.

Clock Set, Optional Password

Boot into Open Firmware again and set the clock (military time):

decimal dev rtc sec min hour day month year set-time

Optionally you can add security so no one can tamper your Open Firmware settings, and add protection from being able to be able to boot directly to disk, CD, or netboot.

Linux StartCD

I used Linux to download and burn the install CD, Ubuntu CD’s can be found here.

And burned them with:

cdrecord -v dao name.iso

The Power Mac G4 Sawtooth Open Firmware only has rudimentary support for Linux and cannot boot Linux CD’s by holding down C or holding down option. Rather you will need to direct OF to the Linux InstallCD’s yaboot file:

boot cd:,\install\yaboot

Select Kernel and Options

The Ubuntu Installer will now ask what kernel to load and will tell of a few options that can be passed to the kernel. For most people, the default install-ppc will do – use -smp for duelcpu systems. I decided on the expert-powerpc.

Switch to Console for a Couple Tasks

When the installer begins a couple tasks may need to be done. First if you didn’t use the Apple Hardware Test Disk, check the hard disk now for bad blocks. Also the console too add the ide-scsi device to the kernel, the Debian installer fails to recognize it. Get to the second console by pressing Ctrl + Alt + F2.

Check for Damaged Blocks on Drive(s):

Bad blocks can cause serious problems running software. If you discover a bad block it will be marked and not used but be warned when drives begin to get bad blocks the drive is almost always failing.

mac-fdisk -l
mke2fs -j -c /dev/sda

DVD/CD-ROM Drive Not Detected

On this computer, the installer failed to load the driver to have the DVD/CD-ROM work (go ahead – it won’t hurt if you don’t need it):

modprobe ide-scsi

Return to the install by doing Ctl + Alt + F1

Time to Build

Note: Older CD-ROMs have trouble being recognized on a regular basis, and have bad, slow, error correcting. You may have to reload the CD multiple times. If the installer gives you alot of trouble I’d recommend the Gentoo Minimal Install CD that only needs to boot correctly (use “gentoo docache”) and everything else will be done on the hard drive.

Basically you just go step by step. Select you langauge and in keyboards select “macintosh” for keyboard. “Detect and Mount CD-ROM” should now work, then “Load debconf…” and then “Load installer components from CD”. I did this quickly after the “Detect and Mount…” option because once the CD was forgoten by the installer.

In “…InstallerComponents” the only option I choose was “mirror select” but its buggy and didn’t work for me. You can find the mirrors available and then you have to enter the mirror without any subdirectories (e.g. ftp.osuosl.org) in the next dialog enter the subdirectorties (e.g /pub/ubuntu-releases/). I ended up choosing the default UK mirror. The mirror can later be change in /etc/apt/sources.

You’ll need to have to download some files for the download to complete so setup the network.

When you get to partitioning choose the one right for you. I decided on the LVM with encryption. This too has a bug. I got a dialog that said “No NewWorld boot partition was found…”. Yaboot (the Mac bootloader) requires this to boot. As I said its a bug and you can ignore it. It will ask you, “Go back to the menu and resume partitioning?” Select “No” and write the partition table.

The rest should be pretty self explanitory, configure the package manager, users… I opted to have a root account because I know “rm -f /” is bad. ;) Install the software you need. The Ubuntu Server Guide details plenty of options: a dns server, firewall, web server… I installed OpenSSH server because it’s easier just to have one monitor on my desk. LAMP to use apache for webadmin tasks (OSSEC-HID, snort) and DNS Server to setup a local LAN.

Now install the yaboot bootloader (skip LTSP), and thats all you need to do. End the installtion and it’ll ask you what type of clock you want. I set the clock to UTC time.

Reboot system and see your new Ubuntu server.

Package Management

I’ve built a script to use from the command line that I’ve put on the Ubuntu Forums for package management.

Andreas thats good advice. Ah, I really like the thought of an installer NAT. I’m still setting up my Ubu server and its kinda draining. The ubu folk do a couple odd things with renaming moving someconfigurtion files and there’s been considerably more bugs than I’ve experience with Gentoo. I’m gonna mess with it anotherday and if I don’t figure it out, I’m Definitely gonna try FreeBSD or back toGentoo. Can you tell me how good the FreeBSD package manager is?

Hi and thanks for posting this very informative step by step. I’m actually getting ready to do a similar thing myself. I have a spare G4 that i want to install the Powerpc Ubuntu 8.04 server on. I’m planning on removing the hard-drive from the Mac and replacing it with a spare drive i have to install Ubuntu. Any ideas on how you think this might go? I’m just wondering if having the mac OS on the disc is required seeing as the ubuntu install should be able to download the necessary drivers etc at install time. Again, thanks for the wonderfully useful article

Definitely you’d better Go and read the post once more, Dexter. I’ve very very clearly posted just what the the need for Mac OS may be. If you’ve never used Linux before you might want to consider something with a little more hand-holding like Mac OS Xserver.

Yeah, Debian looks to be the most Mac friendly (that’s actually what I got on my sawtooth right now). FreeBSD took quite a bit of my time and OpenBSD did good (I like it quite a bit actually) but didn’t have time to learn it anymore after learning pf. Debian’s automated packing setup though I found myself going back to reconfigure a few things which disturbed me a bit. Fedora too is supposed to have good ppc support though I haven’t tried it.

Hmm, doesn’t look good Alex. I’d think I’d do (oh, and thanks for the long reponse… been busy lately) as linuxopjemac suggested. If someone were to know about this, it be him. Appreciate if you could get back to me about this… gotta update soon too. This is likely a kernel issue.

I gave up on Apple Intel/ARM for my G4. Previously,tried Ubuntu 7 and Suse. More recently tried Debian before settling on Yellowdog 6.2. Very pretty distro but some would say bloated as it has Gnome,Enlightenment,and KDE desktops. As easy to install as openSuse on the pc and about as usable. Yellowdog has apache server and Sony PS3 versions as well. Check out the Nvidia and IBM blade and cell servers-just window shopping not a paid promo.

Hi there,
So, I didn’t really follow your instructions perfectly (yes, stupid me!). I didn’t upgrade the firmware and Ubuntu won’t boot. However, I also can’t boot off CD to install OSX (which I think I need to do to upgrade the firmware). Yaboot refuses to recognise the install CD. Is it possible to upgrade the firmware some other way?

Sorry but newbie here. I installed Jaunty 9.04 on a Power Mac g4 I bought cheaply ($1). For some reason the username and password will not allow me to log in. I have researched many sites but no luck. I installed using mostly defaults and selected SAMBA, LAMP and VMserver for server type. Can anyone help me out?

Trying to install Ubuntu 11.10 on it via netboot. Boots ok but ubuntu’s installer does not find the hard disk at the partitioning stage! (Hard disk is otherwise perfectly fine and boots the currently installed mac os 9 system)

Welcome to linuxtidbits.

linuxtidbits is a place for common bits of Linux knowledge. Linux is a good operating system with good people. Being part of Linux, to me, means being a part of something that everyone can contribute to.