Booting Ubuntu With The Chameleon Bootloader

May 16th, 2009

Apple / Mac

***Credit goes out to RCC2k7 over Ubuntu Forums. He wrote the instructions, I just made it easy to find.***

linux penguinUbuntu and Chameleon, wouldn’t it be great if they just got along? That way you could boot to Ubuntu directly from the Chameleon Bootloader without having to change the boot partition every time (or whatever you used to do). The issue itself is actually between Grub (not Ubuntu itself) and Chameleon fighting to see who has the bigger cojones.

Grub and Chameleon both install themselves onto the MBR (Master Boot Record). Since they both try to install to the same place, whichever is installed last is able to stay on. This means that if you install Ubuntu and then you install OS X, you will be able to get into Chameleon to choose which OS you would like to boot to. The problem with this is that because you just installed Chameleon to the MBR, Grub was replaced at the top of the list and you can no longer boot to it. If you install OS X and then Ubuntu afterwards, you can boot to most other OS’s with Grub, but not OS X.

To have both Grub and Chameleon satisfied, you just need a couple of commands in the Ubuntu’s Terminal and everything can be fixed and working smoothly. So today, I’ll tell you how to move Grub from the MBR directly to the Ubuntu partition so that it remains intact when Installing Chameleon, but also so that you can boot Ubuntu directly from Chameleon. To do so:

1. Boot into Ubuntu like you normally would.

2. Launch Terminal.

3. Type df and press RETURN or ENTER.

4. Note the first entry on the list – the one mounted as /. This is the one we want. In my case it was /dev/sda3.

5. Type sudo grub-install /dev/sda3 – replace /dev/sda3 with the correct entry for your system.

6. Enter your Password and press RETURN or ENTER.

7. Close the terminal window and restart your system.

8. Boot into OS X and reinstall Chameleon.

9. Leave a comment below about how everything went for you.

While you’re at it, you may want to access your Ubuntu files from within OS X.

If you found this guide useful then feel free to make a donation by clicking the link at the end of the Authors Mini-Biography. Any amount truly does help.

, , , , , , , , , , , , , ,

This post was written by:

Thomas - who has written 38 posts on Daily Blogged.

Thomas is currently in High School and, although he may not be as old as the rest of you, he can hack his way out of almost any situation. (That means don't mess with him or he'll get you!) Click here to send a PayPal donation to Thomas!

Contact the author

68 Responses to “Booting Ubuntu With The Chameleon Bootloader”

  1. Sree Says:

    Hi Thomas,
    I am trying to triple boot the system with XP, ubuntu and Mac osx leopard 10.5.7
    No matter which one I install last (linux or leopard) the bootloader of the respective one takes over. Im using chameleon v2.
    If I install Mac last, Chameleon does not show the Linux partition.
    if if install linux last, even though grub would show mac as a os option to load, it just goes blank when I select it.
    I dont mind either bootloader and the main one. as long as it lets me properly boot into any of the OS systems.
    Any help would be great.
    I havent tried it yet but I was wondering if i install mac without the chameleon boot and then install linux, will that avoid the conflict.
    Any help would be great!
    Thanks

    Sree
    PS: XP loads properly no matter which bootloader is being used.
    Edit:
    Hi
    Sry!! forgot to mention that as of now Mac was installed last so im getting the chameleon bootloader showing only windows and mac OS options.
    Sree

  2. Thomas Says:

    While your point is valid, Chameleon can also boot all three OS’s, has more features than GRUB, and is much more attractive.

  3. Tomas Says:

    Just use grub; it boots into Windows, OSx86, Ubuntu and whatever else. First install 0SX and create a partition map using Disk Utility. Give maybe a third to Leopard. Then install Windows. With Windows make another partition in your free space, but leave 10 gigs or something. Then run the LIVE Cd with Ubuntu and install to a partition covering almost the rest of the drive. Ubuntu installs grub AUTOMATICALLY and will find Leopard and Windows as if it’s completely normal that they would show up on your drive. You can then boot into all three.

  4. Ted Says:

    Thanks Thomas.

    re my post below:
    I was waiting until I had a solution before posting again, and The Almighty Google didn’t hand me the solution, so I had to try using my brain. My solution (in case anyone else needs it), was to change the root reference that grub sees, from (hd0,0) to (hd1,0). I added a new listing to menu.lst. Now I boot from Chameleon to grub to Ubuntu.

  5. Thomas Says:

    Error 17 is a Grub error and I unfortunately do not know enough about Grub/Ubuntu to offer a solution. A quick google search for “ubuntu error 17″ returned this site and the solution may work for you. Good luck and sorry I wasn’t able to help more.

  6. Ted Says:

    Thanks for the great guide, very clear and helpful. I have Mac on one drive and Ubuntu on the other, and Chameleon now sees both the Mac and the Linux drive and I can boot to either… almost. Selecting Linux gets me to grub just fine, but Ubuntu fails to load with Error 17 (cannot mount selected partition). I suspect there’s something wonky with my setup – does this seem like an easy fix? (“/” for me was “/dev/sda1″)

  7. tino Says:

    Thank you this is exactly what I was looking for.

  8. Thomas Says:

    Glad you were able to resolve the issue!

  9. Vincent Gerris Says:

    Thanks for your quick reply Thomas, i fixed as followed:
    – boot ubuntu live cd
    – sudo grub
    – look in Gparted for partiotions, confirmed boot = /dev/sda4
    – in grub type root and then TAB through : hd0 shows 0-4 partitions,
    so i need hd0,3
    – type in grub : root (hd0,3)
    – then : setup (hd0,3)
    then quit, exit , reboot.
    Then it showed up in Chameleon, and heck, it boots :)!.
    Thanks for your tuotorial, hope this helps any1 else!

  10. Thomas Says:

    Boot to the Ubuntu LiveCD and run Partition Editor (GParted). Then set your Ubuntu partition as active. Now run the command to install GRUB and it should work.

  11. Vincent Gerris Says:

    I installed OS X after ubuntu,so no way to boot it now for me.
    I started the Ubuntu live cd en typed the command to install grub but it gave me the following error:
    Could not find device for /boot: Not found or not a block device.
    My / partition is /dev/sda2 , my boot /dev/sda4 .
    So I have /boot on a seperate partition.
    Any ideas on how tofi this?

  12. Martin Says:

    OK, reinstalling Chameleon from iatkos dvd worked! I reinstalled U64 and this time directed the grub location to the logical part and it now shows and boots under Chameleon, great!

  13. Martin Says:

    Hi, I was going to use your guide to install grub to my Ubuntu x64 which is on an extended partition (logical) as the six part on a hard drive. I mistakenly installed grub initially onto another hard drive which is my main osx drive previously using Chameleon. Now I can’t start with Chameleon on the osx drive because grub is taking over first. I’ve tried reinstalling Chameleon on the osx drive, but that didn’t work. Should I reinstall Chameleon using an install dvd instead of a using another working hard drive running osx? Any tips? Thanks.

  14. Thomas Says:

    Glad I could help.

  15. roflcopta Says:

    got it!
    (after i wrecked the bootloader again…)
    booted from usb and found that i did a stupid quotation mistake… (just as you mentioned)
    sorry for being n00bish
    anyway, thanx for your patience
    cheers
    rofl

  16. David Obluda Says:

    This worked out perfectly for me after a few hiccups. I had already installed ubuntu then osx86 over it on a different drive and chameleon didn’t see my ubuntu. After doing this like magic Tux appeared and everything is well. Back to the hackintosh now. thanks much Thomas.

  17. Thomas Says:

    I honestly think you’re missing a step or doing something wrong as these are not only the official instructions straight from the people who made Chameleon, but no one has ever had the problem before. Also, it seems as if you skipped the first couple steps of the Ubuntu/Chameleon guide as it sounds like you never moved GRUB from the MBR to the Linux partition. This could very well be the reason why you see GRUB before seeing Chameleon.

  18. roflcopta Says:

    no, i am in the right directory ;-)
    (/Users/YOURUSERNAME/Desktop/Chameleon-2.0-RC2-r640-bin/i386)

    but just read somewhere that the message could be ignored: “It simply indicates that the Boot code isn’t available for writing Intel bootable partitions. Apple doesn’t use that code anyway. The EFI boot code is built into the firmware.”
    so i will give a another try with rdisk1

  19. Thomas Says:

    That’s because you are skipping step 4 of the Chameleon Installation guide. Make sure to follow that step and then continue with the rest of the steps.

  20. roflcopta Says:

    manual install in terminal

  21. Thomas Says:

    Are those the messages you get when trying to boot or in Terminal when trying to install Chameleon?

  22. roflcopta Says:

    still no success, fdisk cant find boot0:
    ould not open MBR file boot0: No such file or directory
    tryed it with rdisk0 and rdisk1

  23. Thomas Says:

    Yes, you have to change it to rdisk1. Also, on the second step, make sure your disk identifier has an r in front of it (rdisk1s2 as opposed to disk1s2). Install Chameleon once again with these settings and let me know your progress.

  24. roflcopta Says:

    tried it with the installer, no success.
    manually the fdisk command said:
    could not open MBR file boot0: No such file or directory

    heres my diskutil list:
    /dev/disk0
    #: TYPE NAME SIZE IDENTIFIER
    0: FDisk_partition_scheme *149.1 Gi disk0
    1: 3.9 Gi disk0s1
    2: Windows_NTFS OS_Install 15.1 Gi disk0s2
    3: Apple_HFS ROKIT 78.1 Gi disk0s3
    4: Linux 37.3 Gi disk0s5
    /dev/disk1
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme *131.0 Gi disk1
    1: EFI 200.0 Mi disk1s1
    2: Apple_HFS Untitled 130.7 Gi disk1s2

    i guess i have to alter the
    sudo fdisk -f boot0 -u -y /dev/rdisk0
    to point it to the right place (since i have disk0 and disk1). but since im not the cli hero and already managed once it to break the bootloader (aarrggghh), i am really cautious with this…
    could you tell me how?
    thnx

  25. Thomas Says:

    Ok. Now try booting into windows and reinstalling Chameleon using this guide. Let me know how it goes.

  26. roflcopta Says:

    well that was fast :-)
    checked it: the osx partition was already flagged with the boot option.
    the system looks like this:
    /dev/sda1 fat32 rescue windows partition
    /dev/sda2 ntfs windows
    /dev/sda3 hfs+ osx
    /dev/sda4 extend linux?
    and into /dev/sda4 is:
    /dev/sda5 ext3 linux
    the linux disk have a key symbol, i guess it means there mounted.
    any advice
    thnx

  27. Thomas Says:

    It sounds like you forgot to set your OS X partition as the active/boot partition. To do so, launch GParted (either from Ubuntu or the GParted Live CD), right click on your OS X partition, click Manage Flags, check the “Boot” box, hit OK, and then reboot. This should fix the issue.

  28. roflcopta Says:

    hi thomas,
    ive tried your guide, but couldnt get any success:
    the first bootloader is still grub, if i choose osx then chameleon will boot.
    i first installed osx and afterwards ubuntu, when grub took over.
    i guess it has something to do with the flags.?
    could you give me any advice how to alter them in the right way?
    thnx & grrz
    rofl

  29. Thomas Says:

    I’m sorry but I’m not really sure what you’re talking about. Do you mind clarifying?

  30. badys Says:

    AK loader don’t run on me linux .. Project google code ->

  31. Thomas Says:

    If its still showing Grub when you turn on the computer then your Linux partition is probably still set as active/boot. Boot into Linux Mint and then use GParted to det OS X as active and see if that helps.

  32. Bruce Barrera Says:

    Hi Thomas,

    I have installed Windows then Leopard and then Linux Mint (it’s a variation of Ubuntu). I followed your tutorial and even moving grud to ubuntu partition and unable to boot Leopard. It keeps showing me Grub over and over again.

    Any ideas?

  33. Thomas Says:

    I’m a little unsure of what you are trying to do. Are you trying to use Chameleon as the bootloader on a system that isn’t capable of installing OS X?

  34. Matt Says:

    I have everything working on my system where I have Chameleon able to boot all of my partitions, however I have a friend (and myself) who is interested in installing the Chameleon loader to a partition on his Hard Drive (because mac will not install on his computer) and use chameleon as his bootloader for the system. The only thing I have done close to this is installing Chameleon to a partition on a USB drive, but that still requires having Mac installed on the system. Is there a way to just directly copy the files from a partition that already works (chameleon partition) to a partition on a hard drive and re-write the MBR using only Ubuntu? I have been testing the theory on my USB drive but coming up short. I have tried using dd if=/path/to/boot0 of=/dev/sdb1 and when it boots, I get repeating Boot0=Done or something like that over and over again. Anyone know of any fixes or how to do this?

    While booted to Mac, if I have any issues I can run fdisk -u -f /usr/standalone/i386/boot0 /dev/disk0 with no issue, but I am looking for an command that is equivalent to that in Ubuntu.

    Thanks everyone in advance!

  35. Rendy Pranata Says:

    sure, thanks…

  36. Thomas Says:

    Glad to hear you got it working. If you ever have any more issues feel free to ask.

  37. Rendy Pranata Says:

    yep thomas, you’re right, sorry to disturb you all along, and thanks for all your fast reply, really appreciate it..

    ubuntu rocks, you rockss
    thanks a lot, my laptop can dual boot ubuntu and osx86 with chameleon now… thanks thousand times!

  38. Rendy Pranata Says:

    EDIT

    sorry thomas, i’ve just installed ubuntu, and it seems that using your instructions, it works beautifully, thanks a lot, and sorry for being n00b, i dont know whats wrong with the fedora grub version, installed it 3-4 times, and it still doesnt show in chameleoon, with ubuntu, only need 1 install… praise UBUNTU…=D

    sorry and thanks alot Thomas… you’re legend!

  39. Thomas Says:

    It’s no problem at all. To be honest, I have never used Fedora so I am not sure why this doesn’t work. Can I ask why you would rather have Fedora as opposed to Ubuntu though?

  40. Rendy Pranata Says:

    hi thomas,

    sorry to disturb you once again, i;ve just done your instruction above once again from the very beginning, and im sure i didnt miss even 1 step, and now it ends up with chameleon as boot loader, and the linux partition doesnt show up in the chameleon, it only shows 1 option only in the chameleon, any ideas?

    thanks in advance, and sorry to bother you again and again

  41. Thomas Says:

    Rendy- It seems like you just need to follow this guide as it addresses all the problems you are facing

  42. Rendy Pranata Says:

    Hi thomas, appreciate your fast response, yep, but now, how to avoid grub to boot first than chameleon, i mean, now the first boot loader that comes out is grub, and then if i choose MAC_OS from grub, the grub open chameleon, with only macos as option, without any linux (fedora),

    so i want to make
    1. grub is disabled to load, or if there is any way to avoid grub to load, but load chameleon instead
    2. show linux (fedora) partition using chameleon

    thanks

  43. Thomas Says:

    Im not too familiar with Fedora so I probably can’t help you with the second part (Although if it is like any other Linux port with Grub as the default bootloader then the same steps should apply) but for your first question, to mark a partition as active (the partition it automatically boots to when the timer runs down) just open the com.apple.boot.plist in your /Extra folder and add the lines found in this file but replacing X with the hard drive number (usually 0) and Y with the partition number of the partition you want to set as active.

  44. Rendy Pranata Says:

    Hi Thomas, i need you help, now my condition is the grub is loaded first, and has 2 options, mac and fedora, and if i choose mac, the grub calls the cameleon, ive followed your instructions above, but the fedora still cannot show in the chameleon, is there a way to
    1. make a partition active for chameleon, where is exactly chameleon is installed?
    2. configure chameleon to be able to boot fedora by terminal, or text editor (i imagine it as grubconfig version of chameleon)

    thanks in adavance

  45. robbie Says:

    Ok yeah i figured it out. Weird but its because i had the ACPI mode turned off…

    I have to reinstall leopard again though. Will use this guide again, though i guess if /boot is set it should pick it up auto

  46. Thomas Says:

    Yes, by boot partition I also mean active partition. Try reinstalling Chameleon and then setting OS X as the active partition. Do you get any errors?

  47. Robbie Says:

    even marking it as active is not doing the trick…

    but i did do the steps in ubuntu and can see ubuntu from the boot 132 disk. It just seems like chameleon isnt overwriting the mbr.

  48. Robbie Says:

    When you say set to boot partition do you mean set it as the active partition…

  49. Robbie Says:

    I followed this and it doesnt work.

    Well i guess chameleon didnt write to the MBR. Because after reinstalling it, and rebooting i get grub and have to use a boot 132 disk to get back in osx.

    I guess i will try to reinstall chameleon again…

  50. Thomas Says:

    The reason you are seeing this is because your Linux partition is set as the boot partition so it boots to Grub and then when you select OS X, it loads the Chameleon bootloader on the OS X partition. To get around this you can either:
    a) Remove Grub altogether
    b) Set OS X as the boot partition using the Partition Editor within Linux so that you will automatically see Chameleon first. If you select Linux though you will then reach Grub at which point you can select the OS from there. If you remove Grub, selecting Linux from Chameleon would automatically boot it. If this sounds like a viable option to you then let me know and I can provide instructions for you on how to do this

  51. Son Says:

    I tried this method, but after reinstalling Chameleon 2RC1, Grub Boots first, and if you select osx86, Chameleon comes on and asks if you want to boot into vista or osx86. Weird, two bootloader one after another.

  52. Thomas Says:

    Just to be sure, you are currently using Chameleon for booting right?

  53. cody Says:

    Well, I tried to boot in during that method, but I got a restart error. Either way, I configured Grub to boot OS X, so after that, I installed Chameleon, and it worked fine. Thanks much for the post.

  54. Thomas Says:

    cody- You do not need Grub to recognize OS X. In fact, I don’t even think its supposed being that OS X is on an HFS formatted partition. The whole point of this guide is to boot Ubuntu with Chameleon, not to boot OS X with Grub. Now, if you need to boot into OS X then, after you have made the changes above in Ubuntu, pop in the OS X Install disc. Then, select to boot from CD by hitting F12 while the black Dell screen is visible, and dont click anything so that when the timer runs down on the disc, it will start to boot to your installed OS X. Then reinstall Chameleon (http://www.dailyblogged.com/719/new-chameleon-say-what/) and your computer should automatically boot into Chameleon with both OS X and Ubuntu as options.

  55. cody Says:

    Okay, so I seem not to even be able to get GRUB to recognize my OS X partition to begin with. I have tried probably every boot combination known to man. I simply cannot get it to boot. Is there a solution other than the pci_v8 patch that will work?

  56. Thomas Says:

    Cody- Pay close attention to step 5 when using the guide. Also, when you boot to the hard drive, what starts to boot first? And yes, you can install Chameleon without a hitch on an external HDD, just like you would on an internal HDD.

  57. cody Says:

    Oh! And I happen to have OS X installed on my external. Could I install Chameleon through that?

  58. cody Says:

    Well, I edited through sudo gedit /boot/grub/menu.lst

    But…I did try to start up through my iDeneb DVD, and I got a restart error.

    Then, I think I actually got my GRUB boot to work only to receive a “com.apple.boot.plist not found” error. I am on a GUID partition table, and if you want I can show you my GRUB entry.

    Thanks,
    Cody

  59. Thomas Says:

    How exatly did you go about trying to edit the grub conf file? Were you trying to do something other than move grub? Also, you might have to reinstall Chameleon after moving Grub. If you cant access OS X to install Chameleon, pop in the OS X Install disc, select to boot from, and then dont click anything so that when the timer runs down it will start to boot to your installed OS X. Reinstall Chameleon and then you shouldnt receive any more errors.

  60. cody Says:

    Okay, so how would I actually access OS X after installation. I tried to edit my grub conf file, but I keep getting an error 17, even with the efi v_8 patch.

  61. Thomas Says:

    Try using Gparted LiveCD or another CD to set Windows XP as the boot partition and see if it boots. And don’t worry, if it beeps its not going to blow up or anything. It just means it had an error and couldn’t find a boot device.

  62. Adam Says:

    No, Xp is on the same drive as Ubuntu, where Ubuntu is on the first partition and Xp is on the second. When I select Xp from chameleon I get the motherboard beeping at me, which I find scary! So I quickly reboot.
    To be honest I really haven’t looked into it that much as I only have Xp for quake live and I don’t even play that much.

  63. Thomas Says:

    Xp and Chameleon usually get along quite nicely. Is Xp one the same drive as OS X (where Chameleon is installed)

  64. Thomas Says:

    Well this guide if mainly for people who have already installed Ubuntu and do not want to reinstall. If they are doing a clean install then by all means, they should install it right to the partition.

  65. Adam Says:

    Well I maned up and gave it a go and it worked both with setting the ubuntu drive as 1st boot device and from Chameleon. I did not have to reinstall chaemleon either it just detected ubuntu upon boot. Now if I could only get xp and chameleon to be friends.

  66. Adam Says:

    I have OSX and ubuntu on 2 different hdd, if I do this will I still be able to set the ubuntu drive to the 1st boot drive in BIOS and have it boot or will I be forced to use chameleon?

  67. Nathan Says:

    At step 7 of the Ubuntu install you click advanced options to do that.

  68. Nathan Says:

    What i did to make it work, The first install of Ubuntu i dont install Grub to MBR, I install Grub to the partition of Ubuntu, Eg in my case “/dev/sda4″ My Ubuntu partition. If you do it from the beginning in advanced problems you have no troubles later on.

Leave a Reply