The Compendium · Chapter 9 of 20

Installing Linux

7 min read · 8 sections

If you’re on a non T1 or T2 Mac, then you can download the Linux distro of your liking.  If you do have a T1 or T2 Mac, then you must download a distro from t2linux.org.  The process is mostly the same either way; T-chip-specific steps will have a letter designator after the step number and will be emboldened below.  Also note, the instructions will vary depending on your chosen flavor of Linux, especially Arch or Kali Linux.  The guidance below is for Ubuntu, which is the preferred flavor of Think quadratic..

Step 4 & 4a: Preinstallation of Linux – Create bootable USB

  • In macOS, download your preferred flavor of Linux; T-chips from here
    • Don’t try standard downloads on T-chips; they won’t work
    • Use the iso.sh method to make this process easier
      • Download the “iso.sh” file
      • Open Terminal and type “bash “ including the space
      • Drag and drop the iso.sh file into Terminal
        • The command should look something like “bash ~/Downloads/iso.sh”
      • Hit “Enter” and answer the questions in Terminal
        • Keep in mind, future maintenance will depend on which version you choose:
          • ##.04 versions are long term support (LTS)
          • ##.10 are preview versions of the next major release
  • You’ll end up with an Ubuntu iso image in “Downloads”
  • Download balenaEtcher from here
  • Install balenaEtcher
  • Plug in an 8GB or higher USB
  • Open balenaEtcher
  • Follow prompts to turn the Linux distro you downloaded into a live USB

Step 4b: Preinstallation of Linux – Prepare WiFi and Bluetooth Drivers

  • Download the necessary script here, be sure it stays in the “Downloads” folder
  • Open Terminal, type “bash ~/Downloads/firmware.sh” and hit “Enter”
    • Enter Password and hit “Enter”
    • Don’t worry about the commands that appear, We have them rewritten for you in the next section
  • Leave Linux Live USB plugged in and reboot

Step 5 & 5a: Install Linux

  • rEFInd should see the Live USB and show a logo with three circles, select it
    • If not, hit the “Escape” key
    • If it still does not show, the creation of the live USB did not work
  • Choose to install Linux, not try it
    • Go through the installation process
      • Select to install third party software and hit “Next”
      • On next screen, click “Something else”
        • In the new popup window, select the Windows partition (typically the third one, with NTFS in “type” column
          • Click the “Change” button, popup window appears
          • Shrink the Windows partition to the size of your liking (half the size is ideal)
          • IF THIS POPUP DOES NOT ALLOW YOU TO CHANGE THE PARTITION, GO TO OPTIONAL STEP B
          • Leave “do not use the partition” as is; just hit “OK”
          • Click “Continue” on the warning that appears
        • Select the remaining free space and click the “+” sign
          • START BACK HERE IF YOU HAD TO FOLLOW OPTIONAL STEP B
          • In the popup, set its size to half the free space (see sub-item) and format it to EXT4
          • If <32GB RAM, reserve at least 1GB for Swap partition out of the Linux partition
          • Choose the “/” option for the “Mount point”
          • Unless you need to add a Swap partition, leave the remaining free space alone
            1. If Swap needed, select free space, click “+” sign, add 1GB of Swap
        • Choose the newly created partition (typical fourth in list) for boot loader installation; DO NOT INSTALL BOOT LOADER TO FIRST PARTITION OR YOU WILL HAVE ONLY A LINUX MACHINE
        • Click “Install Now”
          • Click “Continue” to write changes to disk
    • Finish installation setup, including admin-level account creation
  • Remove the USB drive and reboot when prompted

The EFI drive will be a wreck now, and it will boot into Linux automatically, but don’t bother following Step 3 to rebless rEFInd just yet.  Let your Mac automatically boot into Linux until it is completely set up.  For those without a T1 or T2 Mac, this is mostly a simple matter of getting the additional drivers and software updates through the usual means, but for those with a T1 or T2 Mac, there are several more steps you’ll need to follow before Linux will be usable.  Don’t worry, it will be worth it in the end though!

Step 5b: Install WiFi and Bluetooth drivers for T1 and T2 Macs

  • Log into the admin-level account in Linux
  • Open Terminal and execute each of the following:
    • “sudo umount /dev/nvme0n1p1”
    • “sudo mkdir -p /tmp/apple-wifi-efi”
    • “sudo mount /dev/nvme0n1p1 /tmp/apple-wifi-efi”
    • “bash /tmp/apple-wifi-efi/firmware.sh”
  • No need to restart, you can now connect to WiFi
  • Complete all updates

The Ubuntu version of the T1 and T2 installer does not come loaded with the Snapd Store; if you want it, follow these steps:

Step 5c: Install Snapd Store

  • Open Terminal and type
    • “sudo apt update”
    • “sudo apt install snapd”
    • “sudo snap install snap-store”
  • Install “snaps” (apps) to your heart’s content
  • Reboot when done

The T1 and T2 versions of Ubuntu won’t receive kernel updates in the usual way (from Canonical), until you add this trusted repository maintained by Aditya; be sure to thank them!

Step 5d: Configure Updates for T1 and T2 Macs’ kernel

  • Open Terminal and paste in command below; if you installed Ubuntu 22.04 then the “Codename” is “jammy” (as seen below), but if you installed Ubuntu 23.10, then the “Codename” is “mantic.”  And commands for future releases will also match the Codename:
    • “CODENAME=jammy

curl -s --compressed "https://adityagarg8.github.io/t2-ubuntu-repo/KEY.gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/t2-ubuntu-repo.gpg >/dev/null

sudo curl -s --compressed -o /etc/apt/sources.list.d/t2.list https://adityagarg8.github.io/t2-ubuntu-repo/t2.list

echo "deb [signed-by=/etc/apt/trusted.gpg.d/t2-ubuntu-repo.gpg] https://github.com/AdityaGarg8/t2-ubuntu-repo/releases/download/${CODENAME} ./" | sudo tee -a /etc/apt/sources.list.d/t2.list

sudo apt update”

  • Hit “Enter” then type:
    • “sudo apt install linux-t2-lts” if using 22.04
    • “sudo apt install linux-t2” if using 23.10
  • Don’t close Terminal; need it for next step

Now, whenever you use the built-in Software Updater app, it will update as normal.  But we’re not quite done setting up our T1 or T2 Macs yet because they all came with that pesky Touchbar, which requires special coding to configure.

Step 5e - Setting up the Touch Bar

  • No matter if you are using an Ubuntu or Debian based distro, add the apt repository for T1 and T2 Macs by typing:
    • “curl -s --compressed "https://adityagarg8.github.io/t2-ubuntu-repo/KEY.gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/t2-ubuntu-repo.gpg >/dev/null

sudo curl -s --compressed -o /etc/apt/sources.list.d/t2.list "https://adityagarg8.github.io/t2-ubuntu-repo/t2.list"

sudo apt update”

  • Then type the following; if you installed Ubuntu 22.04 then the “Codename” is “jammy” (as seen below), but if you installed Ubuntu 23.10, then the “Codename” is “mantic”:
    • “CODENAME=jammy

echo "deb [signed-by=/etc/apt/trusted.gpg.d/t2-ubuntu-repo.gpg] https://github.com/AdityaGarg8/t2-ubuntu-repo/releases/download/${CODENAME} ./" | sudo tee -a /etc/apt/sources.list.d/t2.list

sudo apt update”

  • Hit “Enter” and then type:
    • “sudo apt install tiny-dfr”
  • Hit “Enter” and Touchbar should activate
  • If not, it will after restarting
  • Restart

After restarting, you can run “sudo touchbar” to get a list of options for configuring the Touchbar. Simply follow the on-screen instructions. Note this command is only for Ubuntu or Debian based distros.

Before we can rebless rEFInd, we have to “repair” the Guid Partition Table, otherwise, Windows won’t boot until we do.  This step is the same regardless of the presence of a T-chip.

Step 6: Convert GPT

  • Reboot into admin-level account in Linux
  • Open Terminal and type:
    • “sudo apt-get update -y”
  • Hit “Enter” then type:
    • “sudo apt-get install -y gdisk”
  • Hit “Enter” then type:
    • “lsblk” and hit “Enter” (this gives you a clear name for the entire disk)
    • Most guides say the disk is “/dev/sdX” but on later Macs it’s “/dev/nvmeXnX”
    • More than likely, it’s going to be “/dev/nvme0n1”
  • Type “sudo gdisk /dev/nvme0n1” and hit “Enter”
    • Should see four lines with “MBR: hybrid” at the top
    • Type “x” and hit Enter
    • Type “n” and hit Enter
    • Type “m” and hit Enter
    • Type “w” and hit Enter
    • Type “y” and hit Enter
  • Type “sudo gdisk /dev/nvme0n1” again and hit Enter
    • Verify the MBR line now reads “protective” in stead of “hybrid”
    • Immediately type “q” and hit “Enter” (to avoid messing anything up)
  • Close Terminal and reboot

As mentioned, the Linux installation will break rEFInd again…follow Step 3 again.  Note: you don’t need to retype the commands, just arrow up to scroll through history of commands.

All three OS logos should now be visible when you reboot, along with another three circles logo (backup kernel for Linux), which can be removed, simply by arrowing over to it and hitting the “-“ sign, then “Yes”