Sponsored Links

Linux on an OldWorld Power Mac

22nd Mar 2006, 19:07:12

By James Stocks

How I installed Debian Linux on my Power Macintosh 9500/180MP

My 9500 has two 180MHz PowerPC 604e chips and to make the most of them, it really needs an OS that is multiprocessor aware. Good as it is, the classic Mac OS just doesn't cut it in this area. Linux on the other hand, has excellent SMP capabilities, so let's install that.

This was, by a long way, the most difficulty I have had installing Linux on any computer, it took me about four hours to figure it out. If you have a NewWorld Mac you might find this more useful.

The first thing to do is erase and parition the hard disk. You will need a Mac OS partition to boot linux from, so I created a 300 MB Mac partition and left the rest of the disk as unallocated. If you have a whole disk you can devote to Linux, so much the better, but you'll still need a Mac OS install somewhere to boot from. What ever you decide to do, be sure to make a note of your Disks' SCSI IDs, you'll need them later.

I installed Mac OS 8.6 on the 300MB partition, but this would work the same with just about any Mac OS too.

NOTE: If you have a dual processor Mac, save yourself a lot of time and don't install OS 9. A multiprocessor aware Mac OS will steal the second CPU and Linux will not see it, you'll just see Processor 1 is stuck. This means use 8.6 or earlier!

Version 7.0.3 is the last version of Stuffit that worked in 8.6, so I grabbed that first.

Unstuff the BootX archive and drop the Extension, 'Linux Kernels' folder and the Application (really a control panel) into the system folder.

Copy initrd.gz and vmlinux from the /install directory of the Debian netinstall CD to System Folder:Linux Kernels. Rename initrd.gz to ramdisk.initrd.gz and reboot your Mac.

When you reboot, you'll be shown the BootX interface. It defaults to loading Mac OS after 10 seconds, so if you miss it, run BootX from the control panels folder. in BootX, Click Options -> specify ramdisk -> ramdisk.initrd.gz. Click OK then the Linux button and you should be shot into the Debian Installer.

The installer is a curses based system (you'll be cursing alright), you use the arrow keys and the tab keys to move around, space to toggle options and enter to confirm. First of all, you'll be asked to choose your Country, Language and Keyboard layout.

Next, it's necessary to set up the network. If you have DHCP set up, your network card will configure itself, if not, you'll have to supply an IP address, netmask, gateway. You will also be prompted to choose a hostname, this is just the name of your Mac, choose something short and friendly like '9500' or 'Dave' or whatever. If you don't have a domain, just use 'local'.

Now comes disk partitioning. If you have an entire drive to dedicate, choose to erase a whole disk, if not, slect 'Use largest continuous free space'. When prompted for a partitioning scheme, choose 'All files in one partition'. Now select 'Finish partitioning and write the changes to disk' and confirm by choosing 'yes'. This is your last chance to back out before data is written to the disk.

Next, Debian goes off and installs the base system. Make some coffee.

When the base system is installed, it will complain that there is nowhere to put quik. Do not worry, we're not going to need it. Just dismiss the message and move to the next stage (continue without bootloader).

Make a note of the partition mentioned (in my case /dev/sda6) and continue. Choose Continue to reboot into the Mac OS.

Strange as it sounds, you need to Run bootx with the same settings as before, so that the installer starts again. This time, choose the language and all that rubbish until you reach the part where it detects your hard disks, then press esc (or choose go back) a few times until you reach the main menu. Choose 'execute a shell'.

We need to get a copy of the kernel from the Linux partition onto the Mac partition, which involves mounting the Mac partition from the installer. If you don't understand, type the following commands:

Note that mount part6 refers to the partition number of your Linux partition, it might be different on your Mac. Also target0 assumes your hard disk has a SCSI ID of 0 - adjust as needed. If your Mac OS partition is the first one on the disk, it is always partition 5.

Now, abort the installation and reboot into the Mac OS, choosing Mac from BootX.

Open the 'Linux Kernels' folder in your System folder and move vmlinux and ramdisk.initrd.gz to the trash. Now, move the files from the 'deb' folder in the root of your hard disk into the Linux Kernels folder, don't forget to rename initrd.img to ramdisk.initrd.img

Run BootX again, and select the new ramdisk. Hopefully, you should boot into Linux and the second half of the install can continue.

Your clock is not set to GMT, do not answer 'yes' even if your timezone is GMT! Select your timezone as appropriate.

Now it's time to set a root password. This should be something hard to guess but easy to remember - ideally with a mix of letters and numbers. Type in your full name when asked for a user name. You'll be asked for a username next, this is the short name you actually use to log in to the system. Choose a password for your new user.

Choose not to scan in another CD, but do add another apt source. http is usually the easiest method to connect to APT, and you should select a mirror close to you, ftp.yourcountry.debian.org is a good bet. If you have a proxy (you probably don't), specify it like http://user:pw@172.16.0.111:3128

You'll see a lot of lines scroll up the screen as APT retrieves parts of the OS over the internet. This might take a long time if you have a slow connection.

You'll be asked if you want extra packages. If you intend to use a GUI, select 'Desktop Environment' which installs Gnome and some other stuff like OpenOffice.org, this takes up hundreds of MB. If you don't want a GUI (or don't have enough space like me!) just leave everything unchecked, it's very easy to install them later instead. When you're asked about mail, just say you are not on a network, if you want to set up mail later you can still do so.

Now you can log in! Log in as 'root', but don't make a habit of it!

Type in the following commands: (note that '#' means 'at the prompt', don't actually type the character '#'!)

# apt-get update
# apt-get -y install sudo vim
# visudo

The last command, visudo, invokes the text editor vi. Use the arrow keys to move to the very end of the file and then press 'o'. Now type in:

stocksy ALL=(ALL) ALL
Defaults env_reset

replacing 'stocksy' with your own username. When you are happy, press 'esc' and type :wq and press enter. If you make an error, press 'esc' twice and type :q!, then type visudo again.

Now type exit and log in as yourself. You should never have to log in as root again, doing so is dangerous, because it's too easy to make an error and mess up your whole system.

Since I have more than one Processor, I need the SMP kernel. Do not install the SMP kernel if you have only 1 CPU, it will not help you! We don't need to compile it or anything silly, just retreive it from the APT repository:

How do I get it to boot Linux by default? When it boots Mac OS, catch the BootX screen and press tab so that 'Linux' has a thick border around it. Save the settings as default.

What about a GUI? This is a Macintosh afterall! The x-window-system is the best way to get that, so install it with apt-get. It'll ask for the identifier of your video card, this is different for everyone. Switch to another console with option+f2, then type lspci.