rpi-provision Declarative first-boot provisioning for Raspberry Pi 5 SD cards Source on GitHub

0002. Write only to the FAT boot partition

Status: accepted

Context

A Raspberry Pi SD card has two partitions: a FAT32 boot partition and an ext4 root filesystem. Configuring a headless device means changing things in both places — config.txt and cmdline.txt live on the first, /etc/NetworkManager/system-connections/, /etc/passwd and /etc/ssh/sshd_config.d/ on the second.

The tool has to run on Windows as well as Linux. That asymmetry dominates the design:

Operation Linux Windows
Read and write FAT32 native native (drive letter)
Read and write ext4 native needs wsl --mount, or a third-party driver
Loop-mount a .img losetup needs WSL2 or a privileged container

Reaching the root filesystem from Windows means requiring WSL2, elevation and a physical-disk mount — a large step up in prerequisites and in the blast radius of a mistake.

Decision

rpi-provision writes only to the FAT boot partition. Everything that belongs on the root filesystem is staged as a payload plus a manifest and installed during the first boot by a generated runner, hooked in through systemd.run= on the kernel command line.

Consequences

Accepted costs:

Alternatives considered

Revisit if

An .img customisation mode is wanted for CI. That would be an additional backend behind the same Plan, not a replacement: render is already independent of the filesystem, and BootFs is already a trait.