Friday, April 19, 2013

How To Install Ubuntu 13.04 On A Macbook Air Using USB Drive


 This tutorial is for the Macbook Air only, not the Macbook Pro. Yes, it makes a difference. Things have changed since I first posted this, and I have not tested this method since the Mavericks update. Attempt at your own risk.

There is a lot of documentation on how to do this online, most of it is outdated and obsolete, or, just plain doesn't work. Which, if I had hair, I'd have ripped it out by now trying to get this done.
But it IS possible, and with commands to a minimum.
It's quicker and easier than it looks here, basically you just have to install a new bootloader, an app to make a bootable Ubuntu usb stick, and partition your hard drive on your Mac to make room for Ubuntu.

Here is how I got Ubuntu 13.04 (64-bit Mac) dual booting on my Macbook Air via USB install.

 First, you need to install rEFInd to use as a bootloader.

Download it, open the zip file, then open a Terminal. (Launchpad > Other > Terminal)

Now enter these commands, one at a time,  and of course replace "username" in the first command with your own username before running it in the Terminal:

cd /Users/username/Desktop/refind-bin-0.7.1


 You'll be asked for your password to install, provide it. You can delete the zip file you downloaded (and the folder you extracted) now that rEFInd is installed. Keep in mind, when I made this tutorial, the version of rEFInd was 0.7.1 as you see in the command above, if the version you download has a different number, or the folder name is different, use the most current version in the command and not what I put here.

Second, download the 64-bit Mac (AMD64) desktop image
Note, it's not just the AMD64, it has to be the 64-bit Mac (AMD64) otherwise you won't get far.

Once your Ubuntu iso is downloaded, go to the UNetbootin site and download UNetbootin for Mac. Before you go all crazy and say "But UNetbootin doesn't let you boot on Mac, only PC" well, that was previously true. But this new Mac iso of Ubuntu 13.04 changes that. So fear not! We'll get to installing and using it in a moment.

Now, in OS X, open Disk Utility (click Launchpad > Other > Disk Utility)

You're going to want to create two partitions. a swap partition, and the partition for where you want your install of Ubuntu to go. Do not create a boot partition! You won't need it and it won't work anyway.

In Disk Utility in the left column, click on the name of your drive. (mine says 121.33GB Apple SSD SM128C Media for example)
Then click Partiton in the tabs to the right. The area shaded in blue is space already being used by OS X.

Click the + to create a partition, make this the size you would like the Ubuntu partition to have. Keep in mind this is taking away space from your OS X install so don't go crazy. You can either drag to resize or just enter it in where it says GB if you know how big you want it to be. Use MS-DOS (FAT) as the format. I named the partition UBUNTU for this example so you can see which is which, the label likely won't stick later during the Ubuntu install process so don't expect to see it.

Click the + to create another partition, make the swap size MS-DOS (FAT) and anywhere from 2 to 4 GB, I only did 2GB and it's peachy. You can name the partition SWAP (When you install Ubuntu it will format to what you choose then)

Click on Apply to save your changes and finalize your partitions. Remember the names won't show up in the Ubuntu installers partitioning tool you'll be using later, so remember what size they are.

Now, plug in your USB drive (make sure it's big enough to hold the Ubuntu iso you downloaded, to be safe I recommend 4GB) and make sure you have no other USB devices plugged in.

Extract the zip file of UNetbootin that you downloaded. You can move to your Applications folder and open it from there. It will ask you for your password to your computer to proceed as it has to make changes to the disks that require permission.

When the program opens, ignore the Select Distribution and Select Version dropdown menus.
Click where it says Diskimage, select ISO in the drop down. To the right of that click the ... button to find and select the Ubuntu iso you downloaded then select it.
Where it says Type select USB Drive and drive should be pointing to the USB drive you plugged in. (If you want to be 100% sure you're choosing the write drive, open Launchpad > Other > Terminal and enter the command diskutil list then hit enter and you can see what your USB Drive is named. Mine for example was /dev/disk1s1, but yours could be different, like /dev/disk0s3)
Now click the OK button and let it work it's magic.

Unetbootin will tell you at the end of the process that the usb stick will only be bootable on a PC, this is not the case for the Mac image of Ubuntu so ignore it and continue.

When it's done, close up everything you had open and reboot your Macbook Air with the USB drive still plugged in.

From that point on you should be seeing the Unetbootin menu, choose to Install Ubuntu, and then the Ubuntu installer will load after a moment.

It is very important that you choose the Something Else option when you get to the Installation Type screen of the Installer.
Click Something Else, then click Continue.

Then locate the partition you created earlier to use for your install of Ubuntu. click it, click Change, and format it to Ext 4, check the box for format partition, then make the mount point simply the slash: /
Locate the partition you made earlier for a swap partition, click it, click Change, and choose swap from the drop down.

Your Size and Device for boot loader installation will depend on what you chose
when you created your partitions in OS X earlier, don't just copy what you see here.
Use As, Format, and Mount Point settings above are correct and you should use them.
You should also see your Mac OS X partition listed, but in this example it is not shown.

Your Size and Device for boot loader installation will depend on what you chose,
don't just copy what you see here. Use as and Format settings are correct.
You should also see your Mac OS X partition listed, but in this example it is not shown.

Where it says Device for bootloader installation it is absolutely vital that you choose the same partiton where you are installing Ubuntu, the one you just formatted to Ext4. Otherwise, it won't work.  (Your partition may differ from the /dev/sda1 example above.)

Double check everything then click on Install Now and proceed with the rest of the install process.
Note: You will receive a message about needing to create a partition for bootloader code, ignore it and click Continue.
Once you're done with the Ubuntu install process, reboot the computer (you can remove the USB drive if you want, you don't need it anymore), when the rEFInd bootloader shows up, choose the  Penguin with the Hard Drive Icon to go into Ubuntu, or, the Apple to get into OS X.

The Penguin (Tux) in the middle is the partition where you installed Ubuntu to your Mac, you want to select that one to boot from. The Penguin to the right is the Ubuntu LiveUSB/Installer you created, you can unplug it, you don't need it now that you have installed Ubuntu.

 Just like with LiveCD's, you can use the USB drive as an installer for Ubuntu, or, as a LiveUSB if you don't want to install but still want to use Ubuntu. Remember, this LiveUSB will only boot on Macs.

That's The Way You Do It! \o/

If something goes wrong and you need to delete the partitions you made for Ubuntu and the Swap, you can plug the Ubuntu LiveUSB/Installer stick in again, and at the rEFInd bootloader choose the Penguin with the USB stick icon on him. 
When you get to the blue Unetbootin menu, choose Try Ubuntu Without Installing, and once the Ubuntu Desktop loads, click the Ubuntu logo in the top left corner, then type in Gparted
Use the Gparted Partition Editor to delete the partitions you want to get rid of (careful not to delete your Mac partition), Apply the changes. Then reboot. Remove the USB stick, and when you get to the rEFInd bootloader, choose the Apple logo to go into OSX. Once you get into OS X go to Launchpad > Other > Disk Utility. Click on the Mac HD then select Partition in the tabs to the right. Drag the Mac partition to expand it and reclaim the space. Then apply the changes.

No comments:

Post a Comment