Arch Linux on a Mac Mini

This post briefly outlines the process of setting up a dual boot OSX and Arch Linux on a Mac Mini. This is mostly for my reference in the likely event that I will be doing anything similar in some years, so it assumes some competence; fortunately, the Arch Wiki’s Beginner’s Guide probably fills in any gaps I left out. Obligatory Disclaimer: Use at your own risk or not at all.

This is almost the same as any other installation of Arch Linux, with a few changes that took some hours of frustration to figure out because of the EFI booter. My method is to create the partitions in Disk Utility, install rEFInd, and then install the grub bootloader into /dev/sda1.

Setup done in OSX

  1. First, install rEFInd. This worked out of the box for me, and makes it possible to boot via USB.
  2. Create a Arch Linux installer USB by dd-ing (or anything else) the latest installation medium onto a USB drive.
  3. Set up the partitions; I find it easier (and less dangerous) to just use the OSX Disk Utility to do this. See, for example, the procedure here. My OSX installations appear to come with three partitions, a small one called “EFI”, a main “OS X HD” partition, and then a small “Recovery HD”, like so:
    NAME   LABEL       TYPE   SIZE
    sda                disk 931.5G 
    |-sda1 EFI         part   200M
    |-sda2 OS X HD     part 927.9G
    `-sda3 Recovery HD part 619.9M

    (This output is from lsblk, and is not what Disk Utility looks like).
    I like to create a partition for my Arch Linux system (which I name “Arch”) and a fifth partition just for the /home directory (which I name Home”). This leaves me to something like

    NAME   LABEL       TYPE   SIZE
    sda                disk 931.5G
    |-sda1 EFI         part   200M
    |-sda2 OS X HD     part 476.9G
    |-sda3 Recovery HD part 619.9M
    |-sda4 Arch        part   179G
    `-sda5 Home        part   272G

Booting into the USB and finishing up the partitions

Now that the partitions and rEFInd is set up, and the USB is written, we can proceed with the actual installation.
At this point, one can basically follow the standard procedure with a few changes.

  1. Reboot the device into the USB. Since rEFInd is installed, it should give you the option of booting into the USB.
  2. Establish an Internet as required.
  3. We’ve already created the partitions in Disk Utility above, so there is no need to change the partitions themselves now. However, it is necessary to format the newcly created partitions above. In my case, the relevant commands are
    # mkfs.ext4 /dev/sda4
    # mkfs.ext4 /dev/sda5
    

    Warning: Please, please make sure that you are formatting the right partitions. The command lsblk -f will print out the partitions and their labels.

  4. Now we need to mount the directories. There are three directories we need to mount, the main filesystem and the home directory, as well as the EFI boot directory. The part that was non-obvious to me is that the boot directory we want is actually the “EFI” directory (likely /dev/sda1) that OSX already provides. The relevant commands in my case were
    # mount /dev/sda4 /mnt
    # mkdir /mnt/home
    # mount /dev/sda5 /mnt/home
    # mkdir /mnt/boot
    # mount /dev/sda1 /mnt/boot
    
  5. Now you can happily install the base system and generate an fstab file:
    # genfstab -U -p /mnt >> /mnt/etc/fstab
    

Configuring the base system and installing the bootloader

  1. Now we can chroot into the system and follow all the directions, up to (but not including) installing the bootloader.
  2. I could not get gummiboot to work but maybe you will have better luck. Fortunately, with /dev/sda1/ mounted as /boot, I got GRUB to work nicely.
    # pacman -S grub
    # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck
    # grub-mkconfig -o /boot/grub/grub.cfg
    
  3. Now we can exit the chroot environment and power down the system.

If all goes well, upon rebooting, rEFInd will now boot into the complete Arch Linux system.

Advertisements