Installing Linux on a MacBook without OS X
OK, so I have made up my mind. I’m switching back to Ubuntu. Why is a later post but in short I feel that Ubuntu is a better OS if you are a develope, at least a Python/Plone developer like me. This post is to explain some things about how MacBooks boot, and how to install Ubuntu on a MacBook without having OS X on it as well. Oh, and it’s for whining and ranting as well.
Firstly, you need OS X for your MacBook. OS X is the only OS you can use when updating the firmware of the MacBook, and firmware updates on MacBooks can be very useful. Earlier ones have for example increased the battery life significantly. Those things are nice to have. This means that most people who use Linux as the main OS will dual boot. There are several FAQs out there to do this, so I won’t touch on that. If you want OS X only to update the firmware, you can reinstall OS X on your hard disk skipping everything that is optional, and thus use up as little space as possible. Reportedly it should be possible to have a partition size of 10-15 GB for this. Quite a significant space waster just to keep the firmware updated, admittedly.
However, I want to be able to boot into OS X so that I can test things. Sometimes I get reports that things doesn’t work in Safari, and I quite often gets bug reports on Plone4ArtistsCalendar together with iCal. It’s going to be nice to be able to test those reports myself. So I need more than these 10GB, probably around 40GB. And of course, I need to be able to test websites in Internet Explorer as well. I have done that with a Windows machine I have at home so far, but to be able to do it when I’m at a customers place would be a nice bonus. And of course, there goes another 40GB, and then I suddenly don’t have much space left for Ubuntu. Especially since I want separate root and home partitions (this has saved me once earlier, when an upgrade went pear-shaped).
So, I yesterday bought an external HD. The My Passport Studio has faster transfer rates, so I picked that one, even though it’s MacBook Pro silvery, and not MacBook white. (Wester DIgital has Macbook white external drives too, but only of their cheaper, slower model). Turns out the faster choice was good because it also has Firewire, and I later read that MacBooks won’t reliably boot from USB drives, so that was a lucky choice. I’m hoping this has been changed in the new model MacBooks that doesn’t have Firewire.
Anyway, I then proceeded to try to get Mac OS X onto the external HD (easy) and Ubuntu onto the internal HD. That later part was not so easy. OK, if you let Ubuntu take over the whole HD, by default, it’s going to work, but there will be a long delay for about 30 seconds where the MacBook will seem to not do anything. And if you have an external drive connected or a bootable CD in the drive, it will boot from that, no options. What the heck was going on here?
Well, after many tried, lots of reading on different sites and many retries (today I have installed Mac OS X three times, which takes an hour or more each time, and Ubuntu I think five (maybe more) times, which takes some 15-20 minutes or so, all in efforts to get the right combination of partition tables and software and I don’t know what. And here finally is the explanations.
The MacBook 3,1 and 4,1 will only load from HFS+ partitions. If there are none available, it will sit around for 20-30 seconds while waiting for you to insert one. Yeah, really. Only then will it go on to boot from non-GFS partitions. This is to be honest quite astounding, and completely incomprehensible. It’s yet again one of these “It Just Works (If You Do Exactly What We Tell You To) ™” attitudes from Apple. This means that the primary partition has to be HFS+. Obviously, you can’t install Ubuntu to HFS+. Neither, it seems, can you install GRUB to it. You can of course install OS X on it, which is why this all works if you dualboot, but that takes 10GB of space, see above. But despair not, there is something you can install to an HFS+ partition, which is not a big fat OS and will boot, and it’s called rEFIt. It’s a boot menu for EFI machines, specifically MacBooks. It can be installed on pretty much any filesystem, and since it’s designed to be a multi boot system for MacBooks, it works well in this case. After installation of Ubuntu, rEFIt will see the Ubuntu and you can boot it, without having to wait for half a minute.
Here are the rough steps you need to do (I didn’t do it in this order, as I was experimenting heavily, but this ordet should work, I think). Again, this has been tested on a MacBook 4,1. It seems to NOT be necessary on MacBook swith Intel CoreDuo (1,1 and 2,1). But it seems to be necessary on MacBooks with Core2Duo (3,1, and 4,1. I don’t know about the new 5,1).
- Install Mac OS X on the external HD.
- Boot from the Ubuntu Live CD, start Partition Editor (Under System->Administration). If you can figure out a way to remove, add and control partitions in detail in Mac OS X, you can do that instead, but Diskutils in OS X doesn’t seem to have the necessary control to do this.
- Remove the HFS+ partition from the internal HD (/dev/dsa)
- Create a new unformatted partition (we’ll format it from OS X). rEFIt will use up 14MB, so probably 20 MB is enough. Yes, MB, not GB. I have a 50MB partition for rEFIt.
- Reboot into OS X from the External HD. Format the new partition as “Mac OS Extended” (That’s HFS+). Mount the newly formatted partition.
- Download rEFIt, and follow the instructions to install it on an external HFS+ Volume. At this point you probably want to change the refit.config to have a lower timeout than 20 seconds. 2 seconds is good IMO. You should now be able to boot into rEFIt from the internal HD. If not, something is wrong. You still don’t have any OS installed to boot from though, but if you get the rEFIT menu up, your good.
- Reboot from the Ubuntu LiveCD, and install as usual. Do NOT select “Use entire HD” as this would delete your rEFIt volume. Largest free space should work (although I always use manual, and have separate root and home volumes).
- Done!
This is all and well, and works. The only minor stupidity with this, is that you now have a two-step boot. And to explain why, we must talk about EFI. EFI is the new successor to the BIOS that has been around since the original IBM PC. But of course, not all software that needs to support EFI does that, so therefore there is also a BIOS compatibility mode. EFI also uses a new sort of boot procedure, based on something called GUID Partition Table, or GPT instead of the old MBR one. The booting will revert to MBR if there is no GPT, and in this case it will also enter BIOS compatibility mode (I think).
Now, GRUB is a MBR type loader that uses BIOS compatibility mode. And you have to have it. Because although there is an EFI boot loader from Linux, ELILO, if you boot the machine completely in EFI mode and not in BIOS compatibility mode, you won’t have a BIOS, and lo, the graphics drivers require this, so you can’t run the proper graphics drivers, so graphics performance will suck. And the reason the graphics drivers require this, seems to be that Apple refuse to tell the driver developers how to support the cards without a BIOS.
This sucks, Apple. This, really, really, sucks. I was told that now the MacBook is an open platform where you can run any OS. Well, that is still, unfortunately, bullshit. Apple and their platforms are still not open. Sure, when it comes to the iPhones they have blamed the carriers. I don’t believe that anymore. Help the Linux people write proper ELI drivers for your machines, if you are serious about this. I understand you don’t want OS X running on normal PC’s. You are using OS X as an argument for buying your hardware. If you sold OS X separately your machines would be cheaper and your upgrades more expensive, and that would probably not be good for business. But making it hard to run OTHER things on Macs doesn’t make any sense.
All in all, I can not recommend you to buy MacBooks unless you intend your main OS to be OS X. And I can’t recommend OS X to a developer. Yes, this buy was a mistake.
Trackbacks & Pingbacks
- OS X vs Ubuntu: Ubuntu FTW! « Lennart Regebro: Plone consulting
- Linux auf dem Mac - cbjck.de
- Installing Slackware on a macbook pro
Comments are closed.
It’s fun to read your blog π I came here from Google following a link on HTPC (as I am building one). I too have a MacBook and I too believe that Linux is much better OS for the developer than MacOS. I still use MacOS just to get some experience with this OS, because it is the last MacBook that I bought. I bought it because I believed it is a system that really supports all open source applications and a great platform to run Linux. I am disappointed customer now; I really prefer to work on my old Dell with Linux than on the new Mac. I WILL remember this when the time for buying the next laptop comes…
Hi,
So it’s not possible to install a Linux or Windows OS without having the OS X installed.
I wanted to reinstall my system, and so I formatted the HD. Now it turns out that my OS X cd’s are defect, and that Apple won’t give me new ones, even though they’re not scratched. Which pretty much sucks, because I don’t want to give 150-200 US $ on an OS, I’m not even gonna use! (Gonna install XP through Boot Camp). That means, I’ve got a MacBook without any OS and without the possibility of installing anything other, so is there a way to bypass that somehow?
“So itβs not possible to install a Linux or Windows OS without having the OS X installed.”
Yes is is, as explained above. To follow the instructions above you do need OS X around, at least to boot from the CD’s. But you can ignore this and just install only Linux, for example, but there will be a delay of around 20-30 seconds when you start the computer before it boots if you have a MacBook bought say the last year or so.
I explained this, was I unclear?
You can install Linux on a MacBook without OS X. Just install it like you would install it on any other computer. The only trick is that you have to set a partition as bootable, otherwise the MacBook won’t boot the drive.
(On other computers, you don’t have to do this, since the BIOS doesn’t care about the partition table, and just boots the boot sector and lets it worry about the partition table.)
When you try to boot, it will sit with that gray screen for about 30 seconds before deciding to boot it, and it may instead decide to boot a CD if you have one in the drive. You can speed this up by holding down the option key while you turn it on; then you’ll get the “select what you want to boot” screen, and you can choose your Linux partition (labeled “Windows” of course) to boot, at which point it will boot it immediately.
for anyone who’s interested, if you single boot linux, you can bless the ‘legacy’ boot partition as described here http://ubuntuforums.org/archive/index.php/t-493393.html
this will reduce the ~30 second wait.
i will repeat the command here in case the link goes dead:
5. Insert OSX disc, boot from it, open terminal and enter following:
bless –device /dev/disk0s2 –setBoot –legacy –verbose
where /dev/disk0s2 is the partition you installed grub (do ‘diskutil list’ to find out correct partition). Of course, ‘–verbose’ is optional. This makes Macbook EFI firmware boot your Linux installation in legacy mode without long delay (20s vs 3s).
hope that someone finds this helpful, although, i don’t recommend single booting linux, even though i did it for a long time, and i hate os x, hell, really i don’t recommend getting a mac, but anyway… π
I use OS X to run my chicken webcams to watch my chickens so the monkeys can’t attack them. The monkey are mean to chickens, they like to steal the stem cells out the fertilized eggs and are trying to make some sort of chicken-monkey super race to take over the world.
When I used Ubuntu I could not set up my cam server correctly and the monkeys were making too much progress… I think they are close now… They have almost figured out how the sequence to separate wing stem cells… You know what that means, FLYING MONKEYS! I feel we are all doomed…
Someone forgot to take their meds, I think.
this has worked out perfectly, just what I needed.
I have just tried your guide, took me a while to figure everything out so that I could duel boot, windows&linux, w/o mac. I am now successful. To boot Linux with windows installed, you have to install grub on sda3 : ) that way, Linux will come up in refit. Just a few more cosmetic tweeks and I’ll be done. Thanks
@franki, do you know of a way that cuts out the 40 second boot time in windows 7 on a mac? Thanks
Could not get Ubuntu to work (nor Fedora/CentOS/OpenSuse). I have tried both:
1. Installing refit on a HFS+ partition and then installing Linux on rest of the disk.
2. Installing only Linux all over the disk (no OSX and disk partition table set to msdos).
Both end up in “Uncompression Error System halted” error after grub loads up.
Here’s what I did for #1.
1. Boot into OSX (installed on an external drive).
2. Wipe internal drive by doing an erase to create a GPT partition table on the internal drive.
3. Shutdown OSX and boot into Ubuntu. Create a 250MB partition for refit.
4. Boot back into OSX, format the 250MB partition as HFS+ and copy refit to this partition. Then Run “enable.sh” to bless the refit partition.
5. Shutdown OSX and boot into Ubuntu and create sda3 and sda4 (at this point, sda1 is efi partition, sda2 is hfs+ refit partition).
6. Select sda3 for root and sda4 for swap and continue Ubuntu install as normal.
7. After reboot, goto partition selector in refit and sync GPT table.
8. Shutdown and restart.
First, I get an error that says “”Attempt to access block outside partition”. A couple of reboots later, the error says “Uncompression Error, System halted”.
Hardware is Macbook Pro 5,4
I have tried method #1 with almost all major Linux distros. Now for method #2:
1. Boot into Ubuntu livecd, start Gparted and wipe all partitions.
2. Create new msdos partition table.
3. Create sda1 for “/” and sda2 for swap.
4. Continue installation of whatever OS and install grub. Ubuntu by default installs grub on /dev/sda and Fedora installs it on /dev/sda1. Both cases, after the install finishes and the machine reboots, I again get the same error “Uncompression Error System halted”.
To make sure hardware is good, I have run memtest, burned mutilple DVDs from multiple burners and made sure LiveCDs run fine.
I have also booted by removing “quiet” from boot flags. Adding “debug on” to /boot/grub/menu.lst (by going in rescue mode and chrooting to the dead install).
Pretty much looking at end of the rope here. Any clues for troubleshooting this?
Nope, sorry. But check the Ubuntu forums, there is a Apple forum there, maybe somebody there knows.
Already posted to Ubuntu, Fedora and OpenSuse forums. No useful replies yet π¦
Success!!! Finally π
The issue was Macbook’s firmware. I had replaced hard drive in the macbook but apparently, Macbook firmware version 1.7 does not play nice with all SATA-II drives. Firmware v1.7 was released to fix a limitation in v1.6 that allowed speeds only up to 1.5Gbps. So I downgraded to v1.6, created a DOS partition table and Fedora 13 installed and booted up easily π Yes, I am stuck with SATA-I speeds but that’s ok because the hard drive I have in the system isn’t going to test that limit anytime soon.
@Nicolaj
I do not think that your CD is defect. If you have the same trouble as I do (Starting up with OS-X-DVD -> after a while a “don’t park” symbol in grey appearing or systemfolder blinking), then you should try fully cleaning you harddisk. I have seen that osx installer doesn’t like other filesystem than hfs and fat.
If you do a dd if=/dev/zero of=/dev/sda (this fully kills every thing on the hd) then the whole thing works.
I have found perhaps the easiest way to install Linux on a mac, with having to install OSX on a seperate hard disk and go about having to install refit.
Also, you can also duel boot Windows 7 or XP as well.
What I did was boot up a linux disk, and choose “Use the whole disk” This will erase the whole disk and put Linux on it. What it will also do, is make the required partitions.
Partition 1: Unknown (boot)
Partition 2 EXT3/4 Linux
Partiton 3 Swap
it makes 1mb Unknown with the boot label of bios_grub <– this is what makes linux boot up on a mac, then makes the regular partitions swap and EXT4 and allocates it all automatically.
20 minutes later, you'll have a working Linux distro on a mac with minimum effort. The linux boot loader is put on /dev/sda, leaving /dev/sda3 free. (this is usually a problem if using Refit. but we wont be needing refit π )
DUEL BOOT
Now, if you want to duel boot, you are going to have to fire up the linux disk again, go to Gparted, and delete the swap partition, and replace it with NTFS, then for the 4th partiton use it as swap (2GB) is enough.
Shrink the above linux partiton if nessary,(you wont damage it) so now, you should be left with:
Unknown
Linux
NTFS
Swap
Go and install Windows, it will install to dev/sda3. Once it's done, you will be wecomed with a Linux Grub and a selection of OS's (you'll see that windows never wiped out grub, because it is installed somewhere different π )
To get rid of the 30 second bootup to linux just follow franki^ post.
I hope this helps some people.
I meant to put without installing OSX to a seperate disk. π
Thank you for this great tutorial. I installed the System as you proposed it and I was suprised that it was really that easy. Even for a n00b like me…
I can’t agree more :). In similar boat as you.
If I try to boot any linux based live disk/usb my mac Stops working if the live Disk/usb trys to start the kernel.
I have to put out and in my HD to make my mac working.
(It shows the ‘?’ while booting OS X)
(MacBook White 5,2)
Is there any way to run linux on an other drive? So I would have two HDs. One with OS X and one with linux. Would that work?
How can I install a linux on my external HD (which I would put in my mac as internal HD for linux), whitout need to boot a live system?
This is not a support forum. It is highly unlikely you get any answer here. Try http://apple.stackexchange.com/ or similar forums.
[April 17, 2013] To anyone who may come across this article (via google perhaps) the compatibility mode issue should not be a problem if you use a UEFI bootloader instead of GRUB. Popular choices are GRUB 2.x or ELILO.
I have an iMac that I’ve been running Lion (10.7) from an external HDD (the internal one is fried). Right now I have Ubuntu installed on a separate partition, which I did on my PC, however, I do NOT have OS X lion installed on the other partition (i fudged up somewhere with repartitioning my drive). But my question is, can I boot Ubuntu on my laptop with the external HDD, install rEFIt on the HDD, then plug it into my iMac. Is this possible? Would the iMac boot ubuntu from rEFIt even though there is no OS X Lion installed on the external HDD?
– Chris
This isn’t a support forum, you are highly unlikely to get an answer here.