Skip to content

omamobile-omarchy 0.1.14: keep the next boot's kernel modules, and prune old ones - #162

Merged
derekross merged 2 commits into
mainfrom
omarchy-modules-cleanup
Oct 31, 2026
Merged

derekross merged 2 commits into
mainfrom
omarchy-modules-cleanup

Conversation

@derekross

@derekross derekross commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Omarchy's kernel-modules-hook runs linux-modules-cleanup.service at every boot. It moves each /usr/lib/modules/<release> that isn't the running kernel and that no package owns into /usr/lib/modules/.old. A phone's kernels never come from pacman: bin/omamobile modules-push unpacks the next boot's tree. So on every phone:

#152 holds the unit off for the 9a only; this does it once, in the package every phone has (review lesson L-233).

What changes (omamobile-omarchy 0.1.14):

  • A drop-in holds Arch's unit off while this package is installed (ConditionPathExists=!/usr/share/omamobile/omarchy/version).

  • omamobile-modules-cleanup.timer runs /usr/lib/omamobile-omarchy/modules-cleanup 10 minutes after boot, at idle priority, sandboxed (only /usr/lib/modules writable), with a 5-minute timeout. It keeps:

    1. the running release;
    2. any tree that arrived during this boot (marker, mtime or ctime after btime): the next boot's kernel;
    3. any tree pacman owns;
    4. the 2 newest of the rest (rollback),

    and deletes the others. Only direct [0-9]* children are candidates; symlinks, .old and a push's in-progress .<release>.new are never touched; if pacman can't read its database nothing is removed. A deleted tree is recoverable: bin/omamobile push re-sends a tree whose marker is missing. --dry-run / OMAMOBILE_MODULES_CLEANUP_DRY_RUN=1 log without deleting.

  • Existing .old contents are left alone (RELEASES §5.4 says they can be deleted by hand).

Tests: new test/modules-cleanup.sh in test/all (scratch root, stub uname/pacman, fake /proc/stat): every keep rule, removal of older trees, dot-dirs and symlinks untouched, both dry runs, a broken pacman database, an empty root; staging checks and systemd-analyze verify on the units. Three mutations each made it fail. tools/pr-check passes.

Not yet run on a phone. After the upgrade, the drop-in and the timer take effect from the next boot. Once this merges, #152's tegu-only drop-in is redundant.

🤖 Generated with Claude Code

@derekross

Copy link
Copy Markdown
Owner Author

An independent review of this found one real bug and two wrong claims, now fixed in the latest commit:

  • The boot after a push wasn't protected by name. In the incident this fixes, the tree was pushed in one boot and lost in the next, so "arrived during this boot" doesn't cover it; only the two-newest rank did, and a marker written while the clock read 1970 ranked it oldest and deleted it (reproduced in a scratch root). bin/omamobile modules-push now names the release it pushed in /usr/lib/modules/.omamobile-next, and the cleanup always keeps that release. It also keeps any tree stamped before 2026, since only a reset clock writes those and its age is unknown. Two tests cover both; a mutation removing either rule fails them.
  • The incident is the Pixel 7's (2026-10-27, in device/panther: the touchscreen (FT3658 kernel option, T6) and the touch notes #149's panther NOTES), not cheetah's NOTES; the script, the drop-in and RELEASES now say so.
  • .old doesn't pile up: kernel-modules-hook's own tmpfiles rule empties it, so that claim is gone from the drop-in, RELEASES and this description.

Still to do before merge: #134 (0.1.13) lands first, then one run on the 7 Pro (--dry-run, then the timer's journal after a boot).

derekross added a commit that referenced this pull request Oct 30, 2026
…is enrolled

Omarchy 4.0.6's lock and omarchy-apply-lock decide fingerprint is set up
with `fprintd-list "$USER" | grep -qi finger`, which also matches
"User ... has no fingers enrolled ...". omamobile-fingerprint installs
/etc/pam.d/omarchy-lock-fingerprint and pulls in fprintd, so on a phone
with nothing enrolled only that grep decides, and it says yes. The lock
then starts a pam_fprintd attempt that fails at once (PAM_AUTHINFO_UNAVAIL,
code 9) and retries 250 ms later for as long as it is up: 130,164 failed
attempts in one night on a Pixel 7 Pro, about 3.4 a second, each reaching
fprintd and polkit, and 55-62 mA (roughly 12 % of the phone's draw) in an
A/B run against the PAM file moved aside (#170).

Upstream fixed this in 879d6583d ("Fix fingerprint enrollment and
lock-screen recovery", omacom/omarchy#7158), which is only in the 4.5
pre-releases. Patch 0022 backports its probe half:

- the lock's probe becomes `LC_ALL=C fprintd-list "$USER" 2>&1`, read by
  FingerprintModel.classifyProbe(): yes only for an enrolled-print row
  (" - #0: ..."), no for "has no fingers enrolled" (or no PAM file),
  unknown otherwise; an unknown answer never turns fingerprint off and is
  asked again after 1 s, doubling to 40 s, while the lock is up;
- omarchy-apply-lock matches the same row, removes the fingerprint PAM
  file only on a definite no, and keeps it when the probe fails.

The rest of 879d6583d (the attempt backoff and "reader unavailable"
notice, the fprintd resume hook, the enrollment changes) is left out, so
a phone with a finger enrolled behaves as before: a mismatch still
retries at 250 ms. omamobile-fingerprint keeps owning the PAM file
(TOUCH-PLAN 0.1); with the probe fixed, the file's presence no longer
counts as setup on its own.

test/patches.py runs the patched lock's own probe command against a fake
fprintd-list with the issue's "has no fingers enrolled" text, an enrolled
print and a failed call, and puts the output through classifyProbe; it
runs the patched omarchy-apply-lock the same way. The series applies with
--fuzz=0 to the real aarch64 omarchy 4.0.6-1.

0.1.13 and 0.1.14 are taken by open #134 and #162 (and patch 0021 by

Fixes #170

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derekross added a commit that referenced this pull request Oct 30, 2026
…is enrolled (#171)

Omarchy 4.0.6's lock and omarchy-apply-lock decide fingerprint is set up
with `fprintd-list "$USER" | grep -qi finger`, which also matches
"User ... has no fingers enrolled ...". omamobile-fingerprint installs
/etc/pam.d/omarchy-lock-fingerprint and pulls in fprintd, so on a phone
with nothing enrolled only that grep decides, and it says yes. The lock
then starts a pam_fprintd attempt that fails at once (PAM_AUTHINFO_UNAVAIL,
code 9) and retries 250 ms later for as long as it is up: 130,164 failed
attempts in one night on a Pixel 7 Pro, about 3.4 a second, each reaching
fprintd and polkit, and 55-62 mA (roughly 12 % of the phone's draw) in an
A/B run against the PAM file moved aside (#170).

Upstream fixed this in 879d6583d ("Fix fingerprint enrollment and
lock-screen recovery", omacom/omarchy#7158), which is only in the 4.5
pre-releases. Patch 0022 backports its probe half:

- the lock's probe becomes `LC_ALL=C fprintd-list "$USER" 2>&1`, read by
  FingerprintModel.classifyProbe(): yes only for an enrolled-print row
  (" - #0: ..."), no for "has no fingers enrolled" (or no PAM file),
  unknown otherwise; an unknown answer never turns fingerprint off and is
  asked again after 1 s, doubling to 40 s, while the lock is up;
- omarchy-apply-lock matches the same row, removes the fingerprint PAM
  file only on a definite no, and keeps it when the probe fails.

The rest of 879d6583d (the attempt backoff and "reader unavailable"
notice, the fprintd resume hook, the enrollment changes) is left out, so
a phone with a finger enrolled behaves as before: a mismatch still
retries at 250 ms. omamobile-fingerprint keeps owning the PAM file
(TOUCH-PLAN 0.1); with the probe fixed, the file's presence no longer
counts as setup on its own.

test/patches.py runs the patched lock's own probe command against a fake
fprintd-list with the issue's "has no fingers enrolled" text, an enrolled
print and a failed call, and puts the output through classifyProbe; it
runs the patched omarchy-apply-lock the same way. The series applies with
--fuzz=0 to the real aarch64 omarchy 4.0.6-1.

0.1.13 and 0.1.14 are taken by open #134 and #162 (and patch 0021 by

Fixes #170

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
derekross and others added 2 commits October 30, 2026 23:25
…une old ones

Omarchy's base packages include kernel-modules-hook, and its installer
enables linux-modules-cleanup.service, which at every boot moves each
/usr/lib/modules/<release> that isn't the running kernel and that no
package owns into /usr/lib/modules/.old. A phone's kernels never come
from pacman: bin/omamobile modules-push unpacks the next boot's tree
ahead of the reboot. So any boot between a push and the reboot into the
new kernel took that tree away, and the new kernel came up with no
drivers (cheetah NOTES, 2026-10-27). Every replaced tree (about 94 MB)
also piled up in .old for good.

fix belongs here (review lesson L-233). omamobile-omarchy is on every
phone:

- a drop-in holds linux-modules-cleanup off while this package's version
  file exists;
- omamobile-modules-cleanup.timer (enabled by a staged timers.target.wants
  link) runs lib/modules-cleanup ten minutes after boot, at idle priority
  with a timeout, so nothing on the boot path waits for it. It keeps the
  running release, every tree that arrived during this boot (marker or
  tree mtime, or the tree's ctime, after /proc/stat's btime: the next
  boot's kernel, even mid-push), every pacman-owned tree and the two
  newest others by marker mtime (rollback), and rm -rf's the rest. Only
  direct [0-9]* children are candidates; symlinks, .old and dot-dirs
  (a push's .<release>.new) are never touched, and nothing is removed
  when pacman can't read its database. --dry-run (or
  OMAMOBILE_MODULES_CLEANUP_DRY_RUN=1) shows what it would do. A removed
  tree is recoverable: push re-sends a tree whose marker is missing.

test/modules-cleanup.sh runs it against a scratch module root with stub
uname and pacman; test/all also checks the staged drop-in, units, script
and wants link, and runs systemd-analyze verify on the units.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ees stamped by a reset clock

Review found that the boot after a push, the case the cleanup exists for,
protected the pushed tree only by its rank, and a marker written while the
phone's clock read 1970 ranked it oldest and removed it. modules-push now
names the release it pushed in /usr/lib/modules/.omamobile-next, and the
cleanup keeps that release and any tree stamped before 2026.

Also corrects two claims: the incident was on the Pixel 7, not in
cheetah's NOTES, and .old doesn't pile up, because kernel-modules-hook's
own tmpfiles rule empties it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross
derekross force-pushed the omarchy-modules-cleanup branch from 157488b to 11c3ff5 Compare October 31, 2026 15:10
@derekross
derekross merged commit 67d24d2 into main Oct 31, 2026
2 checks passed
@derekross
derekross deleted the omarchy-modules-cleanup branch October 31, 2026 15:17
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…is enrolled (derekross#171)

Omarchy 4.0.6's lock and omarchy-apply-lock decide fingerprint is set up
with `fprintd-list "$USER" | grep -qi finger`, which also matches
"User ... has no fingers enrolled ...". omamobile-fingerprint installs
/etc/pam.d/omarchy-lock-fingerprint and pulls in fprintd, so on a phone
with nothing enrolled only that grep decides, and it says yes. The lock
then starts a pam_fprintd attempt that fails at once (PAM_AUTHINFO_UNAVAIL,
code 9) and retries 250 ms later for as long as it is up: 130,164 failed
attempts in one night on a Pixel 7 Pro, about 3.4 a second, each reaching
fprintd and polkit, and 55-62 mA (roughly 12 % of the phone's draw) in an
A/B run against the PAM file moved aside (derekross#170).

Upstream fixed this in 879d6583d ("Fix fingerprint enrollment and
lock-screen recovery", omacom/omarchy#7158), which is only in the 4.5
pre-releases. Patch 0022 backports its probe half:

- the lock's probe becomes `LC_ALL=C fprintd-list "$USER" 2>&1`, read by
  FingerprintModel.classifyProbe(): yes only for an enrolled-print row
  (" - #0: ..."), no for "has no fingers enrolled" (or no PAM file),
  unknown otherwise; an unknown answer never turns fingerprint off and is
  asked again after 1 s, doubling to 40 s, while the lock is up;
- omarchy-apply-lock matches the same row, removes the fingerprint PAM
  file only on a definite no, and keeps it when the probe fails.

The rest of 879d6583d (the attempt backoff and "reader unavailable"
notice, the fprintd resume hook, the enrollment changes) is left out, so
a phone with a finger enrolled behaves as before: a mismatch still
retries at 250 ms. omamobile-fingerprint keeps owning the PAM file
(TOUCH-PLAN 0.1); with the probe fixed, the file's presence no longer
counts as setup on its own.

test/patches.py runs the patched lock's own probe command against a fake
fprintd-list with the issue's "has no fingers enrolled" text, an enrolled
print and a failed call, and puts the output through classifyProbe; it
runs the patched omarchy-apply-lock the same way. The series applies with
--fuzz=0 to the real aarch64 omarchy 4.0.6-1.

0.1.13 and 0.1.14 are taken by open derekross#134 and derekross#162 (and patch 0021 by

Fixes derekross#170

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…une old ones (derekross#162)

Arch's linux-modules-cleanup pruned every module tree but the running kernel's at boot, so a kernel pushed to slot B lost its modules before it ever booted. omamobile-omarchy now keeps the tree of the kernel slot B will boot next as well as the running one, and prunes the rest. Dry run on the Pixel 7 Pro (2026-10-30) kept the running kernel's tree and listed only old ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant