Saturday, December 12, 2015

Installing 64-bit Ubuntu on 2007 Mac Mini (A1176) from bootable USB

Due to the lack of support for newer Mac OS’s on older Mac Minis, I opted to wipe my mac and install Ubuntu over it. This was a nightmare to finally find a method that works, as the standard documentation from the Ubuntu website did not apply to my machine. Finally I got it installed after picking up some tips from a few forums. Below are the steps I went through to get this working.

Brief overview

My Mac Mini has a busted Superdrive, so booting from a DVD wasn’t an option. Creating Bootable USB drives using standard methods on the Ubuntu website didn’t seem to work either. Finally I came across this blog post which refers to a super easy method for making bootable USB drives that comes from some German forums. I tried this with a 64-bit Ubuntu ISO, but no luck and I had this same issue which revealed that 2007 mac minis don’t support x86_64-efi (64-bit EFI booting). Following this, I used a 32-bit installation of Ubuntu along with the 32-bit EFI loader from the German package to boot from USB, and everything seemed to work fine. Once the Ubuntu Live USB booted up, I had one more minor issue where the boot loader failed to install, but I just selected don't install boot loader, completed the installation, then manually installed the boot loader using the boot-repair tool as seen in this thread. Following this, my 32-bit Ubunutu install booted with no issues. Finally, using Unetbootin within my new 32-bit Ubuntu installation, I made a Frugal Install of a 64-bit Ubuntu Live ISO which I could then boot from the hard drive, allowing me to install a 64-bit version of Ubuntu and then dual-boot into into either one.

To summarize this all up… I made a 32-bit bootable USB drive which installed a 32-bit version of Ubuntu along with the GRUB launcher. Using unetbootin inside the 32-bit Ubuntu, I then made a bootable partition on my hard disk from a 64-bit Ubuntu ISO which could then be booted from the GRUB. This allowed me to boot and install a 64-bit version of Ubuntu without a DVD drive. Major kudos to all the authors and contributors in the mentioned blogs and threads for paving the way for this to work. I spent days sifting through message boards and this was the only method that worked for me. Below are the detailed steps I took to get this working.

Make bootable USB (32-bit)

  1. Download the obscure German USB creator from here.

  2. Format a USB stick to FAT32 and manauly create the folder structure efi/boot/ inside of it.

  3. Copy a 32-bit Ubuntu install ISO (I used 14.04 desktop) and the file bootIA32.efi from the german package into the /efi/boot directory you just created.

  4. Rename your 32-bit Ubuntu install ISO you just copied to boot.iso

  5. Your USB drive should now look like this: (image taken from my chormebook, the drive is named UNTITLED) enter image description here

  6. Thats it! Now when you restart and hold down Alt, you can select the USB from the list of boot options, no Refit install required. The instructions are similar to this post, with the exception that we’re using the file bootIA32.efi instead of bootX64.efi, which I tried earlier with both 32 and 64 bit Unbuntu install disks, but it didn’t work.

Install the 32-bit version of Ubuntu

Now you can go through the Ubuntu install once the Live USB has booted. I chose to Erase disk and install Ubuntu and let Ubuntu automatically create the new partitions needed and I chose not to use LVM (the default option), as this causes confusion later on when trying to re-partition your drives. At some point, I got an error which is something like Could not create boot loader in specified partition, please choose location to install boot loader. None of the available locations worked for me, so I chose Continue without a boot loader.

This isn’t quite as scary as it sounds, as you can still boot into your live USB if you restart without the boot loader having to be installed. However, after the installation finished, and before restarting for the first time, I followed these suggestions and installed and ran the boot-repair utility. The steps are below:

  1. After Ubuntu install has finished (and you have selected to Continue without a boot loader), open the terminal and type the following:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair
  1. The final command will open the boot-repair tool for you. It’ll automatically scan your computer and suggest repairs. Press Recommended repair

  2. I selected No RAID when the option asked me if RAID was installed on my hard drive

  3. I then opted to uninstall any previous GRUB loader and reinstall a fresh one. You’ll have to do some copy and pasting into the terminal, but the instructions are very clear within the installer.

  4. Install the new GRUB into the disk where Ubuntu is.

  5. Done! After restarting without the bootable USB drive, it goes straight into the GRUB loader and you can launch Ubuntu! (If you messed up a step and GRUB isn’t working, you can always just reinsert your bootable USB, restart the computer, then rerun the boot-repair app)

Install a 64-bit version of Ubuntu

Now that you have a working 32-bit version of Ubuntu, you can use Unetbootin to create a bootable partition on your hard disk to launch the 64-bit Live CD from.

  1. First, you must make sure you have enough free space to install the 64-bit version of Ubuntu. I just booted from the 32-bit live USB again, then used gparted to resize my partitions. Because we’ll be loading the 64-bit live CD from the hard disk, we cannot resize this partition during the installation, as the disk will be in use. I resized my 32-bit installation to a 20GB partition. To run gparted from the Live USB, use the following command in the terminal:

    • sudo gparted
    • If you selected LVM (Logical Volume Management) when installing the 32-bit Ubuntu, you won’t be able to use gparted for this. You’ll have to do some fancy command line partitioning, as the LVM system works very differently, and there are not really any reliable GUI tools to do this.
  2. Now restart your computer and enter the 32-bit Ubuntu you just resized in the previous step. Here we’ll install UNetbootin, which will be used to create a bootable partition.

    • sudo apt-get install unetbootin
  3. Use UNetbootin to create a bootable partition from the 64-bit Live CD with the following settings:

    • Distribution: Ubuntu - 14.04_Live_x64
    • Type: Hard Disk
    • Drive: /
  4. After the partition is created, reboot the computer when prompted to do so and select UNetbootin from the GRUB options and this will take you into the 64-bit Live CD.

Launch the 64-bit Ubuntu Live ISO from the bootable partition and then install it along side your 32-bit install. All I had to do was select the free space in the partition step of the installation and create a new ext4 partition from it with the mount point set as /. The swap space from the previous 32-bit install will be reused for the 64-bit install, so u don’t need to create a new one. Again in the installer, select Continue without boot loader option if the error comes up and install and run the boot-repair utility after to get the GRUB working right. By the end, you should have both 32 and 64 bit versions of Ubuntu dual booting on your system.

Final comments

All these steps worked for me, and I was dual booting both versions of Ubuntu

If anything is unclear here, you can check the links to the blogs and threads I posted above (and again here down below). The method described here was a mix-and-match between these four sources:

  1. Making a Bootable USB drive for old Mac Mini: Really good instructions on how to make a bootable USB using the obscure German forums method.
  2. x86_64-efi not supported error when trying to boot from USB on mac: The explanation on why the x86_64-efi boot loader wont work on pre-2008 Mac Minis.
  3. How to manually create a boot loader with boot-repair in Ubuntu: This tells how you can complete the Unbuntu installation when the boot loader fails to install correctly.
  4. Make bootable partition: You can use the frugal install section of this guide to make a bootable partition that launches the 64-bit Ubuntu Live ISO.

No comments:

Post a Comment