github doug445/AsahiLocker v3.1.0
AsahiLocker 3.1.0

one hour ago

Three fixes to the RAM rescue route, all from one user's run on a 14" MacBook Pro (M2 Max), and one new optional extra. Nothing changes in how a volume is encrypted, in the KDF, or in any volume an earlier release made. If you are already encrypted, there is nothing to redo.

Encrypted from the RAM rescue with 2.1.0 to 3.0.0? Run sudo ./bin/post-encryption-setup.sh from this release once. It gives the files that deploy wrote their SELinux labels (see #9 below).

ram-rescue.sh build refused every Apple Silicon Mac (#7)

The build checks that every kernel module between the root partition and the bus is in the image. On a Mac that path includes simple-pm-bus, which is always compiled into the kernel: it has no .ko, and modules.builtin does not list it either, so the check could never pass and the build stopped with missing from image: kernel module simple_pm_bus. The KVM test bed has no such driver in its path, which is how this got out.

The check now recognises a compiled-in driver by what sysfs says about the running kernel (only a loadable module has /sys/module/<name>/initstate). A loadable module that is missing from the image is still refused. This is the fix proposed in the report.

The deploy's SELinux relabel did nothing, and said "SELinux contexts OK" (#9)

luks-deploy.sh relabeled what it wrote with restorecon inside its chroot. restorecon exits 0 without touching anything when it cannot see SELinux, and inside that chroot it never can. The check that followed used restorecon -n -v, which is silent for the same reason, so nothing was reported.

From a live USB with SELinux on, the running kernel had at least labeled each new file. In the RAM rescue no policy is loaded, so every file the deploy wrote had no label at all: /etc/fstab, /etc/crypttab, the rebuilt initramfs images, the BLS entries, the header backup, the state copy in /root. The system boots and unlocks; on the reporter's KDE system the first boot logged 101 unlabeled_t denials before login.

  • The deploy now labels with setfiles and the target's own file_contexts, which does not depend on SELinux in the running kernel, then reads every label back with stat. A file still without one is listed by name.
  • The rescue's own logs in /boot take the label of /boot.
  • post-encryption-setup.sh has a new step that labels the same files on the booted system, for anyone already encrypted this way.

Measured on the test VM (Fedora Asahi Remix 45 Minimal, enforcing): the system encrypted from the rescue by 2.2.1 booted with 54 unlabeled files; encrypted by this release, 0, with no denials, and restorecon -n finds nothing to change in anything the deploy wrote.

No way to keep the boot splash off (#8)

The deploy takes rhgb quiet off so the first passphrase prompt is visible, and post-encryption-setup.sh puts it back. Nothing could say "leave it off", and the README read as if LUKS_KEEP_SPLASH=1 did. That variable belongs to luks-deploy.sh and means the opposite: do not strip the splash.

  • post-encryption-setup.sh --keep-splash-off (or RESTORE_SPLASH=0 in post-encryption.conf) leaves the splash off and removes the marker, so a later run does not restore it after all.
  • post-encryption-setup.sh now stops with a message when LUKS_KEEP_SPLASH is set, instead of ignoring it and restoring the splash.
  • The README's "Boot splash" section says which setting belongs to which script, how to take the splash off after it is back, and how to bring it back.

extras/kbd-backlight/: see the keys while you type the passphrase

On a MacBook running Fedora Asahi Remix, the keyboard backlight was dark at the LUKS passphrase prompt. The backlight is a PWM LED (pwm-apple + leds-pwm), and the stock Asahi initramfs carries neither driver.

sudo ./extras/kbd-backlight/install.sh               # install, rebuild every initramfs, verify
sudo ./extras/kbd-backlight/install.sh --uninstall
./extras/kbd-backlight/install.sh --check
  • A dracut module adds the two drivers and one initramfs-only udev rule that sets kbd_backlight to its maximum as soon as it appears. Nothing in the initramfs dims it, so it stays on for as long as the prompt waits.
  • Every kernel in /boot is rebuilt. Future kernels include the module automatically.
  • The rescue image is rebuilt too, with the dracut arguments recorded inside it, so a host-only rescue stays host-only. It is written to .new and replaces the old image only after a check: the rescue module and the backlight module must both be present, and /boot must have had room.
  • After unlock, systemd-backlight and the desktop control the backlight as usual.
  • It refuses to run on a desktop Mac (no keyboard backlight) or anywhere that is not Apple Silicon.
  • It cannot light a GRUB cryptomount prompt for an encrypted /boot. That prompt runs before Linux loads its drivers. The root volume AsahiLocker encrypts is unlocked in the initramfs, so that prompt is covered.

Tested on a 14" MacBook Pro (M2 Max), Fedora Asahi Remix 45. The keys were lit at the Plymouth prompt, and the host-only rescue image kept its boot settings and crypttab unchanged.

The same tool is published on its own as asahi-luks-kbd-backlight.

Tests

  • The fixes were run end to end on the KVM test bed: ram-rescue.sh build --arm, the RAM rescue, in-place encryption, ALL CHECKS PASSED (12-point gate), the first encrypted boot, post-encryption-setup.sh with and without --keep-splash-off, ram-rescue.sh remove.
  • The image check of #7 was run on an M2 Max with the script's own loop against that Mac's sysfs: 3.0.0 refuses simple_pm_bus, this release passes and still refuses an image without nvme-apple.
  • cli-smoke-test.sh covers the keyboard-backlight installer and the new option (29 checks). shellcheck at warning severity covers the new scripts.

Thanks

To piscisaureus for #7, #8 and #9: the first reported run of ram-rescue.sh on Apple hardware, each report with the cause already found.

Don't miss a new AsahiLocker release

NewReleases is sending notifications on new releases.