Introduction¶
This page is a guide on getting Windows and Linux both installed. Secure Boot Must be disabled from macOS recovery. If you want to be able to choose from macOS, Windows, or Linux in the Startup Manager (the menu you get by holding ⌥ key), goto 'Using seperate EFI partitions'. If you just want to select between Linux and Windows in the GRUB bootloader, goto 'Using the same EFI partition'.
The simplist way to triple boot is to install Windows first, and install linux on the same EFI partition, so that the Windows option in Startup Manager will let you pick Linux or Windows. To do that, follow the first set of instructions here.
Using the same EFI partition¶
If Windows is installed first¶
- Install linux normally, with a patched kernel and dkms modules (this is probably done for you if you are using an installer specific to t2 macs).
- Put your bootloader on
/dev/nvme0n1p1
, which should be set to mount at/boot/efi
. Once it installs the bootloader, the Windows entry in startup manager will boot linux. -
Fix blank screen issue that may occur when booting Windows (Credits to gbrow004 for documenting this fix on his Gist).
- Open a terminal and type in
sudo gdisk /dev/nvme0n1
. - Press
x
for expert mode - Press
n
to create a protective MBR - Press
w
to write the partition andy
to confirm - If gdisk doesn't quit, press
q
to exit the command
- Open a terminal and type in
-
Enable the GRUB menu so that you'll have time to pick Windows
- Boot into your linux install by selecting the Windows option in startup manager.
- Edit
/etc/default/grub
with any preferred editior (nano/vim/) and with sudo. Change lineGRUB_TIMEOUT_STYLE
toGRUB_TIMEOUT_STYLE=MENU
. If you are usingnano
, save the file by doing CTRL+X, Y, then enter. - We've now changed the GRUB Bootloader settings, but we now need to update GRUB to apply these changes. Type in
sudo update-grub
and hit enter. After the command is done, you're finished.
-
You should now be able to boot either Windows or Linux from the GRUB bootloader.
If Linux is installed first¶
- Make sure that your linux partitions are not labled as
Microsoft Basic Data
, if they are, Bootcamp Assistant will think Windows is already installed. To fix this, go to Linux and dosudo cfdisk /dev/nvme0n1
and change the type of your linux partitions toLinux Filesystem
. - Install Windows normaly with Bootcamp. Windows will replace your Linux boot option.
- Boot into macOS.
sudo diskutil mount disk0s1
- Go to
/Volumes/EFI/efi
- In this folder there will be a
Microsoft
folder, anApple
folder, one with your distro's name or justGRUB
, and one calledBoot
. TheBoot
folder will have a file namedbootx64.efi
, rename this towindows_bootx64.efi
- Copy the
grubx64.efi
file in your distro's folder to/Volumes/EFI/efi/Boot/bootx64.efi
. The the Windows option in Startup Manager will now boot Linux. -
Fix blank screen issue that may occur when booting Windows (Credits to gbrow004 for documenting this fix on his Gist).
- In Linux, open a terminal and type in
sudo gdisk /dev/nvme0n1
. - Press
x
for expert mode - Press
n
to create a protective MBR - Press
w
to write the partition andy
to confirm - If gdisk doesn't quit, press
q
to exit the command
- In Linux, open a terminal and type in
-
Enable the GRUB menu so that you'll have time to pick Windows
- Boot into your linux install by selecting the Windows option in startup manager.
- Edit
/etc/default/grub
with any preferred editior (nano/vim/) and with sudo. Change lineGRUB_TIMEOUT_STYLE
toGRUB_TIMEOUT_STYLE=MENU
. If you are usingnano
, save the file by doing CTRL+X, Y, then enter. - We've now changed the GRUB Bootloader settings, but we now need to update GRUB to apply these changes. Type in
sudo update-grub
and hit enter. After the command is done, you're finished.
-
You should now be able to boot either Windows or Linux from the GRUB bootloader.
It may be possible to skip steps 5-8 by doing the following command in macOS: sudo sh -c "bless --mount /Volumes/EFI --setBoot --file /Volumes/EFI/efi/$(ls /Volumes/EFI/efi|grep -i -e microsoft -e boot -e apple -v)/grubx64.efi --shortform"
This might not prevent step 8 from being needed.
Using seperate EFI partitions¶
Installing Linux (With or without Windows already installed)¶
In macOS¶
Create partitions with Disk Utility:
- Make a 500Mb FAT32 partition, call it something like
EFI2
. Make sure you do not useEFI
as the label. - Create your main partition(s) for Linux, make them macOS Extended/HFS+ to stop Bootcamp Installer from thinking they are Windows. These will be erased and reformatted by your installer.
In your distro's installer¶
If you are using an interactive installer:
-
Set the
EFI2
partition to be mounted at/boot/efi
and set it as "ESP"/"Boot"/"EFI System Partition". Don't use the partition labeledEFI
located at/dev/nvme0n1p1
, to avoid breaking the Windows bootloader stored there. Ensure that/dev/nvme0n1p1
wasn't set by default to be used as the "EFI System Partition".Ubuntu
On Ubuntu since the installer doesn't support seperate EFI partitions, install normally to the Windows EFI partition and follow this section to seperate out the partition.
-
Your main partition that were formatted as macOS Extended/HFS+ can be mounted at
/
. -
If it fails to install the bootloader, open a terminal:
- Use
lsblk
ormount
to find where your install's root partition is installed chroot $that_partitions_mount_point_here
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --no-nvram --removable
- Use
-
There will now be an
EFI Boot
option in the macOS Startup Manager (The menu you get by holding option at boot) which will boot Linux.
If you are doing it manually:
- Format the main Linux partition(s) as ext4, btrfs, or whatever you intend to use.
- Mount your partitions, put the
EFI2
one at/boot/efi
within your chroot. - Install normally up until you install your bootloader, but don't forget to get a patched kernel and the correct dkms modules
- Within your chroot, do
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --no-nvram --removable
- There will now be an
EFI Boot
option in the macOS Startup Manager (The menu you get by holding option at boot) which will boot Linux.
Installing Windows when Linux is installed¶
- If there are partitions labeled as
Microsoft Basic Data
, Bootcamp Assistant will think you have Windows installed. Usesudo cfdisk /dev/nvme0n1
to change your Linux partitions toLinux Filesystem
or whatever is appropriate. - If your second EFI partition is labeled as
EFI System
, you'll need to usecfdisk
again to make it not that, as the Windows installer fails if there are two. - Bootcamp should install Windows normally. If you put your Linux bootloader on
/dev/nvme0n1p1
, Windows will replace it, and that's why a second EFI partition is ideal.
Seperate the EFI partition after Linux is installed¶
In case you have installed Linux to the same EFI partition as used by Windows, and now want to seperate it out, then:
- Using disk utility, make a 500Mb FAT32 partition, call it something like
EFI2
. Make sure you do not useEFI
as the label. - Download this script.
- Run this script using
bash /path/to/script <Name of seperate partition>
in Linux. E.g.: If your seperate partition has the nameEFI2
, and script is in your Downloads folder, runbash $HOME/Downloads/efi.sh EFI2
.