Repository navigation
Stop a psmouse quirk from failing every install - #7236
Conversation
install/hardware/fix-synaptic-touchpad.sh calls modprobe against the running kernel. Under 4.0 the only thing that runs it is the ISO finalizer, inside arch-chroot, where uname -r still names the live ISO's kernel while /lib/modules holds the target's. The live ISO always boots linux-t2 and the configurator gives every machine that is not a T2 Mac stock linux, so those two never match: modprobe exits 1 with "Module psmouse not found in directory /lib/modules/<live kernel>". run_logged returns that status and omarchy-apply-hardware runs under set -euo pipefail, so a fresh install stops on the first machine with a device named "synaptics" and no psmouse loaded -- reported from a ThinkPad in #6985, but nothing about it is Lenovo-specific. Skip the load when the running kernel's modules are not reachable, and warn instead of failing when modprobe declines for any other reason. An optional touchpad improvement should never be able to halt an install. This does not make InterTouch reach the installed system: a module loaded into the live kernel is gone at reboot, so on 4.0 this script has never applied anything to an installed machine. Persisting it means writing options psmouse synaptics_intertouch=1 to /etc/modprobe.d, which forces the SMBus transport past the kernel's own allowlist on any touchpad merely named "synaptics" in /proc/bus/input/devices. That is a hardware-behaviour change on a wide class of machines, so it is left for a maintainer to decide separately. Fixes #6985 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds safety and test coverage around enabling Synaptics InterTouch so installs don’t fail when kernel modules for the running kernel aren’t available (e.g., under arch-chroot), while keeping the tweak effective only on the booted machine.
Changes:
- Make
fix-synaptic-touchpad.shconditional on reachable running-kernel modules and makemodprobefailures non-fatal (warn only). - Add a shell test that stubs
modprobe/lsmodand validates behavior across success, missing modules dir, already-loaded module, and failingmodprobe.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/shell.d/synaptic-touchpad-test.sh | Adds a regression test harness for the Synaptics/psmouse quirk behavior. |
| install/hardware/fix-synaptic-touchpad.sh | Prevents install-time failure by gating on module availability and warning instead of failing on modprobe. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| modules_dir="${OMARCHY_SYNAPTIC_MODULES_DIR:-/lib/modules/$(uname -r)}" | ||
| input_devices="${OMARCHY_SYNAPTIC_INPUT_DEVICES:-/proc/bus/input/devices}" | ||
|
|
||
| if grep -qi synaptics /proc/bus/input/devices \ | ||
| if [[ -d $modules_dir ]] \ | ||
| && grep -qi synaptics "$input_devices" \ | ||
| && ! lsmod | grep -q '^psmouse'; then | ||
| modprobe psmouse synaptics_intertouch=1 | ||
| modprobe psmouse synaptics_intertouch=1 || | ||
| echo "Warning: could not enable Synaptics InterTouch on psmouse" >&2 | ||
| fi |
There was a problem hiding this comment.
Right, and that was the real flaw: the override decided whether the load was attempted but could not change where modprobe looked, so the guard and the load consulted different places.
Taken option (a), with the check moved onto modprobe itself. modprobe -qn psmouse resolves the module against the running kernel without loading it, which is the same question [[ -d /lib/modules/$(uname -r) ]] was trying to ask by hand, answered by the thing that will do the loading. The override is gone and the two now agree by construction. The arch-chroot case is still skipped silently, for the same reason as before.
| modules_dir="${OMARCHY_SYNAPTIC_MODULES_DIR:-/lib/modules/$(uname -r)}" | ||
| input_devices="${OMARCHY_SYNAPTIC_INPUT_DEVICES:-/proc/bus/input/devices}" |
There was a problem hiding this comment.
Both are gone. modules_dir went with the check it fed, and input_devices is now inlined at its only use, so the leaf leaves nothing at the top level.
Not wrapping it in a function: sourced leaves under install/ set bare top-level variables throughout (pci_info in fix-bcm43xx.sh, product_name in fix-surface-keyboard.sh, provisioning_dir in input-group.sh), so a function here would read as the odd one out. Having no variables at all is the better answer for a script this short.
| leaf="$ROOT/install/hardware/fix-synaptic-touchpad.sh" | ||
| all="$ROOT/install/hardware/all.sh" | ||
|
|
||
| grep -q 'hardware/fix-synaptic-touchpad.sh' "$all" || |
There was a problem hiding this comment.
Confirmed and tightened to run_logged .*hardware/fix-synaptic-touchpad.sh.
Checked the false positive rather than assuming it: replacing the run_logged line in all.sh with # hardware/fix-synaptic-touchpad.sh used to run here leaves the old assertion passing while the quirk no longer runs at all. The new one fails on that mutation.
…dules The reachability check ran through OMARCHY_SYNAPTIC_MODULES_DIR, an override modprobe itself never saw: it decided whether the load was attempted but could not change where modprobe looked, so the guard and the load consulted different places and the seam read as though it configured module lookup. modprobe -qn answers the same question directly -- it resolves psmouse against the running kernel without loading it -- so the guard and the load now agree by construction and the override goes away. The arch-chroot case that broke installs is still skipped silently, for the same reason it always was: the live kernel's modules are not the ones on disk. Inline the remaining /proc/bus/input/devices override at its only use. These leaves are sourced one after another into a single shell, so a variable left at the top level outlives the script that set it. Pin the wiring assertion to the run_logged call instead of any mention of the path. A commented-out line satisfied the old grep, so the test could pass with the quirk no longer running at all. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013L5zwTiZ2CsgazyxXBiPa8
Backport of the synaptic touchpad quirk fix (PR #7236, merged to quattro as 20400ba) onto the v4-0-1 release branch, so 4.0.1 installs stop dying on it. install/hardware/fix-synaptic-touchpad.sh calls modprobe against the running kernel. On 4.0 the only thing that runs it is the ISO finalizer, inside arch-chroot, where uname -r still names the live ISO's kernel while /lib/modules holds the target's. The live ISO always boots linux-t2 and the configurator gives every machine that is not a T2 Mac stock linux, so the two never match: modprobe exits 1 with "Module psmouse not found in directory /lib/modules/<live kernel>". run_logged returns that status and omarchy-apply-hardware runs under set -euo pipefail, so a fresh install stops on the first machine with a device named "synaptics" and no psmouse loaded -- reported from a ThinkPad in #6985, but nothing about it is Lenovo-specific. Ask modprobe itself, with -qn, whether it can resolve psmouse for the running kernel before asking it to load one, and warn instead of failing when it declines for any other reason. The chroot mismatch becomes an unresolvable module, skipped in silence. An optional touchpad improvement must not be able to halt an install. This does not make InterTouch reach the installed system: a module loaded into the live kernel is gone at reboot, so on 4.0 this script has never applied anything to an installed machine -- it only ever aborted installs. Persisting it would mean writing options psmouse synaptics_intertouch=1 to /etc/modprobe.d, which forces the SMBus transport past the kernel's own allowlist on any touchpad merely named "synaptics". That is a hardware-behaviour change on a wide class of machines, left as a separate decision on quattro. Clean cherry-pick: both files are byte-identical to #7236, so merging v4-0-1 into quattro resolves without a conflict. test/shell.d/synaptic-touchpad-test.sh passes here, as does the rest of test/shell (183 files). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_018DEMYa9UWtroz93DhMTtcV
* Stop a psmouse quirk from failing every install install/hardware/fix-synaptic-touchpad.sh calls modprobe against the running kernel. Under 4.0 the only thing that runs it is the ISO finalizer, inside arch-chroot, where uname -r still names the live ISO's kernel while /lib/modules holds the target's. The live ISO always boots linux-t2 and the configurator gives every machine that is not a T2 Mac stock linux, so those two never match: modprobe exits 1 with "Module psmouse not found in directory /lib/modules/<live kernel>". run_logged returns that status and omarchy-apply-hardware runs under set -euo pipefail, so a fresh install stops on the first machine with a device named "synaptics" and no psmouse loaded -- reported from a ThinkPad in omacom#6985, but nothing about it is Lenovo-specific. Skip the load when the running kernel's modules are not reachable, and warn instead of failing when modprobe declines for any other reason. An optional touchpad improvement should never be able to halt an install. This does not make InterTouch reach the installed system: a module loaded into the live kernel is gone at reboot, so on 4.0 this script has never applied anything to an installed machine. Persisting it means writing options psmouse synaptics_intertouch=1 to /etc/modprobe.d, which forces the SMBus transport past the kernel's own allowlist on any touchpad merely named "synaptics" in /proc/bus/input/devices. That is a hardware-behaviour change on a wide class of machines, so it is left for a maintainer to decide separately. Fixes omacom#6985 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Ask modprobe whether psmouse resolves rather than guessing at /lib/modules The reachability check ran through OMARCHY_SYNAPTIC_MODULES_DIR, an override modprobe itself never saw: it decided whether the load was attempted but could not change where modprobe looked, so the guard and the load consulted different places and the seam read as though it configured module lookup. modprobe -qn answers the same question directly -- it resolves psmouse against the running kernel without loading it -- so the guard and the load now agree by construction and the override goes away. The arch-chroot case that broke installs is still skipped silently, for the same reason it always was: the live kernel's modules are not the ones on disk. Inline the remaining /proc/bus/input/devices override at its only use. These leaves are sourced one after another into a single shell, so a variable left at the top level outlives the script that set it. Pin the wiring assertion to the run_logged call instead of any mention of the path. A commented-out line satisfied the old grep, so the test could pass with the quirk no longer running at all. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013L5zwTiZ2CsgazyxXBiPa8 --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
install/hardware/fix-synaptic-touchpad.shcallsmodprobeagainst the running kernel. Under 4.0 the only thing that runs it is the ISO finalizer, insidearch-chroot, whereuname -rstill names the live ISO's kernel while/lib/modulesholds the target's. The live ISO always bootslinux-t2and the configurator gives every machine that is not a T2 Mac stocklinux, so those two can never match: modprobe exits 1 withModule psmouse not found in directory /lib/modules/<live kernel>.run_loggedreturns that status andomarchy-apply-hardwareruns underset -euo pipefail, so the install stops there.The gate is
grep -qi synaptics /proc/bus/input/devices && ! lsmod | grep -q '^psmouse', which is the loosest ininstall/hardware/— every sibling quirk gates on DMI vendor, PCI ID or model. Any machine with a device merely named "synaptics", including I2C/SMBus touchpads with no PS/2 controller at all, hits it. Reported from a ThinkPad, but nothing about it is Lenovo-specific.This asks modprobe itself, with
-qn, whether it can resolvepsmousefor the running kernel before asking it to load one, and warns instead of failing when it declines for any other reason. The chroot mismatch becomes an unresolvable module, skipped in silence. An optional touchpad improvement should not be able to halt an install.Worth being explicit about what this does not do: a module loaded into the live kernel is gone at reboot, so on 4.0 this script has never applied InterTouch to an installed machine — it only ever aborted installs. Persisting it would mean writing
options psmouse synaptics_intertouch=1to/etc/modprobe.d, which forces the SMBus transport past the kernel's own allowlist on every touchpad merely named "synaptics". That is a hardware-behaviour change on a wide class of machines, so it is left as a separate decision.Fixes #6985