MacBook dual Linux installation ...and if you want many others!
After having big troubles with installing Linux on my new macbook I decided to post a simple (and incomplete :cry:) howto.
Googling around and spending much much time erasing and installing and erasing and installing ... I found some interesting things:
My problem was that EVERY howto is for installing a single linux in only ONE partition :(, which can be a problem for many reasons, unless you install osx and/or windows on an external drive or things like that which I din't like.
My configuration now is 9 GPT partition with Slackware-current, Ubuntu 7.10, osx and an empty partition for windows (which I haven't installed yet). The 3 are booting and running, but I'm still configuring them, so this guide won't help you configuring your macbook; for that you can google around.
What you need:
I assume you know how to:
First step: Install osx.
By doing this you have to use DiskUtil, osx's tool for partitioning disks, which is available after agreeing with license from the upper menu. With that tool you have to make your partitions as would be in your final configuration.
Personally I made 8 partitions in my 250gb disk, with different sizes, for different needs. This is the result:
The first one is hidden and made by default by leopard.
Note that diskutil leaves some empty space around the disk, between partitions (of course you'll notice that later, not within apple's tools).
You can leave future Linux partitions unformatted (in leopard they have taken away the possibility to create Unix partitions, so leave them empty), we'll format them later.
Using Tiger for partitioning and then installing leopard would end to a waste of time, because leopard needs (as said above) certain things for installing (tried also that way).
After partitioning your disk you have to install leopard and configure that, do whatever you want but do steps below
Second Step: Install first boot loader.
Download and install rEFIt just like any other osx application but remember to do
which blesses your drive.
Third Step: Install Slackware.
Put your brand new Slackware dvd into the drive and boot it (it should appear as a choice from rEFIt's menu; if not, reboot).
make a backup of your osx installation or the entire drive with dd.
save your partition table:
dd bs=512 count=10 if=/dev/sda of=/<somewhere-in-some-external-drive>
count=1 should be enough but I love doing space-wasting secure things :cool:.
dd bs=2048 if=/dev/sda of=/<somewhere-in-some-external-drive>
if you want all your drive, if=/dev/sda1 2 3... takes only one partition (which at this point is faster and safe, but remember sda with count).
After backing up you have to mount your Slackware partition somewhere
mkdir /mnt/linux /mnt/cdrom /install
mount /dev/sda9 /mnt/linux # sda9 is my Slackware /
mount /dev/hda /mnt/cdrom
tar xzf /mnt/cdrom/slackware/a/pkgtools*.tgz
tar xzf /mnt/cdrom/slackware/a/tar*.tgz
for dir in a ap d f k l n x xap; do cd $dir; installpkg -root /mnt/linux *.tgz; cd ..; done
Now you have to create your fstab, copy some stuff (like your kernel):
echo "/dev/sda9 / xfs defaults 1 1" > etc/fstab
mount /dev/sda2 boot
cp -r /boot/* boot/ ## initial kernel from live cd
cp -r /lib/modules/* lib/modules/
and run all necessary scripts, which I apologize, i don't remember but it looked like:
etc. I'm sorry I can't find the bookmark with the appropriate howto, but I'm sure you'll find it on the web =)
Fourth Step: Install second boot loader.
Boot from Ubuntu cd and open a terminal.
mount /dev/sda2 /boot
cd /boot && mkdir grub
echo "(hd0) /dev/sda" > grub/device.map
create a file /boot/grub/menu.lst like this:
kernel /MB220.127.116.11v0.1 root=/dev/sda9 ro
and other stuff that you will find around like timeout=321 etc.
Note that (hd0,1) stands for /dev/sda2, which is the partition with your kernels, grub files, etc.
Grub must be installed on your boot partition and must be chainloaded from rEFIt. For me that was the only way it worked properly.
Reboot and you will find in rEFIt a penguin icon with the words "Boot Linux from Partition 3". enter it, wait few seconds and grub should appear. You should also be able to boot your Slackware Linux. Boot it and make a copy of /dev/sda2 (your boot partition) with dd as above, before moving to step five.
Fifth Step: Install Ubuntu.
Boot your Ubuntu cd and follow the installation being careful of three things:
In the way you like (eg. by booting your Slackware dvd, which is by far faster than the Ubuntu one) restore your /boot partition simply inverting "if" and "of" in the command you typed to back it up.
Sixth Step: Setting up loaders.
Reboot using your Slackware dvd and enter in parted:
Now you have to do nothing but write your partition table, for example by unsetting a flag that is not set: set 8 boot off
This is done because partitioning tool from Ubuntu does something I ignore and changes the partition table in a strange way.
Set up all your kernels in /boot/grub/menu.lst.
Note that for me changing root=/dev/sdax with root=UUID=really-not-human-understandable-thing (which is Ubuntu's default) ended in a kernel panic, so I changed all default UUIDs in /dev/sdx. Also tried grub 1.95: it compiled and installed ok but it stuck waiting in its shell when booting.
Reboot again in osx by holding alt key at boot time and restore refit using enable.sh as above.
Reboot again and enter rEFIt's partitioning tool to update AGAIN your partition table.
Seventh Step: Installing windows.
I tried booting xp's cd but it found only the first 3 partitions on my drive. I Said the first three because xp sees some empty space (few MB, left by diskUtil) as a partition
I tried installing it into a different dirve and then copying with dd the entire partition over sda7 but I've only ben able to mount it in Linux, not to boot it as rEFIt boots only oses from first 4 partitions and grub simply didn't do the job.
I tried mapping the drive but the only thing happened is that grub restarted himself.
I tried mapping drives and booting the cd but somehow grub doesn't let me do that... googling around I found that you can only boot cds from other bootloaders by chainloading them after grub, so
I tried one of them and it did the same as rEFIt, it somehow canceled grub's mapping and booted the cd.
Yesterday I have bought a huge disk for backup and I'm going to remake all paritions, like this:
By this way windows partition is moved to the first three, resolving (hope) that problem. Better in partition 2 because it sees your disk as a strange ...thing.
Swap partition has grown to 4GB because of the hibernate feature and because they say so :rolleyes:.
Eighth Step: Enjoy.
I hope this will be appreciated by someone, who, like me, bought a macintel and messed up with those stupid limitations imposed for some strange reason by a company that wants to make unhappy Linux users. :tisk:
If you want to restore all your stuff or just try another configuration, leopard's diskutil crashes when trying to modify partitions. Fortunately dd comes to help! use it to overwrite the first kb of your drive that magically becomes writable. I'm doing this by the time I'm writing and guess what? ...this is not the only thing that doesn't work. After that you have to reboot because the installer is not able to see changes made...
Installing it again I found that diskutil don't let you make partitions smaller than 1GB, so I think at the time I did that I left empty space on the drive and partition it with parted... let me try...
...done partitioning, waiting for osx installer...
ok, it sees all partitions made (with parted) and after erasing the third partition (look at my second partition table posted) it finally became green!
after reinstalling the whole thing I found Ubuntu installer to install grub properly, and installing it from Slackware extras leaded me to a "Loading stage 2..." stuck grub...
Sorry for having said wrong things.
This is quite a nice one, however I still have few unanswered questions.
If you may help to answer them that would be wonderful :)
If I follow you correctly:
1 Does that mean that the SDA2 is the default boot partition even after a "rest PRAM"?
2. I've installed Linux on my iMac, every thing was fine until I reset the PRAM. now it keep booting on Mac OS and I can't access my Linux partition (which have a boot flag and was working fine before the reset PRAM)
Here is my partition table:
1 sda1: EFI
2 sda2: OSX Leopard (~40Gb)
3 sda3: ubuntu (~190gb)
4 sda4: SWAP (1Gb)
PS: I know this is a crappy design for partitions, I'll improve it later.
Anyway, using the beautiful Apple "startup disk" he doesn't see my Linux bootable partition (which I've boot on it many time until I reset the PRAM)
so here is my question:
how can I make my iMac to boot on the "sda3" partition?
well, actually I've heard the first time about PRAM from you :scratch: but from what I've found here http://docs.info.apple.com/article.html?artnum=2238 it contains simple infos.
Maybe just reinstalling rEFIt (you didn't mention if you've installed it) with "sh /efi/refit/enable.sh" would do the job.
This is the first thing I would have tried.
For me the only partition with boot-flag set is the first, from what I can see in parted. other partitions have no flags.
rEFIt finds the other 3 partitions (sda2 3 4) and boots them with no problem.
I finally found the solution to my problem "rEFIt"
So every one which has the same issue can use it, it just work.
|All times are GMT -5. The time now is 01:54 AM.|