Tuesday, May 21, 2013

Installing Ubuntu 13.04 Raring Ringtail on a MacBook Pro for Dual Booting

I recently installed Ubuntu onto my MacBook alongside OSX for dual booting, and learned a few lessons throughout the process. Below are the steps that I took. I have a MacBookPro 8,1 but these instructions might be applicable to other models as well. Be sure to also read the "official" Ubuntu installation guide. I also found a post by James Jesudason to be helpful.

These instructions are fairly sparse, but should help point you in the right direction if you are less experienced with any of the steps.

  1. Reduce partition size in the OSX "disk utility" tool. I dragged the partition size until I had enough free space left on the disk for my Ubuntu partition (I wanted 50gb but less should be ok). This took several hours.
  2. Install the rEFInd boot manager. I downloaded the most recent binary file (0.6.11) and ran install.sh, which worked without any other options. rEFInd was installed into the /EFI on my root filesystem.
  3. Install the ext4 driver in rEFInd. The driver is packaged with the binaries, but must be copied into /EFI/refind/drivers in order to be active. I had to create the drivers directory in /EFI with "sudo mkdir /EFI/refind/drivers" as it did not already exist. I then copied (as root) "ext4_x64.efi" from refind-bin-0.6.11/refind/drivers_x64 into the newly created drivers directory.
  4. Load the Ubuntu installer CD (must be the special Mac version of Ubuntu - labeled on that page as "64-bit Mac (AMD64) desktop image"). Instead of choosing to install Ubuntu, choose to try it out instead. Open up a terminal and run "ubiquity -b" and then proceed with the installation. Running with the -b flag tells Ubuntu not to install a bootloader, which won't be necessary as rEFInd can boot a kernel directly. During the install process, the default option should be to install in the disk free space, but you should verify this. I chose to manually create an ext4 partition for my root mount point and a 2gb swap partition instead of using the automatic option.
  5. After the installation finishes, select the option to continue to try Ubuntu. In the terminal, run something like "sudo blkid /dev/sda*". Look for the UUID corresponding to your Ubuntu root mount point.
  6. With Ubuntu still loaded off the LiveCD, find the /boot partition in your new install. This should probably be mounted somewhere in /media. In /media/.../boot, create a file called refind_linux.conf. Save the below options (from the rEFInd documentation), replacing the UUID with the one you noted in the last step corresponding to your Ubuntu install, into this file
    "Boot with standard options" "root=/dev/sda3 ro quiet splash vt.handoff=7"
    "Boot to single-user mode"   "root=UUID=1cd95082-bce0-494c-a290-d2e642dd82b7 ro single"
    "Boot with minimal options"  "root=UUID=1cd95082-bce0-494c-a290-d2e642dd82b7 ro" 
  7. When you restart, Ubuntu should automatically be detected and available to use in the rEFInd boot menu. You can make it the default boot option by setting default_selection in /EFI/refind/refind.conf accordingly
I modified these steps slightly from the ones that I took, so please let me know in the comments if you run into any problems. Hope this helps!

12 comments:

  1. Hi, I get stuck at step 4. Lion does not want to mount the iso image of the Mac version of Ubuntu. How can I load the installer?

    ReplyDelete
  2. @baba
    hdiutil convert -format UDRW -o ~/path/to/ubuntu-12.04.1-desktop-amd64+mac.img ~/path/to/ubuntu-12.04.1-desktop-amd64+mac.iso

    to convert to img format as described here: http://www.maketecheasier.com/install-dual-boot-ubuntu-in-macbook-air/2012/08/27

    ReplyDelete
  3. Help! My USB only mounts as read-only, and so i can't create the refind_linux.conf file.
    Any advice?

    ubuntu@ubuntu:/media$ ls -l
    total 0
    drwxr-x--- 2 root root 40 Sep 14 20:15 apt
    lrwxrwxrwx 1 root root 6 Sep 14 20:14 cdrom -> /cdrom
    drwxr-x---+ 2 root root 40 Sep 14 20:14 ubuntu
    ubuntu@ubuntu:/media$ touch /media/cdrom/boot/refind_linux.conf
    touch: cannot touch ‘/media/cdrom/boot/refind_linux.conf’: Read-only file system
    ubuntu@ubuntu:/media$ sudo mount -o remount,rw '/media/cdrom/boot/'
    mount: can't find /media/cdrom/boot/ in /etc/fstab or /etc/mtab
    ubuntu@ubuntu:/media$ sudo mount -o remount,rw '/media/cdrom'
    mount: warning: /cdrom seems to be mounted read-only.

    ReplyDelete
    Replies
    1. It shouldn't matter if your USB is mounted read-only, as in this step you're trying to create refind_linux.conf in the /boot folder on your hard drive. Try and find this other boot folder if you can.

      Delete
  4. You rock! It was that -b flag that saved me.

    ReplyDelete
  5. Should I be changing the root=/dev/sda3 to my "/" as well as the uuid? Or should the root be set to the swap ext?

    ReplyDelete
    Replies
    1. I don't think your would want to set the root mount point to mount your swap, unless I'm misunderstanding you. You would want root=/dev/sda3 to match the specific partition of your root Ubuntu install, which could be something different than sda3. Theoretically it might be possible to use the UUID for this as well, but I haven't tried that.

      Delete
  6. Thanks to the other commenters for their advice! Keep 'em coming if you've got any other tips.

    ReplyDelete
  7. Hello, what a great post. I

    By the way, after copying the UUID in step 5 I restart and at the rEFInd boot menu I chose Ubuntu. It seems that everything is fine, except for the Wifi driver. I did not perform step 5, I have MacPro 9,2. Does it cause me problems in the future?
    Additionally, do you know where can I find a controller for having Wifi in my new : ) Ubuntu 13.04

    ReplyDelete
  8. I have a MacBook Pro 8,1 with Ubuntu 12.10. Do you think I can update to Ubuntu 13 with no problems?

    ReplyDelete
  9. refind is not autodetecting ubuntu even though i followed all the steps

    ReplyDelete

Creative Commons License
Except where otherwise noted, content on What's Life by Kyle Barlow is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.