Monday, 26 October 2009

How To Successfully Dual Boot Hackintosh (OSx86) and Ubuntu Linux (Will also work with all GNU/Linux systems using GRUB)

A little while ago, after getting pig-sick of my Apple iBook, I bought my current Acer laptop from a friend who is quite the expert in all things Hackintosh. Liking OS X quite a bit, but being a GNU/Linux user at heart, I decided to try dual boot the two. What followed was about a week of sweat tears and uncountable "FFS"s. However, after doing it right finally, I wrote a little tutorial on how to do it and posted it on my Geeks blog. So, here's Infected Mentality's first proper post, lifted almost in its entirety from the original; How To Successfully Dual Boot Hackintosh and Ubuntu Linux

There are loads of tutorials out there on how to Dual-boot pretty much any combination of Operating Systems, and I felt it was about time I contributed my part on how to dual boot two of my favourite ones: Ubuntu Linux and OSx86.

There are several methods to achieving this, however after trying and failing for about a week, myself and a friend finally managed to get it working – turns out it was as easy as pie and we were trying to do all the wrong things. This is how we finally did it, after numerous reinstalls.

To achieve this setup you will need the following:

- At least one writable DVD
- At least one writable CD
- A program which can burn .iso files to disc. I recommend ImgBurn if you're running Windows. Burn if you're running OS X and K3B if you're on Linux (K3B is designed to run in KDE however I've had no problems running it in GNOME)
- A torrent client. ĀµTorrent for Windows or Transmission for OS X and Linux is recommended.

Part 1 - The Hackintosh

1) Get yourself a a Hackintosh distro. These can be acquired via a quick search on most torrent sites or a visit to the OSx86 Project Wiki. There are loads of distros available, most commonly used are:
- iPC (This is the distro we used.)
- iDeneb
- Kalyway (This has a reputation for being one of the easiest Hackintosh distros to get set up.)

2) Burn the .iso file to a dvd. It's advisable to set your write speed to the minimum possible and to tell your burner to verify the data, for this will ensure less errors in the write.

3) Make sure your computer is set to boot from CD. This can be done via the BIOS. The laptop we used has an option to access a boot menu at startup by pressing F12, which allowed us to choose which device to boot from. If this is an option for you then that's probably your best bet.

4) Insert your OSx86 cd and boot from it.

5) Some distros try to run as Vanilla as possible, if your distro is one of these (iPC, the distro we used is one) you should be presented with a message at boot giving an option to press any key to change how the disc boots. If this is an option for you, do this now.

6) Insert the following line: idlehalt=0 -v and then hit Enter. idlehalt=0 disables the disabler, which would normally prevent the install disc from loading on a non-Apple computer. -v disables a feature called Silent Boot. Normally, when the Apple OS is loading a white background with a grey apple is shown, -v shows the bootscript behind that, allowing you to check for errors. If your distro loads the installer without any need for this command just ignore this step.

7) Once the installer is loaded, click continue past the first stage. As soon as the menubar on the top is loaded, go to Utilities>Disk Utility.
8) Select your Hdd and choose Partition. The partition scheme I recommend is 2 partitions for ease of install. The first partition must be formatted as Mac OS Extended (Journaled) and the second one is best formatted as empty space. You can name your Mac OS Partition whatever you want, I named mine sda1 for simplicity's sake.

9) After Disk Utility has finished setting up your partition scheme, return to the installer and proceed through it until you reach the point where you are asked which Volume to install the OS on. The volume listed should be sda1 (or whatever you named it). Select the volume and click continue.

10) You MUST customise your install. I don't know what your hardware specs are but you need to select drivers for your chipset and graphics card etc. Visit the InsanelyMac forums to assist you with this stage, or if your distro has a forum, use that.

11) After install, reboot your computer and remove the disc. The bootloader should load up again. If you can, boot with idlehalt=0 -v again. This will allow you to see if the bootloader freezes at a particular line.

12) If you're all booted and lovely, you need to remove the disabler.kext if your distro does not do this for you. Just find it (use Spotlight), and send it to the Trash. Then empty the trash. Justice is swift.

13) Configure your OSx86 install to your liking. If you're on a laptop you may need to find Wireless drivers, battery monitor fixes and the like. Other than that, change your wallpaper, install some software, play around.

Part 2 – Installing Ubuntu.

1) Head over to and download the latest version of Ubuntu. Use your disc burning software to burn the .iso file to disc. Remember to set the burn speed to the minimum to ensure a good write with no errors.

2) Pop in the disc and boot from it.

3) Select your language. At the install options I'd suggest booting into the LiveCD (Try Ubuntu without any changes to your computer) just to check most of your hardware will work properly. After you've messed around for a bit just click on the install icon on the desktop and go through the installation until you reach the screen which asks you on how you want Ubuntu to partition the disk.

4) Click on “Manual” for your partition scheme. The disk should be split into two, the Mac partition and the free space. Click on the free space and create a partition. Set the partition size as double your amount of RAM (1GB = 1024MB) and the partition type as Swap.

5) Select the remainder of your free space and use it for the root partition, the mount point should be /.

6) Proceed with the installation, rebooting when prompted.

7) When you reboot your computer, you'll notice that GRUB, the bootloader, doesn't recognise that there are two Operating Systems as it would if you were dual-booting with Windows and loads straight into Ubuntu. Don't worry.

8) Configure Ubuntu to your liking, make sure your internet is working etc. I recommend making sure you let Ubuntu install the updates before proceeding to configure GRUB, in my case Ubuntu needed to install around 250 updates. After that you'll need to restart the computer and you can start messing round with the bootloader.

Part 3 – Configuring GRUB to boot OSx86

GRUB, the bootloader included with the latest release of Ubuntu, cannot boot your OSx86 partition by itself, so we're going to tell GRUB to pass down the bootstrap to the OSx86 bootloader to let it boot itself. This is a lot easier than it sounds but it requires a little bit of patience and a bit of playing round to get it right.

1) Boot into Ubuntu and open up a terminal.

2) Type sudo gedit /boot/grub/menu.lst and enter your password when prompted. This brings up a text editor with instructions on how to play with GRUB.

3) In this file, everything with a hash (#) in front of it is ignored by GRUB; like notes in HTML. Look for where it says hiddenmenu or something along those lines, and stick a # in front of it. This is so you don't have to hit Escape every time you want to access your bootmenu and boot OSx86.

4) Next look for the part of GRUB where it displays your installed Kernels. This is normally near the bottom. If you look at it, they follow a basic formula. You'll be using slightly different commands but they achieve the same basic thing.

5) Create an entry for OSx86. Add the following lines:

title OSx86
root (hd0,0)
chainloader +1

title is the name GRUB will display for the OS. This can be anything you want, mine's been called several things such as 'Hackintosh', 'OSx86' and 'Mac OS X 10.5'. Whatever you're comfortable with really.

root tells GRUB what to boot. The command we told it was (hd0,0) which is saying to GRUB “Boot from the first harddrive (hd0), using the first partition (,0)”. And this is the bit that'll cause the most trouble. When I was following a tutorial on how to get GRUB to recognise OSx86, I was told to type (hd0,1) which is obviously a completely different partition. If you attempt to boot into OSx86 and you get a message along the lines of “Error 15: Invalid Device” just go back into the GRUB menu.lst and change the partition number. Keep changing it until you boot properly

makeactive tells GRUB to set the active partition on the root disk to GRUB's root device

chainloader +1 This command will take the boot sector of the root and use it to boot. Like getting GRUB to load Darwin/Chameleon which will in turn boot OSx86.

6) Save your changes, exit gedit, cross your fingers and reboot. The boot menu should appear with all of your Ubuntu options (Generic, Recovery and memtest) and then the entry you created for OSx86. Select it and hit your enter key. If you get an error its not the end of the world, just boot back into Ubuntu and change the partition number in the root command for the entry and retry it.

That's it. Done and dusted. It's also a good idea to go back into menu.lst and change your timeout time. The default is 3 seconds, which doesn't give you much time to change your OS choice before loading it. I set mine at a nice 10 secs.

Another thing I did was remove all the extra kernel options from the boot menu. I did this for security reasons as well as for aesthetics, as I didn't want anyone booting into Ubuntu's safe mode and changing my root password; I however back up everything every five minutes, if deleting these entries may cause you to lose data if your main system becomes unusable don't do it.


Post a Comment