LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices



Reply
 
Search this Thread
Old 01-06-2008, 12:41 PM   #1
valebilris
LQ Newbie
 
Registered: Jan 2008
Location: north-east Italy
Distribution: Slackware
Posts: 11

Rep: Reputation: 0
Post 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 ) howto.
Googling around and spending much much time erasing and installing and erasing and installing ... I found some interesting things:
  1. an apple machine that borns with an os will never run an older os (macbooks included)
  2. rEFIt is only able to boot oses from the first 4 partitions on the internal disk (and from dvd-drive, and maybe from usb)
  3. leopard, which you pay for when you buy a macbook, and which you want to use, wants to be installed in one of the first 4 partitions
  4. leopard uses the first partition with a fat fs in it but leaves it empty (maybe for windows!? ...don't know)
  5. leopard needs to format your drive with EFI GPT UUID partition table (or whatever it is called )
  6. windows needs of course to be in a privileged position, and at this time I'm trying to install it...
  7. a boot partition for grub, which makes all your Linux work, must be within the first 4 partitions

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:
  • Slackware install dvd
  • Ubuntu 7.10 cd (NOT ALTERNATE, it didn't work for me!)
  • rEFIt (dmg version for osx)
  • a macbook, of course
  • kernel source
  • a working Linux console
  • lots of patience and time

I assume you know how to:
  • make a bootable custom slackware dvd
  • burn your bootable cds/dvds
  • compile a kernel
  • use vi
  • do many other things that I don't remember by now
If you don't, maybe you also don't need a 9 partition macbook =)

Before starting:
  • compile the kernel with support for GPT partitions and all mac stuff, with all your needs. Don't forget usb support which you'll need for backups etc!
    If you don't know what you need you can open extended info in osx (preinstalled or after step 1) or by putting in Ubuntu cd, booting it and "lspci -v" from a terminal, which, of course, is the better way
  • make a custom Slackware dvd with kernel just compiled
  • try it by putting it into dvd-drive and pressing alt (option key) when booting, it should boot and give you a console. try also parted (fdisk and cfdisk don't support GPT partitioning so, forget them.
  • please read all the steps before starting. There are missing parts for which I apologize.
  • I am not responsible for damages you do to your hardware/software and listed below is what functioned for me, I simply don't know how and if it will work on other configurations.


Let's start!
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:
  • sda1 - 200MB fat32; well, actually I didn't, leopard's diskutil did...
  • sda2 - 300MB ext3; /boot partition with grub and kernels
  • sda3 - 70GB hfs+; this one is for osx
  • sda4 - 40GB xfs; /home
  • sda5 - 80GB xfs; this is for all other files
  • sda6 - 15GB xfs; this is Ubuntu's root
  • sda7 - 13GB ntfs; xp
  • sda8 - 1GB swap; this should have been greater (I have 4gb ddr2...)
  • sda9 - 20GB xfs; last but not least Slackware's root
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
sh /efi/refit/enable.sh
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 .

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
cd /install
tar xzf /mnt/cdrom/slackware/a/pkgtools*.tgz
tar xzf /mnt/cdrom/slackware/a/tar*.tgz
export PATH=$PATH:/install/sbin:/install/bin
cd /mnt/cdrom/slackware
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):
cd /mnt/linux
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:
chroot /mnt/linux
passwd root
adduser


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:
title slack12
kernel /MB2.6.23.9v0.1 root=/dev/sda9 ro
root (hd0,1)


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.

Install grub:
grub-install /dev/sda2


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:
  1. set manually your partitions;
  2. install the boot loader in your boot partition (not /dev/sda because this would take you to a non-booting system);
  3. let the installer format your /boot partition (that's why we did the backup!);

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:
parted /dev/sda

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:
  • sda1 - 200MB fat32; EFI
  • sda2 - 13GB ntfs; xp
  • sda3 - 67GB hfs+; leopard
  • sda4 - 300MB ext3; /boot
  • sda5 - 20GB xfs; Slackware /
  • sda6 - 30GB xfs; /home
  • sda7 - 15GB xfs; Ubuntu's /
  • sda8 - 90GB xfs; this is for all other files
  • sda9 - 4GB swap; I have 4gb ddr2
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 .



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.
 
Old 01-06-2008, 03:59 PM   #2
valebilris
LQ Newbie
 
Registered: Jan 2008
Location: north-east Italy
Distribution: Slackware
Posts: 11

Original Poster
Rep: Reputation: 0
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.

Last edited by valebilris; 01-09-2008 at 01:24 PM.
 
Old 01-24-2008, 01:40 PM   #3
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 494

Rep: Reputation: 75
Hi Valebilris,

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?

Best regards,
Angel.
 
Old 01-25-2008, 02:17 PM   #4
valebilris
LQ Newbie
 
Registered: Jan 2008
Location: north-east Italy
Distribution: Slackware
Posts: 11

Original Poster
Rep: Reputation: 0
well, actually I've heard the first time about PRAM from you 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.
 
Old 01-29-2008, 06:30 AM   #5
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 494

Rep: Reputation: 75
Thumbs up Solved

Hi Valebilris,

I finally found the solution to my problem "rEFIt"
http://refit.sourceforge.net/

So every one which has the same issue can use it, it just work.



Best regards,
Angel.
 
  


Reply

Tags
macbook, slackware, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux on a macbook/macbook pro... any experiences/problems, or is it even necessary? enigma_0Z Linux - Laptop and Netbook 13 09-14-2007 11:29 PM
Dual-Booting Debian on a MacBook Dranorter Linux - Laptop and Netbook 3 02-13-2007 02:49 AM
Linux on MacBook (intel) zeky Linux - Hardware 2 09-17-2006 09:42 AM
macbook and linux unlovedwarrior Linux - Laptop and Netbook 0 08-03-2006 10:25 AM
Dual booting Linux and Mac OS X on MacBook. jaakkop Linux - Hardware 5 07-20-2006 04:00 PM


All times are GMT -5. The time now is 08:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration