Thursday, November 24, 2005

NAILED: HOWTO install bootable mac ubuntu on your external firewire harddrive

This is version 0.1 of this document.

Purpose and Rationale

To explain to you, the eager Mac linux noobie, how to get your Ubuntu system of your dreams up and running. I am performing the surgery on a dual 800 G4 mac; YMMV. The idea is to be able to install Ubuntu onto an external firewire drive so you don't have to trash your existing Mac OS X set-up. I use my Mac to run Logic Pro, so I had no interest in re-partitioning my internal hard drives. I am also a software developer and wanted to be able to use familiar Linux tools and not have to mess with weird Darwin/BSD hack arounds for my projects.

Known Issues

I don't currently have instructions for how to download, build, and install a debian linux kernel with the SCSI stuff compiled in (rather than built as a module). Thanks and praise are due to Brent Stephens who hooked me up with the deb packages I needed. I am a Redhat hacker by trade, so I am new to all this debian stuff.

I plan on creating a condensed HOWTO to explain how to download, build, and install a debian linux kernel at the "yaboot install failure" juncture. For now, you'll have to rely upon the kindliness of strangers to provide you with the necessary

Background

A quick and dirty explanation of why you can't just install Ubuntu to your firewire drive. Nerds, feel free to correct my crude explanations. Be sure to flame me for how stupid I am to further enhance my impression of engineering culture. No cynicism here, no siree bob.

I know this explanation is crap, but it gives a high level explanation of some kind. Ubuntu is designed to work with a kernel image. The kernel image lives on your hard drive. In order to access your hard drive, the bootstrap process needs to be able to access the SCSI drive on which your kernel lives. If the SCSI code for the kernel lives in a module, the kernel image won't be able to find itself, and you're screwed.

The bootstrap thingy is called yaboot. It creates a Mac-readable partition known as a bootstrap partition. It has special magic powers that enable it to find a linux kernel image when you provide it with the path to the image. Apple uses something called Open Firmware, which is a very rough and tumble boot loader among other things. One tricky bit about this whole business is that you have to provide yaboot with Open Firmware paths to your image, which is a relatively obscure activity that the Ubuntu installer doesn't know how to deal with. So it will die when it tries to perform the sacred ritual known as installing yaboot. Ubuntu just uses plain old /dev/sdX, and mkofboot needs Open Firmware (I'll refer to it as OF) paths in order to work.

Another note is that the usual way to boot up linux is to use an initrd, which I think is a bootstrap kernel that gets loaded into memory, which then finds your real kernel (/boot/vmlinux). What we're doing here doesn't require initrd, which maybe one day we'll both understand how cool that is.

Make it work for me dammit! I want my Mommy

You need to roll your own yaboot.conf and install it, but that's easier said then done. Here's some step-by-step with some generous hand holding. Be sure to do some t'ai ch'i breathing and review your typing carefully. Welcome to the real world, boys and girls. Btw, once you get this thing up and running, you'll never have to deal with this crap again. You can happily use all the friendly Ubuntu GUI stuff afterwards.


Credit where it's due: Brent pointed out this article which was really helpful, but it is intended for hackers in the know.


      Follow the usual instructions to download and burn an Ubuntu install CD iso.

      Begin the install process by restarting your mac with your iso in the drive. Hold down 'C' to boot off of your CD-ROM.

      Go about the installation tasks as usual -- follow the wiki above if need be. Be sure to make a note of the BOOTSTRAP partition and the ROOT partition. For me, these were /dev/sda2 and /dev/sda3, respectively.

      Your install will crap out when it tries to install yaboot. Now the fun begins. Drop to a terminal by typing "alt-f2" (aka option-f2).

      Note: this doc will be updated since we can't count on Brent Stephens to leave these deb packages lying around forever. I'm making these notes for posterity.

      Type chroot /target

      You need to figure out the OF path of your FW drive. Type "echo /proc/device-tree/pci*/firewire*/node*/sbp-2*". Write down what it says carefully and legibly.

      Type "apt-get install wget". Make sure your cdrom is still mounted and all that jazz. If it got ejected, apt-get will magically remount it so don't worry about it.

      Type "cd /tmp", then type "wget http://brent.warehouse6.com/misc/kernel.tbz2"

      Type "tar xvjf kernel.tbz2".

      cd into that dir, kernel-2.6.14.2 or something like that, mine is blown away now

      type "dpkg -i *". you can ignore whatever warning messages safely.

      Now you need to make your yaboot.conf. Use your favorite editor, like vi /etc/yaboot.conf. In the file, put the following:

      boot=/dev/sda2

      Unix path to the bootstrap partition (Note: this will be where ever you put it, as noted above)

      ofboot=fw/node@00d04b4a1905397c/sbp-2@c000/disk@0:2


      Open Firmware path to the bootstrap partition. Remember the output from the "echo /proc/device-tree/..." command? Follow my example above for formatting help. The number 2 in my example is the bootstrap partition. Like /dev/sda2 means use the number 2 at the end. You can ignore everything before the node part from the output of the echo command.

      ofdevice=fw/@00d04b4a1905397c/sbp-2@c000/disk@0:


      Open Firmware path to the root partition, more or less. You specify the actual partition next, this is just the path to the device.

      partition=3


      number of the root partition (like mine is /dev/sda3, so use the number 3)

      Now there's some stock stuff that goes in here which I'm not going to explain. just do it.


      timeout=40
      install=/usr/lib/yaboot/yaboot
      magicboot=/usr/lib/yaboot/ofboot
      default=linux
      macosx=/dev/hda5 --> if you edit /etc/yaboot.conf, you'll find ubuntu's attempt at this file. Find the value for macosx in there. don't just copy what I put.

      image=/boot/vmlinux
      label=Linux
      root=8:3
      append="rootdelay=10"


      Ok, that "root=8:3" part is tricky. Go here to figure out the correct values for your installation.

      My yaboot.conf:


      boot=/dev/sda2
      ofboot=fw/node@00d04b4a1905397c/sbp-2@c000/disk@0:2
      ofdevice=fw/node@00d04b4a1905397c/sbp-2@c000/disk@0:
      partition=3
      timeout=40
      install=/usr/lib/yaboot/yaboot
      magicboot=/usr/lib/yaboot/ofboot
      default=linux
      macosx=/dev/hda5

      image=/boot/vmlinux
      label=Linux
      root=8:3
      append="rootdelay=10"


      Ok, now you must install this gizmo onto your bootstrap partition. Type "mkofboot -v" and hope it works! You should see some promising output.

      Switch back to the install by pressing alt-f1. Bail out of there and restart. Hold down ALT + APPLE KEY + O + F to get to the OF bootloader thingy.

      At the bootloader, type "boot fw/node/sbp-2/disk@0:2, yaboot" substituting YOUR bootstrap partition for the number 2 in the disk@0:2 part.

      Type "mac-boot" or "mac-start" or whatever it says, it tells you in the OF boot thing, I'll look it up later.

      Congrats, you're at the yaboot prompt. The screen will flash and your computer will convulse for a minute. when you get the "boot:" prompt, type Linux and go! The Ubunutu install process will magically continue.

18 Comments:

At 7:58 AM, Anonymous Anonymous said...

Brent Stephens here.

I don't know about your install, but on mine booting into Open Firmware is unnecessary. yaboot 'just works' with my install. I'd venture to guess it does for you too. In fact, its so reliable (hasn't failed yet) that I put my timeout times down to 1 so the boot process is faster.

 
At 3:05 AM, Anonymous Anonymous said...

Basscackes, this was the solution for a problem I also had tried to solve for a long time. Thank you for sharing your knowledge!

It has worked for me but there are still a few pending problems.

I have been following your procedure downloading and installing the new kernel but was not able to find the right openfirmware address to put into my own yaboot configuration.
It seems like my firewire address is slightly different than yours however, starting from the Ubuntu CD and typing in at the OF prompt the following "fw/node/sbp-2/disk@0:4,/boot/vmlinux root=8:4 rootdelay=10" did the job.
(pls note that my HD has a HFS+ partition #2, hence bootloader is #3 ext3 (root) is #4 and swap is #5)

Ubuntu installer has finished the job and I was able to work with it for a while completing the install and updating all needed packages (another 94 MByte of download). Just great.

I was planning to fix the yaboot.conf and make the hard disk self launching later on once found the correct addresses for my external disk.

Problem is that it doesn' start anymore.

On (manual) boot, I am getting a Kernel panic saying it cannot mount the root partition.
I wonder if the updater has installed another kernel image without f/w support and that might be the problem.

Any ideas as how to solve this and regain control of the beast?

Thanks Pieter

 
At 7:45 PM, Anonymous Anonymous said...

Please help me, I have been trying to accomplish this for days. We can talk here: http://www.ubuntuforums.org/showthread.php?p=562594#post562594

 
At 12:25 PM, Anonymous Anonymous said...

Excellent idea but not enough newbie for me !!
And by the way the link to the kernel is dead

See comments nuoli's comments here:
http://www.ubuntuforums.org/showthread.php?t=84131&page=2

 
At 1:18 AM, Anonymous Anonymous said...

Hello !
Excellent idea I am looking for something like this since a long time....
But... not enough newbie stepped for me !

And there are some problems:
C.f Nuoli's post here:
http://www.ubuntuforums.org/showthread.php?t=84131&page=2

 
At 11:00 AM, Anonymous Anonymous said...

I was not able to find a "node@..." inside the folder for the firewire device. I'm clueless.

 
At 10:58 PM, Anonymous Anonymous said...

nice work, however, the howto craps out when it comes to using the echo command to retrieve the OF path. it just gives me back /proc/device-tree/.... etc.

Would it make a difference if I use kubuntu?

Cheers
Mikr

 
At 7:02 PM, Anonymous Anonymous said...

had a go at your instructions yesterday.

Some success, some failure.

I've posted a summary and some comments here

Would be cool if you could have a look.

Cheers
Mike

 
At 12:01 PM, Anonymous Anonymous said...

Hi - great directions - only one problem. Everything worked for me, except at the end - when it should have "magically continued the ubuntu install process" it starts linux (bash prompt i think), has me login with my new user and password, and then sits there. No GUI, no continuing installation. Basically the linux command line seems to be up and running. Im a noob tho so - What do I do now?

 
At 12:04 PM, Anonymous Anonymous said...

about previous comment - btw my email address is pdoersch@optonline.net - please dont "allow" this to be posted - do email me if you feel that would be more appropriate. thnx

 
At 4:05 PM, Anonymous Anonymous said...

mokelvey here.

I don't know if you guys are still out there, but I'm trying to install ubuntu Dapper Drake build onto a buss-powered Firewire drive through a 17" G4PPC aluminum for the same reasons - I don't want to mess with the OS X installation and files. Dapper boots to its RAMdisc just fine and all the apps run except the install app stalls at about 15% along the way - not enought to do anything I know how to do with the terminal. Therefore I cannot INSTALL to an external Firewire Disk, much less boot from it. If you can point me in a constructive direction, I would appreciate it.

 
At 8:27 PM, Blogger Eun-sung Lee said...

The Brent kernel link is down. Are you still around? If so, please upload or send me the kernel in some way. I'm e.eunsung at gmail.com .

 
At 3:03 AM, Anonymous Anonymous said...

hey, this is debian+mac

what initrd really does is tells
Linux where and how to find your root
Linux disk or partitions

this used to be very esoterically
handled by mkinitrd but now recently
there are TWO much nicer programs
to handle makeing the initrd. check
'em out (and forget mkinitrd, its
going away soon)

another real handy idea is to make
a *Backup* of macos on your firewire
drive. if you like you can use linux
utility parted to slice a new partition off your disk. then try
booting off that, and once you have
it OK, you can do then work on your
internal drive safely if you want
or need to.

then if you are really nuts once you
have double everything you can run
a raid mirror and double you disk
speed, whenever you want to.

or you can be nuts like me and run
different versions of your os's as
you like...

don't take my word for all this
just check it out.

 
At 11:49 PM, Anonymous Anonymous said...

This comment has been removed by a blog administrator.

 
At 11:49 PM, Anonymous Anonymous said...

I have been trying to install ububtu 6.06 LTS on an external firewire drive, i found tyour blog in my search for how to do this, i have managed to get to the stage where the installed crashes, but the command provided does not give the open firmware address, it says no such file or directory...... also the link to the modified kernel is dead.

 
At 11:49 PM, Anonymous Anonymous said...

I have been trying to install ububtu 6.06 LTS on an external firewire drive, i found tyour blog in my search for how to do this, i have managed to get to the stage where the installed crashes, but the command provided does not give the open firmware address, it says no such file or directory...... also the link to the modified kernel is dead.

 
At 4:02 PM, Anonymous Anonymous said...

Now that Ubuntu 6.10 (Edgy Eft) is out, the process is much easier. The kernel used in Edgy has SCSI support compiled in. (Also sets up yaboot properly.) Just install (alternate install CD is known to work) and go!

 
At 11:06 AM, Blogger imaginarynetwork.com said...

Did you install yours onto a Firewire Drive?

 

Post a Comment

<< Home