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.

11 comments:

  1. Did you ever have an issue where it would just boot to grub? When following the method you provided, I get stuck at the grub prompt. Running an A1176 mac mini, trying to get a server install running on it. :/

    ReplyDelete
  2. Got the same problem... Did you manage to solve it ?

    ReplyDelete
  3. Okay so, this tutorial is a bit outdated. I managed to install Linux on the same mac model differently.

    I tried to boot Ubuntu, but it freeze when booting the kernel. The only version I could boot successfully was the 12.4 one, which is no longer supported. So I went for an other distros.

    I made the bootable USB the same way, except that I put a 64 bits distribution of linux (Elementary OS 5.0) with the same 32 bits efi file from the german forum. It boots successfully.

    During the installation, I got no boot problem. Now my mac directly boot to ElementaryOS. I think this is due to the fact that elementaryOS is based on ubuntu, which supports 32 bits efi booting since 15.4 realeses (or so).

    It took me an incredible amount of time to discover this very simple way of installing linux. Thanks for this tutorial though, it helped me making the bootable USB.

    Hope the will help someone.

    ReplyDelete
    Replies
    1. I would totally love to do the same on a mid 2007 macbook... Can you tell me which steps of this guide am i supposed to follow and how to move forward? Thanks in advance!

      Delete
  4. i got ubuntu 14 installed via cd mac mini 2007 and got upgrated ram and cpu also on mini, and then i upgraded to 16 then 18 and lastly to ubuntu 20 64bit
    https://help.ubuntu.com/community/Mac_mini2-1/Trusty used it here for the trial as directed here and couldn't make it work ... but bold article

    ReplyDelete
  5. Thanks. This was very helpful. Screwy though. like you I got the 32 bit Ubuntu to boot but hangs at the kernel loading. I tried a couple other 64 bit versions and nothing but Elementary would boot to the installer.

    Very screwy.

    ReplyDelete
  6. Check out this post. I was able to use this to get the latest Ubuntu (21.10) working on my MacBook Late 2007 w/ Core 2 Duo (64-bit) and 32-bit EFI. Only downside is I had to use a DVD-R, but, as mentioned by the author, installing from a DVD with the EFI boot removed results in using the BIOS, which is more likely to survive distro upgrades.

    https://mattgadient.com/linux-dvd-images-and-how-to-for-32-bit-efi-macs-late-2006-models/

    ReplyDelete
  7. If you are looking for using Windows 10 Fax and Scan multiple pages by flatbed scanners or printers, you should know that the Fax and Scan app built-in on Windows 10 computer is a very basic one.

    Scanning multiple pages into one document might seem tough if you do not know how to windows scanner multiple pages . If you are one of them who work with documents of many pages regularly, this post is going to help you.

    However, it is not very easy to do this work for free. There are a few paid tools that offer you this. In this article, I am going to talk about the tools you need to have to do it along with other tips on different scanners for scanning multiple pages into one PDF. Let’s get started.

    ReplyDelete
  8. Thank you for this tutorial! Works like a charm!

    ReplyDelete
  9. Thank you for this articale.. I was able inject life into my 2007 Mac Mini that now runs 22.04 LTS...

    ReplyDelete