Reviving a Power Mac G4 with Ubuntu Server

January 29, 2009 at 10:45 pm (Linux)

Header

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.

Hardware

Processor  - G4 400MHz
RAM        - 512 MB
Videocard  - Rage 128 Pro, AGP 4xsl
Hard Drive - 10.3 Quantum Fireball LM10.2
Network    - Built-in Sun GEM Gigabyte Ethernet
           - TRENDnet TEG-PCITXR Gigabyte Ethernet - uses Realtek 8169 chipset

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:

mkisofs -o PowerMacG4-Updates.iso G4_FW_Update_4.2.8.smi.bin \
Mac_OS_9.1_Update.smi.bin
cdrecord -v -dao PowerMacG4Firmware.iso

Reset NVRAM, PRAM, Clock

It’s a real good idea to reset the NVRAM, PRAM and Clock in case any values are set incorrectly:

  1. Remove or disconnect the memory battery. Leave the battery disconnected for 5-10* minutes.
  2. Reinstall or reconnect the battery.
  3. Depress the CUDA (aka PMU) button (for 5 seconds) with a non-metallic (plastic, wood, etc.) device.
  4. 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.

For reference, I followed and the Ubuntu Server Guide and the slightly aged Ubuntu PowerPC Guide for PowerPC related parts.

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.

Etc.

change console font in /etc/default/console-setup
Debians bashrc tanks – better bashrc
vim-lite wtf?

Good luck with your new OS!

Resources

6 Comments

  1. Andreas said,

    Hi,

    why not go with FreeBSD? There’s excellent support for ppc? And the routing/nat setup is but a “yes” in the installer ;)

  2. Dirk Gently said,

    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?

  3. Mike said,

    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

    Regards

    Mike

  4. Dirk Gently said,

    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.

    Good Luck, Dank Für Messwert.

  5. Chris Reich said,

    I fought with trying to install FreeBSD on a Power Mac (Digital Audio 533 MHz) for the better part of a year and finally gave up in favor of Debian Etch (now using Debian Lenny).

    There is an inherent incompatibility between Open Firmware and UFS that is not resolvable by mortals.

    I did have some preliminary success with OpenBSD but did not follow through with the experiments.

    All my best – Chris Reich; Rochester, New York
    twittername: chrisreich

  6. Gen2ly said,

    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.

Post a Comment