pmaports/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-systemd-cryptsetup@.service.d-factory-reset-ordering.conf
Clayton Craft dceffe8a46
main/postmarketos-duranium: new aport
Duranium is an immutable variant of postmarketOS that uses systemd's
image-based OS model: dm-verity verified /usr, A/B slots managed by
systemd-sysupdate, LUKS2-encrypted root, and systemd-boot with UKIs.

This package ships systemd-repart, systemd-sysusers, tmpfiles, and
first-boot service configuration needed at runtime in both the initramfs
and the booted system, as well as sysupdate transfer definitions for
finding and upgrading images. Build-time repart and sysupdate config
lives in the mkosi config repo[1].

The pmOS initramfs is not used. Rather than re-implement partition
setup, verity, factory reset, and switch_root in shell script and
risk regressions for mutable pmOS installs, an initramfs is built by
mkosi containing systemd. This lets the standard systemd initrd
machinery handle everything, with no modifications to the pmOS
initramfs required.

On Android devices, subpartition logic from the pmOS initramfs is
essentially copied into a new systemd unit that runs in the initramfs
and sets up subpartitions so that they are available to tooling that
runs later in the boot process. In the future, this functionality should
be moved upstream into systemd.

Boot flows:

"Normal boot": the verified /usr partition is mounted and the LUKS
root partition is unlocked (empty passphrase by default, with fallback
to a graphical unlock prompt for user-set passphrases). switch_root
hands off to the real rootfs.

"First boot": systemd-repart creates the root partition, always as a
LUKS volume with an empty passphrase. After switch_root, a first-boot
app runs before the display manager to collect a username and password,
create the user account, and optionally set a LUKS passphrase. The
passphrase can also be changed later via systemd-cryptenroll or
cryptsetup.

"Factory reset": detected in the initramfs by systemd, which uses
systemd-repart to wipe and recreate the root partition. Boot then
continues with the first boot flow above. Factory reset can be triggered
while booting in the rootfs by starting a systemd unit that configures
an EFI variable to signal to the initramfs on next boot.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7059>
2026-04-03 19:23:17 +00:00

3 lines
104 B
Text

[Unit]
# make sure factory reset (which includes running repart) is done
After=factory-reset-now.target