Installing Asahi Linux on a MacBook with an M2 processor

Written by

in

On a Mac with an Apple Silicon processor, you cannot install Linux in the usual way: booting from a flash drive is impossible here, and the bootloader is signed by Apple. The Asahi Linux project undertook to get around this – its participants used reverse engineering to make the M1 and M2 hardware work under regular Linux. Now the flagship distribution of the project is Fedora Asahi Remix, and it works quite reliably on the M2. In this post I will describe the installation step by step.

What is Asahi Linux

The project started in 2020, when Apple switched to its own chips and with them came a closed boot scheme: the device runs only Apple-signed code. Asahi Linux participants wrote their m1n1 bootloader, on top of which they wrote U-Boot and a UEFI environment. Next, the most common ARM64 system is loaded, but with a linux-asahi kernel, to which drivers for non-standard Apple hardware are added: GPU, video, sound, camera units.

In practice, it looks like this: you run the installer from macOS, it partitions the disk, installs the boot chain and the system. macOS remains in place, you get dual boot and choose your system when you turn it on.

Requirements

  • Mac on the M2 chip – MacBook Air, MacBook Pro 13″, as well as 14″ and 16″ with M2 Pro and M2 Max. M1 cars are also supported.
  • Current macOS. The installer requires the latest version of the system, so update before starting.
  • Free space. Minimum about 30 GB, comfortable – 100 GB or more. The space is cut off from the APFS container and will not come back on its own.
  • macOS administrator password. You will need it both during partitioning and when booting into recovery mode for the first time.
  • Backup. Disk partitioning is an operation that is best started with a fresh backup.

Step 1. Backup and update

Make a copy via Time Machine or any other method. Update macOS to the latest version available and reboot. If FileVault is enabled, the password for it will still be needed at the boot stage in recovery mode – the installer needs to unlock the drive.

Step 2. Launch the installer

Open Terminal on macOS and run one command:

This is the official installer of the project. It will download itself, check your Mac model and offer to choose a distribution. There is also an option directly for Fedora:

The first option is preferable: it shows which systems are currently available, and it also offers a choice of desktop.

Step 3. Disk partition

The installer will ask for the administrator password and show the current layout. Then the dialogue looks like this:

  • Press r to resize the macOS partition.
  • Enter the size of the new Linux partition. It can be in gigabytes, it can be as a percentage of the disk, or you can write min – then the smallest possible piece will be cut off.
  • Confirm the marking with the letter y. This step is the longest: the system physically moves the data in the APFS container; on a large disk this takes several minutes.
  • Press f to point the installer to the newly created free partition.

It is important to understand what is happening: Linux is not installed inside APFS, but on a separate partition next to it. This is why macOS remains untouched, and the rollback is reduced to deleting this section.

Step 4. Selecting distribution and desktop

Next, the installer will offer the system and desktop environment. Fedora Asahi Remix comes with KDE Plasma by default – it is the flagship option that receives updates first. An alternative is GNOME, which is closer in feel to macOS. There is also a minimal image if you don’t need a graphical environment.

Step 5. First boot in recovery mode

After partitioning, the installer will prompt you to continue, and the Mac will shut down. Here comes the most unusual part:

  • Wait at least 25 seconds – this is Apple’s requirement to enter recovery mode.
  • Hold and hold the power button until boot options appear.
  • Select the installation volume and enter your macOS password.

At this step, the boot chain is installed in the service partition: m1n1, U-Boot and UEFI environment. Then the machine will reboot again – hold down the power button again and select a new volume, this time to get into the system. There will be several such reboots, each requiring manual selection: by default, the Mac continues to load macOS.

Step 6. Installing the system

Next, the initial setup wizard starts: system name, user, password, time zone, keyboard layout. After this, the installation itself begins, and it is already coming from the Internet – you will need a stable connection, and in time it takes from fifteen minutes to half an hour.

When the installation is complete, reboot and select Linux from the boot menu. When you log in for the first time, the system will prompt you to complete the setup and update.

What works and what doesn’t

Before installation, you should soberly assess what you will lose. On M2 laptops the situation is as follows:

Works:

  • Wi-Fi and Bluetooth – without restrictions.
  • Integrated screen and graphics – hardware accelerated, including OpenGL and Vulkan.
  • Webcam, microphone, and speakers on MacBook Air and MacBook Pro.
  • Sleep mode – works normally.
  • Hardware video decoding – players do not load the processor.
  • USB ports, including USB 2 and USB 3 via Thunderbolt connectors.

Doesn’t work or works partially:

  • Touch ID. Fingerprint is not available in Linux – log in with password.
  • Thunderbolt (USB4). Status – in development. Unfortunately, devices that specifically require Thunderbolt will not work.
  • External monitor via USB-C. DisplayPort Alt Mode is also in operation. M2 laptops don’t have an HDMI port, so you can’t connect an external screen. Models with M2 Pro and M2 Max have HDMI, and it works. A workaround for USB-C is in the fairydust core section below.
  • Hardware video encoding is in the plans, decoding is already in place.

Simply put, it’s a great system for working with code, terminal, browser and local models, but not for an external monitor dock.

External monitor via fairydust core

USB-C image output is available in the experimental fairydust kernel branch from the Asahi Linux team. It takes a long time to assemble it manually, so it’s easier to use the wrapper script from the asahi-fairydust-display project:

cd asahi-fairydust-display
chmod +x asahi-fairydust-build.sh
./asahi-fairydust-build.sh

The script clones the fairydust branch, configures and assembles the kernel, places it next to the standard one and edits GRUB. You need 15 GB of free space, a USB-C → HDMI or DisplayPort adapter and 60–90 minutes to assemble. After the reboot, select the kernel labeled -fairydust in GRUB and insert the adapter into the frontmost USB-C port.

Check after download:

glxinfo | grep "OpenGL renderer"
xrandr

The first command should show the version with the suffix -fairydust, the second should show the Apple M2, not llvmpipe, the third should show the connected DP-1 output.

Reservations. The branch is experimental and not officially supported. The output only works through one USB-C port and does not always survive hot plugging – it’s safer to reboot with the adapter already inserted. The script does not automatically configure the display: the corresponding step in it is disabled because it caused a login loop on Wayland. Updating the stock kernel via dnf rearranges the /boot/dtb symlink, which is why the output may silently stop working – then the build must be repeated.

The standard kernel is not touched: to return, just select it in the GRUB menu.

External drive instead of upgrade

Here’s the good side. The MacBook cannot be upgraded: the memory and storage are soldered onto the board, and their capacity is selected once upon purchase. In macOS, the external drive remains external – the system and applications cannot really be transferred to it.

In Linux, this limitation is removed: an external SSD via USB is a regular block device, and any mount point can be transferred to it via /etc/fstab. If you want to transfer your home directory, Steam library, virtual machine images or local models, please do so. It turns out exactly the upgrade that this car does not have.

It looks like this. First, look at the UUID of the desired partition:

sudo blkid

Then add the line to /etc/fstab:

The transfer itself is done by copying: the data is moved to an external drive, after which it is mounted at the desired point. More often than not, not the entire /home is taken away this way, but individual heavy directories – this way there is less risk.

A couple of caveats. The nofail parameter is worth setting in the options: without it, the system will not boot if the disk is not connected. The speed of a USB drive is still lower than the built-in NVMe, so it’s better to leave space on the internal disk for frequent I/O operations. And there is no need to pull out the disk while moving with directories mounted there – first unmount it.

How to switch between systems

When you turn it on, hold down the power button – the boot menu will appear, it will contain macOS and Linux. You can select the default system in macOS: “System Preferences” → “General” → “System Disk”. Linux also has the corresponding settings, so you can switch in both directions without a terminal.

Links

https://asahilinux.org/fedora/
https://asahilinux.org/docs/
https://asahilinux.org/docs/platform/feature-support/m2/
https://fedoraproject.org/asahi-remix
https://github.com/bharambetejas/asahi-fairydust-display
https://github.com/AsahiLinux/linux/tree/fairydust

Sources

https://asahilinux.org/docs/platform/feature-support/m2/
https://discussion.fedoraproject.org/t/fedora-asahi-remix-installation-guide/
https://github.com/AsahiLinux/docs
https://github.com/bharambetejas/asahi-fairydust-display/blob/main/README.md
https://github.com/bharambetejas/asahi-fairydust-display/blob/main/asahi-fairydust-build.sh

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *