GNU/Linux-OSX dualboot Setup Tutorial
Steps summary
- Install
OSX. - Install
GNU/Linux. - Install the boot-manager (
rEFInd). - Configure your
OSXinstallation. - Configure your
GNU/Linuxinstallation.
Step 1: Install OSX
Keep in mind two important things:
- It's strongly suggested to install a clean version of
OSX, i.e. use an external installer, like aOSXinstaller in a bootable USB-drive. - When partitioning, be sure to leave empty space for
GNU/Linux.
Check out the specific guide for installing OSX.
I use and suggest this.
Step 2: Install GNU/Linux
After installing OSX, you need to install the other OS, which is GNU/Linux.
Note that you also need a UEFI boot-loader (since rEFInd is a boot-manager, not a boot-loader). OSX already includes it's own boot-loader, but in GNU/Linux you need to explicitly install it in the EFI partition.
Check out the specific guide for installing GNU/Linux.
I use and suggest this.
Additional notes
Partitioning suggestions
When performing partitioning I suggest to just use the following parititons:
root(mounted in/)swap
This is because you don't need boot (it's an UEFI system).
I suggest mounting /tmp in RAM (usually RAM available in Macs is enough).
For other partitions, like var, home, etc.. I suggest you to not create them, because available space is not so much and dualboot setups are complicate, we want to not extend the complexity for getting almost nothing in advantage.
For example, I have the following partitioning:
| Number | Start | End | Size | File system | Name | Flags |
|---|---|---|---|---|---|---|
| 1 | 0.02MiB | 200MiB | 200MiB | fat32 | EFI System Partition | boot |
| 2 | 200MiB | 96126MiB | 96126MiB | Julia Main Disk | ||
| 3 | 96126MiB | 96746MiB | 620MiB | hfs+ | Recovery HD | |
| 4 | 96747MiB | 100747MiB | 4000MiB | swap | gnulinux_swap | |
| 5 | 100748MiB | 200748MiB | 100000MiB | ext4 | gnulinux_root | |
| 6 | 200749MiB | 239372MiB | 38623MiB | ext4 | archive |
Kernel configuration
When configuring your kernel you should keep in mind your specific hardware (e.g. MacBook pro).
You'll need to enable the specific kernel options
Step 3: Install the boot-manager (rEFInd)
You can install the boot-manager from OSX or GNU/Linux. However, the documentation explicitly says you should install rEFInd from within OSX.
Perform the following steps:
- Login to
OSX. - Go to the getting.html webpage download the binary ZIP, which contains the installation script.
- Extract the downloaded archive and cd into it.
- Now you should see a file called
install.shwhich is the installation script. Install
rEFIndinto theUEFIvolume (calledEFI), by executing:$ ./install.sh # From inside the extracted folder. $ sudo bless --mount /Volumes/EFI --setBoot --file /Volumes/EFI/EFI/refind/refind_x64.efi --shortform
Customizations
First of all, you need to mount the EFI partition, which contains among other things the rEFInd configuration. One way is to enable the Debug menu in Disk Utility and mount the partition called EFI.
Adjust options
Before configuring rEFInd, perform initial cleanup:
$ _refind_dir="/Volumes/EFI/EFI/refind"
$ rm -R ${_refind_dir}/._*
$ rm -R ${_refind_dir}/font
$ rm -R ${_refind_dir}/icons
$ rm -R ${_refind_dir}/theme
$ rm ${_refind_dir}/bg.png
$ rm ${_refind_dir}/selection-small.png
$ rm ${_refind_dir}/selection-big.png
$ rm ${_refind_dir}/theme.conf
$ rm ${_refind_dir}/Thumbs.db
Now you should have just few files/folder there, like keys, drivers_x64, refind_x64.efi, refind.conf.
Now you can configure rEFInd:
Here is a complete list of the available options.
I advise you to store the configuration somewhere (like me).
Using Fizzy
I use Fizzy to manage the configurations and even if rEFInd is different from normal software, if Fizzy is powerful enough it should be able to still semi-manage rEFInd.
I'm saying semi-manage because the nature of rEFInd is really different than normal software. It's in a separate partition (EFI), possibly available only at boot time, when other partitions aren't already (and can't be) mounted. This means you can instantiate but not install rEFInd configuration. To install the instance you just copy the artifacts into the destination folder.
Let's proceed..
At this stage probably you don't have Fizzy installed, I suggest you to temporarly install it and then remove it:
$ gem install thor --user-install
$ curl https://raw.githubusercontent.com/alem0lars/fizzy/master/fizzy > ${HOME}/fizzy
$ chmod +x ${HOME}/fizzy
Now I can instantiate the rEFInd configuration:
$ _inst_name="dualboot_gnulinux_osx"
$ _vars_name="julia_dualboot"
$ ./fizzy cfg instantiate --vars-name="${_vars_name}" --inst-name="${_inst_name}" # Assuming you're in ${HOME}.
$ ./fizzy inst cd "${_inst_name}" # Assuming you're in ${HOME}.
$ cp -a refind/* /Volumes/EFI/EFI/refind
After having instantiated the rEFInd configuraton you can safely remove Fizzy and its dependencies:
$ ./fizzy cfg cleanup # Assuming you're in ${HOME}.
$ rm ${HOME}/fizzy
$ gem uninstall thor
$ rm -R ${HOME}/.gem # (Optional) This cleans up all gems user installation, safe if you hadn't installed gems before.
This is because I want to keep setup stages clean and separate and at this time you shouldn't already configure your system (which includes installing Fizzy).
(Optional) Choose theme
I personally don't need a theme, since it's already included in my rEFInd configuration. Even if I had one, it would be already being setup by the step before (using Fizzy).
Anyways, if you want one, to install a custom theme, perform the following steps:
- Choose a theme. Here is a list of some. IMHO good ones are:
- Download and extract it.
- Copy the extracted folder inside
/Volumes/EFI/EFI/refind - Add the line
include <THEME_NAME>/theme.confin/Volumes/EFI/EFI/refind/refind.confjust before the firstmenuentrydefinition (<THEME_NAME>is the name of your theme (the folder's name)).
Now reboot and check the adjustments.
Step 5: Configure your OSX installation
Check out the specific guide for configuring your OSX installation.
I use and suggest this.
Step 6: Configure your GNU/Linux installation
Check out the specific guide for configuring your GNU/Linux installation.
I use and suggest this.