Debian GNU/Linux Installation Notes for iBook2

preface

These are notes from my trials of getting Debian installed on my iBook2 (G3 500Hz, 10GB, Dual USB, DVD-ROM, and Airport). While I chose to install Debian, many of these things apply to all Linux distributions. There weren't any resources like this for me, and so I spent two days banging my head against the desk and relying on the help of friends to learn how to do this correctly. I hope that you find this useful.

boot options

There are several boot options on the iBook2. I chose to triple boot OS 9, OS X, and Linux. You can also dual boot any combination of these, or run any of them exclusively. Most of my notes are related to making dual and triple boots work very nicely (with pretty graphical menus), but should apply even to single boot systems running Linux. If you just want to run Linux, the installation process is significantly easier.

partitioning

The iBook2 (at least the 10GB version) comes with one HFS+ partition on which OS X and OS 9 are both installed. To switch between them, you must use the Startup Disk control panel or system option (in OS 9 this is the "Startup Disk" Control Panel, and in OS X it's in the System Preferences under "Startup Disk").

From what I could find, there are no standard tools that are able to resize the partitions, so they will have to be wiped. Unfortunately, this will probably force you to give up the MP3s they Apple provided (I'm not sure if they are on the 'restore' disks they provided), but even though there are some good tracks in that collection, you really should be using Ogg Vorbis anyway.

There are several system partitions that Open Firmware uses, and on my system there were 8 of these. Most of these are drivers I assume.

The easiest way to start, if you will be dual or triple booting, is to boot the iBook with the MacOS 9 CD (hold down 'c' when you hear the bell, or 'option' and then select the CD icon with the OS 9 logo on it from the menu). Once booted, in the utilities folder, there is an application called 'Disk Setup'. Using that, you can delete and create the partitions you want (use the 'Customize...' button).

If you are dual booting (either OS 9 and Linux or OS X and Linux) create two partitions, both of type MacOS Extended. The first one will be your MacOS partition (either OS 9 or OS X) and the second one will be a dummy partition that we will delete and replace later while installing Linux.

If you are triple booting, you have two choices. You can either install both OS 9 and OS X on the same partition, or put each on it's own partition. They will both be able to see each others partitions if you decide to make them separate. The real difference in doing them separately, is that Open Firmware will see them as separate boot options, and will let you select them from the boot menu (ie, the menu you get when you hold down 'option' at boot time). If they are sharing a partition, the menu will only show you one of them. If you want to boot into the other, you have to change the startup disk from within the OS. Next boot into MacOS will boot your choice, and to go back, you must change the startup disk again. Personally, I think the Open Firmware boot menu is cute, and so I chosee to put OS 9 and OS X on separate partitions.

For my setup (on a 10GB drive) I wanted OS 9 only for Virtual Game Station and DVDs, and OS X for playing around and some testing/development. I created 3 partitions:

Note: Even though the OS 9 partition is extremely small, I can still use disk on the OS X partition if needed.

Once the partitions are created, exit Disk Setup. The partitions will probably all have really dumb names, like 'untitled', 'untitled 2', etc. I don't know why Disk Setup does not allow you to name the partitions when you are creating them, but you can easily do this now in Finder (click on the name below the disk icons on the desktop).

Now that the partitions are created and named, start installing OS 9 if you will be doing so. Otherwise, reboot with the OS X CD in the drive (same procedure as booting the OS 9 CD).

installing macos 9

Skip this section if you don't want OS 9.

Mac OS 9 is easy to install, and takes about 15 minutes. There's not really any options, so if you can't figure it out, you probably have no business installing Linux.

Once OS 9 is installed, I booted into it and went through the general setup and Airport configuration. Obviously if you didn't purchase and install the Airport card, you won't be doing that. Once that was done, I rebooted with the OS X CD.

installing macos x

If you aren't installing MacOS X, skip this section.

Boot from the OS X CD (again, hold down 'c' when you hear the chime).

There is no OS here, just the installer, so go through the menus. If you are only dual booting, you'll be installing onto the first partition. If you are triple booting, you'll install onto the same partition as OS 9 if you are sharing the partition, or onto the second partition if they will be separate. I installed onto the second partition.

This install is also painless, far easier than any other OS install I've done save for OS 9 (that statement includes RedHat, Slackware, Debian, Solaris, DOS, Windows of all flavors, etc). Part of the ease is the almost total lack of options.

Once the install is done, wait for it to reboot, or click the reboot button on the screen.

At this point I booted into OS X and did the initial configuration. My personal thanks to whomever picked the awesome install music (Kruder and Dorfmeister are fabulous). Now that this is done, it's time to install Linux.

boot the debian cd

The Debian CDs I used were for Debian Potato, the current stable version of Debian. Installation CDs for other distributions don't really exist (that I've been able to find anyway), so even if you are planning to install and use Woody/Testing or Sid/Unstable you will want to start with the Potato CDs.

The Debian Potato CDs don't automatically boot for some reason. I hope that those guys make this a little easier, but for now, we have to live with what we have, and it's only a small extra step.

When booting, instead of holding 'c' during the chime, hold (all at the same time) Command-Option-O-F (Command is the key with the Apple logo on it, to the left of the spacebar). This will start you up in Open Firmware. This brings back memories of Apple 2's starting you up in BASIC (I'm told Open Firmware is in Forth, so if you're a total Forth nut, maybe you can have some fun here). The Open Firmware command to boot is 'boot', and it takes an ofpath (Open Firmware path). These generally look like 'hd:13,\\yaboot' or 'cd:,\\yaboot'. For my Debian Potato CD, the path is 'cd:,install\powermac\yaboot'. So I typed 'boot cd:,install\powermac\yaboot'.

Now hopefully you're reading a little ahead, or you're going to run into trouble quickly. Debian Potato's installer uses an older kernel which doesn't support the ATI framebuffer, so you'll have to tell linux to use the supported-by-all-macs Open Firmware framebuffer. When you see the 'lilo' boot line, type 'debian video=ofonly'. This may be 'linux video=ofonly' for other distributions or other versions of Debian. If you do this wrongly, the computer will seem to hang on a screen with a bunch of numbers. If this happens, just reboot into Open Firmware again, type the boot line, and try again.

If all has gone well, you will now be in the Debian installer. From here on out, I am going to be much more Debian specific, but smart readers will be able to figure it out for other distributions.

install debian

The first thing we need to do is partition the disk, to make some Linux partitions.

A little info first, for x86 people: in x86, you only really need two partitions for Linux, swap and root (although many people create multiple partitions for different sections of the system). On PowerPC, you need those, plus one bootstrap partition.

The bootstrap partition can be of type Apple_HFS or Apple_Bootstrap, the critical difference being that Apple_HFS partitions are mountable in OS 9, OS X and Linux, but Apple_Bootstrap partitions aren't (or at least not easily, I'm a little fuzzy on the details and specifics here). I suggest creating a bootstrap partition of type Apple_HFS. This will give you some ease in hacking around with the boot files since you'll be able to mount the partition and manipulate them directly. Also, Open Firmware can't see an Apple_Bootstrap partition in it's search for bootable things to put in the boot menu. If you want to use the boot menu, it'll have to be an Apple_HFS partition.

I made my Apple_HFS partition 32MB. This is big enough that if anything goes wrong in linux, I can use OS 9 or OS X to grab files that I can share with Linux via the bootstrap partition. Most docs seem to recommend 800KB, but with so much disk space, why not give yourself some insurance?

So, sooner or later during the install process, you'll be asked to create some partitions for Linux and you'll drop into the fdisk utility (for x86 people, this fdisk is slightly different than the one you are used to, so read closely). The first thing you want to do is hit 'p' to get a list of all the partitions on the disk. You'll see all those funky Apple partitions, followed by your 2 or 3 Apple_HFS partitions for MacOS(es) and Linux. The last one is the dummy we created earlier, so we'll delete that now. Press 'd' and then the partition number of the dummy partition from the list. Hitting 'p' again will show you that it's turned into free space (more specifically a partition representing free space). Now we'll create 3 partitions, one Apple_HFS partition for the bootstrap, one Linux swap partition, and one Linux root partition. To create the bootstrap, hit 'C' (for create with type, unlike x86 fdisk, you can't change types after creation, unfortunately). For the first sector you can enter 'xP' where 'x' is replaced by the number of the free space partition. For length, enter 32M (or 800K or whatever). For type, enter 'Apple_HFS' and for name you can enter anything, though i chose 'bootstrap'. Now the hard part is over.

Hit 'c' to create the swap partition ('c' creates a partition without a specified type, and fdisk puts give it an appropriate one). Use 'xP' for the first sector again where x is the new free space partition number (it should have incremented by one). For size, pick something reasonable. I picked 512M since I have 384MB of memory. If you will only have 128MB, 160M or 256M is probably reasonable (1.5x the amount of RAM is the usual modifier). For partition name, type 'swap', and it will figure out the type for you. Hit 'p' for a printout, and you'll need the total number of blocks left in the free partition. Use this number as the length of the last partition. Use 'c' again to create the last partition for the Linux root, and name it '/'. It'll figure out the type for you.

Now partitioning is over, hit 'p' to make sure everything is correct, and then hit 'w' to write it to disk. Pressing 'q' will quit, and you can continue with the rest of the installation.

The rest of the installation is easy. There's no need to load any modules, just install the base system and configure it, etc.

Don't reboot when you're finished.. Once you're done configuring, drop to a shell. We have to install the yaboot boot loader manually since the Debian installer seems unable to do it automatically like it does on x86 systems.

yaboot config

There are more references for yaboot that are probably better than my explanations, but this should get you going.

What will become your '/' in Linux is now mounted on '/target'. You'll need to edit '/target/etc/yaboot.conf'. There's no vi or emacs (or pico, etc) on the debian image, so you'll have to use 'ae'. Type 'ae /target/etc/yaboot.conf'.

Change the boot= line to boot=/dev/hdaXX where XX is the bootstrap partition. Change the install= line to install=/target/boot/yaboot. Change the magicboot= line to magicboot=/target/etc/ofboot.b. I'm not sure why this isn't /etc/ofboot.b by default as ybin can't seem to deal with symlinks. You have to add '/target' since that's where the root directory is currently mounted. You should change this once you boot for real (just delete the '/target' part from each line). In the image section, change the root= line to root=/dev/hdaXX where XX is the partition number of your linux root partition. Change the partition= line to partition=XX where XX is the partition number of your Linux root partition. Add the line 'append="video=ofonly"' so that you won't have to keep remembering to type 'linux video=ofonly' every time you boot (you also won't need this anymore with newer kernels that support the ATI framebuffer).

Once that's done, save yaboot.conf. At the command line type 'mkofboot -v -C /target/etc/yaboot.conf'. This will ask you if you're ready, and willing to erase the bootstrap partition. You should double check it thinks the bootstrap partition is the same one that you think it is before you hit 'y'. This will format the partition as HFS, copy yaboot, yaboot.conf, and ofboot.b to it, and 'bless' it so that Open Firmware will boot from it. Once you've finished, exit the shell and reboot.

Note: most of the yaboot/ybin docs mention updating nvram. Debian Potato's exceedingly ancient yaboot/ybin doesn't support this as far as I can tell, but soon you'll upgrade these tools and the new tools do have this functionality.

booting into linux (yay!)

When you reboot, hold down Command-Option-O-F again. This time type 'boot hd:XX,\\yaboot' where XX is the bootstrap partition number. If all has gone well, this will boot you straight into linux, and you can finish the Debian install.

configuring and updating debian

If you're running linux on the iBook2 you're probably not interested in anything called 'stable'. I chose to install nothing but the base install of Debian, which I then upgraded to 'testing' (aka Woody). There are a few small hills to climb thought.

First, your Airport card (if you have one) won't work yet. It's was not supported until recent kernels. Your built in ethernet will (albeit with some errors) work, but not yet for some reason I haven't yet determined. If you are staying with potato/stable you'll probably want to install enough stuff to get a new kernel and compile it. At a minimum you'll want C development (task-c-dev) and maybe rsync. After you're done with post-installation configuration, reboot (type 'reboot' after logging in) and do the Command-Option-O-F dance (it feels like you are playing that chord that sounds!) again and type the magic boot string that got us into Linux before.

Once it boots, you should be at a login prompt, so login as root. You can now (probably, as this didn't work for me once out of about 10 installs) ifconfig and route your eth0 interface so that you can get on the internet.

At this point much of the hard work is over. If you're sticking with potato, suck down a kernel from one of the sources below. If you're dist-upgrading to woody/testing or to sid/unstable, do so now, and be sure to install enough things to compile and get a new kernel (gcc, rsync, etc). You'll also want a new yaboot in either case, so get that too along with the 'powerpc-utils' package (which gives you the nvram updater).

Update your /etc/yaboot.conf and take out the '/target's that are no longer necessary. The updated yaboot package has things in slightly different places, so here's the top of my yaboot.conf that accounts for this:

boot=/dev/hda11
device=hd:
timeout=20
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot
Be sure to change your boot= line appropriately. With the new yaboot.conf saved, run ybin to update the configuration. This time you should see the NVRAM update message.

At this point, Linux will appear in your boot menu when you hold down 'option' while booting. The first time you boot after a ybin update, Open Firmware will error with 'ALLOC-MEM is too big' (at least this is what happens on my system). This looks like a bug, and the way to fix it is to type 'set-defaults' at the Open Firmware prompt where it dumps you. Reboot and it should then work properly.

macos9 vs linux

This section is based on information that I've heard. I currently haven't tested booting different OSes enough to know the definitive answer. Once I do, I'll update this section.

If you boot into MacOS 9 from the boot menu, it will unbless your bootstrap partition, and Open Firmware will no longer see it automatically (although you can still boot to Linux manually with Command-Option-O-F and the magic boot string). Running ybin in linux will bless it again, but this is highly annoying. There are a few workarounds, but no really good ones. The one that seems to work best is to put a copy of 'Finder' and 'System' from OS 9 in your bootstrap partition (this looks like a normal disk to OS 9, so just drag and drop). OS 9 will then think it's another OS 9 system folder and not unbless it.I think this will work, but I haven't tested it. There are many reports with conflicting information. I don't use OS 9 enough for this to be really annoying. This is a pretty common problem, so asking around is likely to get you better answers than I have written here. If anyone knows a definitive solution, please let me know.

a new kernel

Now you'll need a new kernel if you want to use the Airport card or get the eth0 device from spitting out errors. The best place to get new kernels is penguinppc.org. Currently, I am rsync'ing kernels from benh's development tree. These seem to work very well. Once you grab the kernel, compile it. For people used to make bzImage, compressed images are not needed on PPC and 'make vmlinux' is the preferred way to build kernel images. Copy things to the right places (this is standard operating procuedure for installing kernels, and if you need help, please consult one of the kernel tutorials), update yaboot.conf (you'll probably want to add a new image entry for the new kernel, so that you can boot the old one if something goes wrong), run ybin and reboot. Add 'airport' to /etc/modules (or just 'modprobe airport' as root), and then the airport interface can be configured as eth1. Install the wireless-tools package for more Airport goodies.

xfree86

Now that you've got Airport running (or normal ethernet if you don't have an Airport card) and a brand new kernel (which has support for the ATI framebuffer 'aty128fb'), you can begin to make this into a usable Linux system. Install X. Here's my XF86Config-4. The trackpad is a USB device, and is device /dev/input/mouse0. The only resolution the iBook2 supports is 1024x768, but you can probably run it at whatever bit-depth you desire. I choose 24 (somewhat arbitrarily).

power management

Install 'pmud' and 'pmud-utils' to get the powerpc power management stuff. DO NOT RUN APM. Best probably not to even install it. Once you have pmud install (I didn't have to configure it), you need to fix the power control scripts, as by default they halt the machine instead of sleep. In /etc/power/pwrctl in the pwrctl_Core99 function, change wakeup and sleep to look like this:

        sleep)
        ;;
        wakeup)
        ;;
pmud already takes care of sync'ing disks, but apparently there's a bug in it so that it syncs after it sleeps. This has already been reported, and will hopefully be fixed.

Note that if you are using one of benh's fine kernels, the brightness buttons Just Work. And very well. Even in the console. Also, recent benh kernels also have APM emulation.

mouse buttons

To configure a key or keys to be button2 and button3 of your mouse (which you'll need to do if you plan to right-click at all), you'll need to edit /etc/sysctl.conf. You can look at mine. Run 'sysctl -p /etc/sysctl.conf' to make the settings active. To figure out the actual keycodes to use for each button, you'll have to use brute force searches. I couldn't get the standard key event printing tools to give me numbers that worked. I ended up accidentally binding mouse2 and mouse3 to all sorts of random keys before I found the right ones. In my configuration, mouse3 (right button) is bound to the enter key just right of the spacebar. My mouse2 (middle button) is bound to F11. The reason it's not bound to F12, is that F12 doesn't generate a scancode unless you hold down the function button, which I think is a bit strange. So F11 is more convenient, since it doesn't require two key presses. These key codes are probably completely different for everything but the iBook2. Have fun finding yours if these don't work.

sound

See the sound page for more details, but the gist of it is that you're out of luck for now. I'm working on researching/implementing a driver for the iBook2 sound hardware (tiBook sound supposedly works but doesn't have a mixer), but until then, you'll have to do without, or buy a linux supported usb audio device (there are several available and they are cheap (the iMic supposedly works well)). The good news is there seem to be adequate specs to implement a driver based on the research I've done so far. Although, the fact that no one has yet been able to implement a working mixer on the original iBook or the tiBook might be a bad omen. Check the sound page for updates.

online resources


These pages copyright (c) 2001 by Jack Moffitt.

Questions? Comments? Contact me.