Vanilla here means that we are going to be installing straight from an untouched ARM64 Debian netinst ISO, with no need for custom kernel modifications or any gymnastics of the original content before installation. In other words, by following this guide, you will get as close to the same experience as the one you have when installing Debian from an x86 ISO on an UEFI PC. As a matter of fact, once the Debian installer starts, it will be indistinguishable from a PC installation experience. You will also end up with everything you'd expect to see from a PC install, including a graphical GRUB prompt as well as a system that'll natively update its kernel and initrd, without the need for further configuration...
Overview of the entire process
Create a GPT ESP (EFI System Partition) onto an USB, extract the netinst.iso content there, add the latest Raspberry PI UEFI firmware and proceed to a standard Debian networked installation. That's it!
Or did you perhaps think that the process of installing Debian on an ARM platform would be different from the process of installing Debian on a UEFI based PC? Why on earth should that be the case? The whole point of having an SBBR-compliant UEFI firmware (which we do have for the Pi 4) is precisely so that we stop with the madness of having each ARM platform require its custom media installation and boot process. SBBR and UEFI gets you the ability to use vanilla installation media to boot and run your OS. Oh, and that works not just for Linux, but for Windows and other OSes too!
Prerequisites
Hardware
- One USB drive or SD card with sufficient space (at least 16 GB or more). A fast USB 3.0 flash-based drive is strongly recommended over anything else, as it'll provide you with a much better overall user experience.
- A Raspberry Pi 4 Model B that is physically connected to the network through the Ethernet port (i.e. For the time being, WiFi is currently hit or miss, so you are much better off trying with a wired connection).
Also note that your Pi 4 should use an EEPROM that supports USB boot. If you purchased it after April 2020, it should probably already be the case, but if you are using an older model, and haven't updated its EEPROM yet, you should create and run an EEPROM update media using the files from here.
Software
- The latest official Debian 11 ARM64 net install ISO.
- The latest Raspberry Pi 4 UEFI firmware binary, (which also includes the relevant Broadcom bootloader support files, i.e. config.txt, fixup4.dat, start4.elf).
- Partition the USB/SD media as GPT (not MBR) and create a ~350 MB ESP partition on it.
Note: Make sure that you create a partition of type ESP and not "Basic Data" as Debian's partition manager will have trouble using it otherwise. - Format the ESP as FAT32
- Extract the full content of the netinst ISO onto the ESP (including the .disk/ directory).
- Extract the full content of the UEFI firmware zip onto the ESP.
- Eject your USB/SD drive and insert it into your Raspberry Pi 4
If you are running Windows and have downloaded Rufus as well as the prerequisite files, then the process becomes:
- Launch Rufus and make sure your media is plugged in
- Click the SELECT button and select the Debian netinst ISO
- Ctrl-Click the SELECT button (yes, that means you should click SELECT again, but this time with the Ctrl key pressed at the same time) and select the UEFI Firmware zip. Ctrl-SELECT is a special mode of Rufus that allows adding files to an already selected ISO, which is what we want to do.
- Change Partition scheme to GPT (Make sure you do select GPT and not MBR or else the process will not work)
- Click START
- When prompted, choose Write in ISO → ESP mode. Note that you will only get this option is you selected GPT for Partition scheme, so if you don't see it, please double check Partition scheme.
- Let Rufus complete the media creation
- Eject your media and insert it into your Raspberry Pi 4
Just follow the Debian installer prompts. The whole point of the media creation above is so that, once you plug your USB drive and boot the Pi, the installation experience will be the same as the one you would get on a PC, so I will not be covering that in details.
The only elements I will mention are that:
- If using an SD card, you may have to alter your boot options in the UEFI firmware to either disable PXE or make it lower priority than SD card boot.
- If using an SD card, the installer will report that No Common CD-ROM drive was detected. during the media detection. You will have to perform the following:
- On Load CD-ROM drivers from removable media select No.
- On Manually select a CD-ROM module and device select Yes.
- On Module needed for accessing the CD-ROM select none.
- On Device file for accessing the CD-ROM type the following exactly:
-t vfat -o rw /dev/mmcblk1p1
- When prompted for non-free firmware files, you should select No as WiFi is unlikely to work for installation and should be avoided. Or, if you really want, you can say yes, knowing that, if you are using an USB based installation media, you will have to unplug and replug it for each file being requested, due to a media detection bug in the Debian installer.
- When/If prompted for the network card, you should select enabcm6e4ei0 (which should be the first one in the list).
- During partitioning, you should leave the ESP as is (which the Debian installer will be smart enough to do on its own, as long as you only use the free space for the new partitions to be created). If you don't know what to choose, you should choose Guided - use the largest continuous free space which is the default.
- If you get an error dialog for Configure the package manager (apt configuration problem: An attempt to configure apt to install additional packages from the media failed) you can safely ignore it by selecting Continue and then choosing your mirror location country from the list.
Post Installation Tweaks
If you are using a 4 GB or 8 GB Raspberry Pi 4 board, and provided that you are using a Debian installation ISO that was created after 2020.09.07 (i.e. one that uses version 5.8 of the Linux kernel), you will find that the system reports only 3 GB of RAM available.
This is because (as far as we know) Broadcom botched their PCIe DMA implementation so that the VIA xHCI controller can only effectively access 3 GB of RAM unless the OS kernel implements bounce buffers or some other workaround. This workaround has recently been added into the Linux 5.8 kernel, which is what recent Debian 11 installation ISOs use, so, after you have confirmed that you are using a post 5.8 kernel (through uname -a for instance), you should perform the following:
- Reboot the OS.
- Go to the UEFI settings by pressing the Esc key when you see the UEFI firmware coloured Raspberry logo.
- Go to Device Manager → Raspberry Pi Configuration → Advanced Configuration and set Limit RAM to 3 GB to <Disabled>.
- Save the settings and reboot
Also, if you did install the Wifi firmware blobs, you may find that you get the following error during boot:
Code: Select all
[ +0.000067] brcmfmac mmc0:0001:1: firmware: failed to load brcm/brcmfmac43455-sdio.Raspberry Pi Foundation-Raspberry Pi 4 Model B.txt (-2)
[ +0.000097] firmware_class: See https://wiki.debian.org/Firmware for information about missing firmware
[ +0.000065] brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.Raspberry Pi Foundation-Raspberry Pi 4 Model B.txt failed with error -2
Mini FAQ
Can I perform a graphical install? Does X work?
Absolutely. And if you install in graphical mode, you'll also get a graphical GRUB prompt which is nice.
What about Pi 4 devices that aren't supported yet?
It needs to be pointed out that, in order to be SBBR compliant, which is the precise reason why you can use vanilla media and vanilla installation methods, the default boot mode of the platform, as enacted by the UEFI firmware, will be ACPI and not Device Tree, so the question of having hardware X or Y supported in Linux becomes a question of having a driver with the necessary ACPI bindings in the kernel (which means that a driver that only has the Device Tree bindings will not be enough). But again, since this is a pure Linux kernel issue, and not a UEFI one, once they get added to the Linux kernel, they will naturally percolate to your networked Debian installation. Oh, and if you are impatient to have this or that driver working in vanilla Debian, by all means you should submit a driver update to the mainline kernel!
Why use netinst.iso and not mini.iso?
If you are very size conscious, you may wonder why we didn't go for Debian's mini.iso which is quite a bit smaller than netinst.iso, and can actually be used to perform an networked installation just the same. It mostly boils down with wanting to reach a trade-of between speed and size. The advantage of using netinst is that you don't have to download the base system components, so it makes the process of installing Debian faster as a result. But of course, that means that you're going to lose about 300 MB of disk space that's only going to be used once. Considering the current flash-based media capacity, we don't consider this as a major drawback, but if you see it as a dealbreaker, by all means use the smaller mini.iso and resize your ESP accordingly.
What about using the Debian 10 release?
We tried to get the Debian maintainers to backport the Genet ACPI bindings, required for network support, into the 4.x kernel used by Debian 10.x, but unfortunately they have not been receptive to that idea at all. And of course, without a working network driver, this whole process is pointless.