Skip to content

Stop installing the obsolete SPI keyboard DKMS package - #9880

Open
hudsonwa wants to merge 8 commits into
omacom:quattrofrom
hudsonwa:fix/9831-spi-keyboard-dkms
Open

hudsonwa wants to merge 8 commits into
omacom:quattrofrom
hudsonwa:fix/9831-spi-keyboard-dkms

Conversation

@hudsonwa

@hudsonwa hudsonwa commented Sep 2, 2026

Copy link
Copy Markdown

Fixes #9831

What broke

install/hardware/apple/fix-spi-keyboard.sh installs macbook12-spi-driver-dkms on every MacBook it matches. That package is obsolete: applespi is mainlined (it ships in the linux package), and the out-of-tree copy includes asm/unaligned.h, which was removed in kernel 6.12. The DKMS build therefore fails on every kernel update once linux-headers is present (reproduced in the issue with the full build log). The failure is currently invisible on stock installs only because Arch's DKMS hook finds no usr/lib/modules/*/build without headers; issue #8285 proposes installing linux-headers, which would surface this failed build on every matched MacBook.

The keyboard itself is unaffected: the script also writes /etc/mkinitcpio.conf.d/macbook_spi_modules.conf, which loads the in-tree applespi module into the initramfs. That half is load-bearing (LUKS passphrase entry), and the issue verifies removing only the package leaves the keyboard and touchpad working.

Fix

Drop the omarchy-pkg-add macbook12-spi-driver-dkms line and keep everything else, with a comment recording why the package no longer belongs. The initramfs drop-in is unchanged, so initramfs behavior is identical.

Why install/hardware

This is an install-time hardware leaf run via run_logged from install/hardware/all.sh. The package install belongs there (or nowhere), and the drop-in must stay there, so the fix is confined to the one file.

Tests

New test/shell.d/spi-keyboard-test.sh runs a sandboxed copy of the leaf (DMI path and mkinitcpio dir rewritten, stubbed omarchy-pkg-add/sudo):

  • Matched MacBook (MacBookPro14,1): the DKMS package is NOT requested, and the initramfs drop-in is still written with the SPI modules.
  • Unmatched machine (MacBookPro15,2): nothing happens at all.

All pass here; the test fails against the pre-fix leaf (RED to GREEN). Honest host note: this machine cannot run a real pre-T2 MacBook, so the model regex is covered by the sandbox rather than hardware; the match set itself is unchanged.

Not included

A migration that removes the package from already-installed machines was left out deliberately (machine-wide package removal is the maintainers' call; the script fix prevents new installs). Happy to add one if wanted. This also removes the regression #8285 would have surfaced.

hudsonwa and others added 2 commits September 3, 2026 03:30
applespi is mainlined, so macbook12-spi-driver-dkms cannot build on modern
kernels (its include was removed in 6.12) and its build fails on every
kernel update once linux-headers is present. The in-tree module is what the
initramfs drop-in loads, so only that needs to stay.
install/omarchy-other.packages exists so the ISO holds the packages install
scripts reach for. Nothing reaches for this one now, so the entry only pins an
AUR package that cannot build, the way the T2 change dropped tiny-dfr.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5 in Claude Code, with an independent second opinion from Codex at xhigh reasoning. Tests ran on a disposable Omarchy 4.0.0 worker VM (kernel 7.1.9-arch1-2), never on the machine holding credentials.

The question that decides this one is what a matched MacBook uses for its keyboard and trackpad once the package is gone, and the in-tree path is there. On the worker:

$ modinfo applespi
filename:    /lib/modules/7.1.9-arch1-2/kernel/drivers/input/keyboard/applespi.ko.zst
description: MacBook(Pro) SPI Keyboard/Touchpad driver
alias:       acpi*:APP000D:*
$ pacman -Qo "$(modinfo -n applespi)"
... is owned by linux 7.1.9.arch1-2

One module for both the keyboard and the touchpad, shipped by the linux package, bound by the ACPI id rather than a model whitelist, so every model your regex matches is covered — and mainline has carried it since well before any kernel Omarchy has shipped. The initramfs drop-in you kept is what puts it in the initramfs for the LUKS prompt. No machine here is left without a keyboard.

The package also carried apple-ibridge/apple-ib-tb for the Touch Bar on MacBookPro13,2-3 and 14,2-3, which was never mainlined. Nothing is lost in practice: the build fails as a unit on 6.12 and later, so those modules are unavailable on any current kernel either way, and manual/44-mac-support.md already documents the T1 Touch Bar as non-functional.

Pushed one commit, 9605c7a. install/omarchy-other.packages still listed macbook12-spi-driver-dkms, and per docs/file-layout.md the ISO builder reads that list for its offline mirror — so the ISO kept caching a package nothing installs. The T2 change did exactly this for tiny-dfr and test/shell.d/t2-hardware-test.sh:21 pins it; your test now carries the matching assertion.

Still open, and a decision for the maintainer rather than mine to push: removing the install line does not uninstall anything. Every MacBook that already ran the old installer keeps the package and keeps hitting the failed build the moment linux-headers arrives — which is the machine in #9831, and the regression #8285 would surface. migrations/1785944594.sh:36-39 is the precedent for that half: an idempotent omarchy-pkg-present / omarchy-pkg-drop pair. As it stands this closes #9831 for new installs only.

Tests on the worker: ./test/cli passes, and test/shell.d/spi-keyboard-test.sh and test/shell.d/t2-hardware-test.sh pass. Your test is load-bearing — putting omarchy-pkg-add macbook12-spi-driver-dkms back makes it fail, and so does putting the package back in omarchy-other.packages.

Codex agreed with both points above, which I had already reached, so its independence is not currently guaranteed; it contributed the docs/file-layout.md pointer for what actually consumes the package list. It put applespi's mainlining at 4.11 and I have it at 5.3 — I verified neither against the kernel tree, and it changes nothing, since what matters is that the module ships in the kernel Omarchy runs today.

fix-spi-keyboard.sh no longer installs it and the ISO no longer caches it,
but every MacBook that ran the old installer still carries a package whose
build fails on every kernel update once linux-headers is present. The
migration removes it idempotently, as the tiny-dfr migration does.
@hudsonwa

hudsonwa commented Sep 3, 2026

Copy link
Copy Markdown
Author

Thanks for the review and the ISO fix; caching a package nothing installs was the right catch. I completed the migration half: migrations/1788476400.sh drops macbook12-spi-driver-dkms idempotently when present, following the tiny-dfr precedent, so machines that ran the old installer stop hitting the failed build the moment linux-headers arrives. spi-keyboard-test.sh now covers the drop and its idempotence; the ISO assertion you added is in place.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at 2d49be5e by Claude Opus 5 in Claude Code, with an independent second opinion from Codex (gpt-5.6-sol) at xhigh reasoning. Everything executable ran on a fresh disposable Omarchy 4.0.0 worker VM, destroyed afterwards. Only the new commit is covered here; the earlier pass stands, and the ISO assertion is untouched.

The migration is correct and I pushed nothing. It is the half I left open last time, and the three things that could have made it dangerous all check out.

No machine loses its keyboard at the LUKS prompt. There has never been a released revision that installed the package without also writing the drop-in: e018692e (#1313) introduced both in the same conditional, at the same /etc/mkinitcpio.conf.d/macbook_spi_modules.conf path it still uses, and every revision since kept them together. Removal is not silent about the initramfs either — 90-mkinitcpio-install.hook triggers on Operation = Remove of usr/src/*/dkms.conf, which I read off the worker's own hook file, so the image is rebuilt inside the same pacman transaction and picks up the in-tree applespi the unchanged drop-in names.

The migration actually reaches the machines in #9831. bin/omarchy-update:47-48 runs omarchy-update-system-pkgs before omarchy-migrate and both scripts run set -e, so a failed upgrade would take the migration with it — which would be the wrong outcome here, since the machines that need this are precisely the ones whose update hits the failed build. It does not happen: main() in Arch's /usr/share/libalpm/scripts/dkms collects failures into ERROR_MESSAGES, prints them, and ends with return 0. I read that on the worker rather than taking the warning text in the issue for it. The build failure is a warning, pacman's transaction succeeds, and the migration runs in the same omarchy update.

-Rns takes nothing a MacBook needs. On a stock 4.0.0 worker neither dkms nor linux-headers is installed — install/omarchy-other.packages is the ISO mirror manifest rather than an install list — so on an affected MacBook both arrived as dependencies of this package and pacman -Rns may take them back out. Nothing else on such a machine wants them, and the next correctly packaged DKMS driver pulls them in again.

Two notes, neither worth a commit:

  • AGENTS.md says of omarchy-pkg-present: "don't use these if you can just use omarchy-pkg-add/omarchy-pkg-drop". omarchy-pkg-drop:11-23 already filters to installed packages and no-ops otherwise, so if omarchy-pkg-present …; then is redundant here. The tiny-dfr precedent needs its guard because it runs systemctl disable --now first; this branch has nothing else in it.
  • docs/testing.md and bin/omarchy-migrate:93 both run a migration as bash -euo pipefail; spi-keyboard-test.sh:85 and :91 use plain bash. Nothing is hidden today — the migration has no pipeline and no unset variable, and a failing drop is still the script's non-zero result — but the strict form is what the runner does.

Tests, all on the worker: ./test/cli green, spi-keyboard-test.sh and t2-hardware-test.sh green. The migration itself ran twice under bash -euo pipefail against a fake HOME on a machine that does not have the package, exit 0 both times — the real no-op path. Your new block is load-bearing: replacing the migration body with a bare echo makes the file fail at not ok - the migration drops the obsolete DKMS package.

Codex reviewed the same head at xhigh and found no defect, agreeing with conclusions I had already reached, so its independence is not currently guaranteed here — read-only sandboxing restricts writes and not reads. It contributed the mkinitcpio hook mechanism, which I had reasoned about wrongly and then checked on the worker. One claim of its I rejected: that dkms is installed independently by Omarchy via install/omarchy-other.packages:10. That file is the ISO manifest, and pacman -Qi dkms on a stock 4.0.0 worker reports it is not installed at all.

Two other open PRs edit install/hardware/apple/fix-spi-keyboard.sh, and one of them is a competing answer to this same question rather than a neighbour — that is the maintainer's call, not mine, so both are named here without a preference. #10141 ("Stabilize MacBookPro13,3 hardware support") rewrites the same omarchy-pkg-add line, keeping the install behind a probe for an in-tree applespi.ko instead of dropping it; it adds no uninstall path, so machines that already have the package keep it. #9735 ("Force SPI PIO on MacBook8,1") adds a block inside the MacBook8,1 branch a few lines below and does not touch the package line, so it is a rebase rather than a conflict of substance; its migration 1788318101 sorts before yours, so ordering is fine either way.

Also related: #10154 does not interact with this. It is install/hardware/intel/ptl-kernel.sh on Dell XPS Panther Lake, and its bug is raw pacman -Rdd aborting on an uninstalled target — the failure mode omarchy-pkg-drop avoids by filtering to installed packages first.

Nothing pushed. Waiting on the maintainer, for how this sequences against #10141.

omarchybot and others added 2 commits October 2, 2026 02:56
quattro replaced linux, linux-headers and linux-ptl with linux-omarchy and its headers in the ISO package list, beside the line this branch removes. The resolution keeps quattro's kernels and still drops macbook12-spi-driver-dkms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quattro's default kernel is now linux-omarchy, which carries applespi as a module (CONFIG_KEYBOARD_APPLESPI=m), so naming the linux package was no longer true of most machines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed against today's quattro by Claude Opus 5.5 in Claude Code, with a second opinion from Codex at medium effort. Everything executable ran on a disposable Omarchy worker VM (kernel linux-omarchy 7.2.5), destroyed afterwards. The branch had stopped merging, so I pushed two commits to it.

quattro turns this from latent to live. Since the last review, quattro made linux-omarchy the default kernel and made matching headers a base guarantee (migrations/1789444024.sh). So the build failure from #9831 now hits every matched MacBook on every kernel update. On the worker, installing macbook12-spi-driver-dkms against linux-omarchy-headers 7.2.5 fails with dkms exit 10 in apple-ibridge.c and apple-ib-tb.c. applespi itself ships in linux-omarchy (CONFIG_KEYBOARD_APPLESPI=m, applespi.ko.zst owned by linux-omarchy), so the drop-in you kept still has a module to load.

Your migration does what it says on a real system. On that same worker, with the broken package installed, bash -euo pipefail migrations/1788476400.sh removed it and the now-orphaned dkms, rebuilt the UKI, and left linux-omarchy-headers in place, since it is installed explicitly. A second run exited 0 and did nothing.

Pushed:

  • f534e21 merges quattro. The only conflict was install/omarchy-other.packages, where quattro swapped linux/linux-headers/linux-ptl for linux-omarchy and its headers next to the line this branch removes. The resolution keeps quattro's kernels and still drops the package.
  • 724ab2d changes "ships in the linux package" to "ships in the kernel package" in the leaf and the migration comments, since most machines no longer run linux.

Tests on the worker at 724ab2d: spi-keyboard-test.sh (5/5) and t2-hardware-test.sh (6/6) pass. Your test fails against plain quattro at the DKMS assertion. ./test/cli has one failure (vscode generated theme references current theme file), and kernel-headers-migration-test.sh and omarchy-kernel-migration-test.sh fail too. All three fail the same way on unmodified quattro on the same worker, so they are not this branch's doing, but they mean the suite is not green.

Codex found no defect at this head. Asked separately which of this PR and #10141 better fixes the obsolete package, it chose this one, as I had. #10141 still installs the package whenever its find for an in-tree applespi.ko misses, keeps it in the ISO list, and has no removal migration. Its agreement does not count as independent, because it can read this session. It also raised again that spi-keyboard-test.sh runs the migration with plain bash rather than bash -euo pipefail. The earlier review covered that, and running the migration under the strict form on the worker above settles it. #9735 still edits only the MacBook8,1 branch of the same file and does not conflict with this in substance.

Waiting on the maintainer: whether to take this or #10141's handling of the package line. #10141 would need its in_tree_applespi probe dropped if this lands first.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the remaining test coverage concern is non-blocking.

Findings

  1. P2 MacBook8,1 path lacks coverage ▶

Summary

Stops installing the obsolete MacBook SPI DKMS package while keeping the existing initramfs setup.

  • Matched MacBooks keep their in-tree SPI modules without the obsolete DKMS package.

Reviews (4) · Last reviewed commit: "Drop the redundant presence check from t..." · Reviewed by Greptile

Comment thread test/shell.d/spi-keyboard-test.sh Outdated
# obsolete — applespi is in-tree and the out-of-tree copy cannot build on
# modern kernels — so it must not be installed anymore.
run_leaf "MacBookPro14,1"
[[ -s $tmp_dir/pkg-add.log ]] &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 MacBook8,1 path lacks coverage

This test checks only MacBookPro14,1, but MacBook8,1 uses a different required module list. Add a matched MacBook8,1 case that checks its initramfs drop-in and confirms the DKMS package is not requested. Without it, a regression in that LUKS-keyboard path could go unnoticed.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 10, 2026
quattro added its own test/shell.d/spi-keyboard-test.sh in omacom#14431, covering a missing or unreadable DMI product name under errexit and pinning that a matched Intel Mac installs macbook12-spi-driver-dkms. The resolution keeps this branch's test, runs the leaf under bash -eE as quattro's does, and carries the missing/unreadable DMI cases over. The pin is dropped, since not installing the package is what this branch changes and its own assertion says the opposite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 11, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed by Claude Opus 5.5 in Claude Code, with a second opinion from Codex at medium effort. Everything executable ran on a disposable Omarchy worker VM (kernel linux-omarchy 7.2.5-3), destroyed afterwards. The branch had stopped merging again, so I pushed one commit to it.

Pushed 2543e96, a merge of quattro. The only conflict was test/shell.d/spi-keyboard-test.sh: #14431 added a test of the same name on quattro, covering a missing or unreadable DMI product name under errexit, and pinning that a matched Intel Mac installs macbook12-spi-driver-dkms. The resolution keeps your test, runs the leaf with bash -eE as quattro's did, and carries over the missing and unreadable DMI cases. Those cases now also check that nothing gets installed or written. I dropped the pin because it asserts the opposite of this PR, and #14431's message shows it was preserving existing behaviour while guarding the DMI read, not deciding to keep the package. Your leaf, package list and migration came through the merge unchanged.

Still a live bug at this head. On the worker, pacman -S macbook12-spi-driver-dkms against linux-omarchy-headers 7.2.5 fails the DKMS build with exit 10 (incompatible pointer types in apple-ib-tb.c, apple-ibridge.c and apple-ib-als.c). applespi.ko.zst ships in linux-omarchy. On that broken install, bash -euo pipefail migrations/1788476400.sh removed the package and the orphaned dkms, kept linux-omarchy-headers, and a second run was a no-op.

Tests on the worker at 2543e96. spi-keyboard-test.sh passes 6/6. It fails on plain quattro with your test applied, and it fails again with the leaf, package list and migration reverted to quattro's. The new DMI block is load-bearing: taking || true off the DMI read makes it fail. ./test/cli is green, and so are the other hardware tests touching this area (t2-hardware, brcmfmac-supplicant, image-deferred-hardware, mkinitcpio-apple-drop-ins, apple-silicon-quirks, xps13-sidecar-amps, yt6801-driver). The full shell suite is not green. It has 9 failures at this head, against 10 on unmodified quattro on the same worker, one of which is this PR's test. None of the 9 is in a file this branch touches. They include unowned-system-paths-test.sh, which flags quattro's own polkit policies, and the two seen only at this head pass on a rerun or fail identically on quattro. They hold this back from ready but are not this branch's to fix.

Codex reviewed the merge and the full diff at this head and found no defect. It agreed with conclusions I had already reached, so its independence is not guaranteed. It did check two things for itself: that the DMI block fails without the guard, and that bin/omarchy-migrate checks a per-file marker rather than a timestamp watermark. So 1788476400.sh still runs on machines that already ran the 47 quattro migrations sorting after it, and it depends on none of them.

#10141 is still open and still handles the same package line differently: it keeps the install behind an in-tree applespi.ko probe and has no removal migration. This one is older and still covers more. #9735 touches only the MacBook8,1 branch of the same leaf.

Waiting on the maintainer: the choice between this and #10141, and a green suite on quattro.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 31, 2026
quattro folded the per-quirk hardware tests into the table-driven hardware-quirks-test.sh and dropped migration tests, so the standalone spi-keyboard-test.sh goes and the SPI keyboard rows in the table now expect the drop-in without the DKMS package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 1, 2026
omarchy-pkg-drop already ignores packages that are not installed, and AGENTS.md asks for the drop helper alone where it suffices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review and removed verified Omarchy Triage has verified that this issue is ready for final review labels Nov 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed by Claude Opus 5.5 in Claude Code, with a second opinion from Codex at medium effort and muse-wonder (via pi, thinking high). Everything executable ran on a disposable Omarchy worker VM with linux-omarchy 7.2.14, destroyed afterwards. The branch had stopped merging again, so I pushed two commits to it.

Pushed 9e32b78, a merge of quattro. quattro (#16337) folded the per-quirk hardware tests into the table-driven test/shell.d/hardware-quirks-test.sh and dropped migration tests altogether, so spi-keyboard-test.sh is gone and the two SPI keyboard rows in that table now expect the drop-in to be written with no pkg-add macbook12-spi-driver-dkms. The rows compare every call the leaf makes, so restoring quattro's leaf fails them.

Pushed 2b324b8, which drops the omarchy-pkg-present guard from migrations/1788476400.sh. omarchy-pkg-drop already ignores a package that is not installed, and AGENTS.md asks for the drop helper alone where it suffices. It also stops a failed package query from reading as "not installed" and marking the migration done.

Still a live bug at this head. On the worker, installing macbook12-spi-driver-dkms fails its DKMS build on 7.2.14 (incompatible pointer types in apple-ibridge.c, apple-ib-tb.c and apple-ib-als.c). applespi, spi-pxa2xx-platform, spi-pxa2xx-pci and intel-lpss-pci all ship in linux-omarchy, so the drop-in still has what it loads. The migration removed the installed package and was a no-op on a second run.

Tests on the worker at 2b324b8. hardware-quirks-test.sh passes, and fails with the leaf reverted to quattro's. ./test/cli is green. ./test/shell has 6 failing files (agent-account-exec, ascii, branding-about-animation, first-run, remote-session-service, runtime-smoke), none touched by this branch. Each fails the same way on unmodified quattro (d367a56) on the same worker.

Second opinion. Both reviewers found the delta correct and nothing else defective at this head. Codex raised one concern, which I dismissed: the package also carries the T1 Touch Bar and ambient-light drivers for MacBookPro13,2/13,3 and 14,2/14,3, and the migration removes them. Those drivers are the files whose build fails above, so no working module is being taken away, and manual/44-mac-support.md already lists the T1 Touch Bar as non-functional. Where they agreed with conclusions I had written down, their independence is not guaranteed.

Related. #10141 still handles the same install line differently, keeping the package behind an in-tree applespi probe. Its Touch Bar support uses apple-ib-drv-dkms, which conflicts with macbook12-spi-driver-dkms, so this removal does not get in its way. This PR is older and narrower on that line. #9735 touches only the MacBook8,1 branch of the same leaf.

Waiting on the author: @hudsonwa, the description no longer matches the diff. It says the removal migration was left out, but the branch now ships migrations/1788476400.sh. It also describes a new spi-keyboard-test.sh, which quattro's test consolidation has replaced with the two rows in hardware-quirks-test.sh. Could you update it so the maintainer reads what this PR now does? After that, the maintainer decides whether removing the package from installed machines is wanted, and chooses between this and #10141.

@geeknees

Copy link
Copy Markdown

Hardware datapoint from a MacBook8,1 (Early 2015) running Omarchy edge on kernel 7.2.15-2-omarchy:

  • The in-tree applespi driver is present at /lib/modules/7.2.15-2-omarchy/kernel/drivers/input/keyboard/applespi.ko.zst.
  • With the initcall_blacklist=dw_pci_driver_init SPI PIO workaround, keyboard and touchpad work in the LUKS unlock prompt and after deep S3 resume (the latter uses a separate opt-in LPSS recovery hook).
  • The tested installation no longer needs the old macbook12-spi-driver-dkms for keyboard input; the DKMS entries present are facetimehd, macbook12-audio, and v4l2loopback.
  • Kernel/DKMS updates were exercised and the major devices continued to work.

This is a real-device validation of the in-tree SPI driver route, not a test of this PR branch itself. My integration PoC is here: https://github.com/geeknees/omarchy/tree/macbook81/poc-2026-11

I support removing the obsolete SPI DKMS dependency while retaining the early in-tree modules for LUKS input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix-spi-keyboard.sh installs macbook12-spi-driver-dkms, which cannot build on kernels shipping applespi in-tree

3 participants