User:Nahsi/Installing Gentoo on Apple MacBook Pro 12.1 (early 2015) using ZFS

From Gentoo Wiki
Jump to: navigation, search

This guide will go through installing Gentoo on MacBook Pro 12.1 (early 2015) using ZFS on a single SSD disk. In the end you will hopefully have:

 - single Gentoo system (no dualboot)
 - minimal but working kernel 5.4.18
 - EFI without the bootloader
 - initramfs built into kernel
 - / and /home on ZFS 0.8.3 (/home optionally encrypted using ZFS native encryption)
 - working media/backlight keys, ACPI events (sleep on lid close etc)

Guide will include general steps required to install Gentoo like configuring Portage, but in brief. For more information please consult the handbook.

If you don't want ZFS just skip ZFS related stuff.

Installing Gentoo

First steps

Create USB stick with Ubuntu

Ubuntu 19.10 can boot in UEFI mode, bundled with recent version of ZFS and overall a very pleasent distro to install Gentoo with.

Please download ISO file and dd it into a USB flash stick. You will need at least 4 GiB stick. Write Ubuntu image onto the flash stick:

root #dd of=ubuntu-19.10-desktop-amd64.iso of=<your usb stick> bs=4M status=progress

Boot into Ubuntu

Press power button while pressing left alt key on you MacBook.

You will see UEFI menu. Choose to boot from a flash stick.

Confirm that you booted in UEFI Mode

After you booted into Ubuntu, make sure that you booted into UEFI mode by typing the following:

root #ls /sys/firmware/efi

If the above directory is empty or doesn't exist, you are not in UEFI mode. Reboot and boot into UEFI mode.

Warning
Continuing the installation without being in UEFI mode will most likely yield an unbootable system. If you want to install in BIOS mode, you will need a different setup.

Partition

Using cfdisk

root #cfdisk /dev/sda

create two partitions:

/dev/sda1   | 128 MiB       |   EFI System Partition
/dev/sda2   | rest          |   ZFS

Format EFI partition

root #mkfs.fat -F32 /dev/sda1
Warning
This partition needs to be FAT32 due to it being an UEFI requirement

Indentify disk id

root #ls -lh /dev/disk/by-id/
lrwxrwxrwx 1 root root  9 Feb  9 14:31 ata-APPLE_SSD_SM0256G_S29CNYDG826559 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb  9 14:31 ata-APPLE_SSD_SM0256G_S29CNYDG826559-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb  9 14:31 ata-APPLE_SSD_SM0256G_S29CNYDG826559-part2 -> ../../sda2
lrwxrwxrwx 1 root root  9 Feb  9 14:31 usb-APPLE_SD_Card_Reader_000000000820-0:0 -> ../../sdb

Create your zpool

Create your zpool which will contain your drives and datasets:

root #zpool create -f -o ashift=12 -o cachefile= -O compression=lz4 -O acltype=posixacl -O atime=off -O xattr=sa -O normalization=formD -m none -R /mnt tank /dev/sda2

- ashift=12 - set underlying block size to 4KiB - cachefile= - no caching file (we will create it later) - -O - set datasets options that will be inherited, but can be changed for every dataset - compression=lz4 - compression is a good thing, enable it - acltype=posicacx