For this guide, I'm installing PopOS, but i've tried to make the instructions fairly general.
I might end up rewriting this to use qemu, as passing through actual partitions to a VM works on qemu for me and means less steps.
Install VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Create a 64 bit Linux VM called "t2linux"
- Do not create storage for the VM now, we will do this manually.
- In macOS Terminal, create an iso disk image to install to:
cd ~/VirtualBox\ VMs/t2linux
dd if=/dev/zero of=./linux.iso bs=1g count=16
, change count from 16 to your distro's minimum install space in GB (We will expand the partition later).VBoxManage internalcommands createrawvmdk -filename ./linux.vmdk -rawdisk ./linux.iso
- In VirtualBox, Settings -> Storage -> Controller: SATA -> "Hard Disk +" icon -> Add -> Select linux.vmdk, then you'll be able to choose linux.vmdk to add to the VM.
- Go to the VM's settings
- Boot the VM
- Follow your distro's install process, but do partitioning manually.
- Partition
- Create a GPT partition table
- Create a 500 MB fat32 partition called "EFI2", set its flags to "ESP"
- Create an ext4 or btrfs partition with the rest of the space, called "Root"
- EFI2 will be mounted at /boot/efi, Root will be mounted at /
- Continue installing
- Reboot the VM into your install
https://wiki.t2linux.org/guides/postinstall/
-
Change the first field in the line about
/boot/efi
to use the PARTLABEL, as it's UUID will change when we move the install. Also add the nofail option. For example:PARTLABEL=EFI2 /boot/efi vfat umask=0077,nofail 0 0
-
Also ensure that all other disks are defined in fstab by their
UUID=
, notPARTUUID=
or /dev/sdXY. You can find the UUID of your partitions withsudo blkid
.
-
Shutdown your VM
-
In terminal,
hdiutil attach -nomount ~/VirtualBox\ VMs/t2linux/linux.iso
-
Open macOS Disk Utility
- Click "Partition"
- Create a 500MB MS-DOS (FAT32) partition called "EFI2"
- Create a second partition with any format, but call it "Linux" and make sure it's larger that the "Root" partition you created in the VM. This will be the space for linux, so give it however much space you want linux to have.
- Apply these changes.
-
In terminal, run
diskutil list
, you should have something similar to this for disk0:/dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.3 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk0 164.6 GB disk0s2 3: Microsoft Basic Data EFI2 499.1 MB disk0s3 4: Apple_HFS Linux 84.3 GB disk0s4
The Disk Image should be there too:
/dev/disk3 (disk image): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme +16.7 GB disk3 1: EFI NO NAME 524.3 MB disk3s1 2: Linux Filesystem 16.1 GB disk3s2
-
Copy the efi partition
diskutil mount disk3s1
(Changedisk3s1
to the identifier of the EFI partition of the Disk Image).- In Finder, copy everything in the "NO NAME" disk (which was just mounted) to the "EFI2" disk that is on your internal SSD.
-
Copy the root partition over with
dd
. Be very careful that you use the right disks. Change the "if" (input file) to the disk image's "Linux Filesystem" partition, and the "of" to your ssd's "Root" partition. Do not set "of" or "if" to any partitions that you don't want to overwrite. This can overwrite macOS (or windows) if the wrong disks are used.- Unmount "Root" with Finder
- Copy the Root partition:
sudo dd if=/dev/disk3s2 of=/dev/disk0s4 bs=16M
- While
dd
runs, you can presscontrol-T
to see how many bytes it has written.
- reboot, and hold down command-R to enter macOS Recovery
- On the top menu bar select utilities and open startup secrity utility
- set secure boot to "no security"
- restart and hold option
- there should be a "EFI Boot", pick it.
expand root partition with gparted or something similar
Make the efi partition get mounted by UUID not name:
Edit fstab, and uncomment the boot partition's line, and change it to use the UUID, which can be found with sudo blkid
uname -r
if it doesn't have "t2" in it, then you need to set your bootloader to boot the mbp kernel. Look up instructions for your distro.