Stop powertop --auto-tune making the USB mouse and keyboard lag or drop out
The unit and the ExecStartPost line match the Arch wiki Powertop page word for word. The line is broken inside a systemd unit, though. systemd expands specifiers in Exec lines, so -printf '%f\n' becomes -printf '/powertop\n' (%f is the unit-name specifier, and a literal needs %%f). systemd also applies its own C-style unescaping to the nested single-quoted regex. The loop would then write to nonexistent paths and leave input devices on autosuspend, which is the problem it was meant to solve. This was found by reading the line against systemd's documented specifier rules, not by running it. The fix moves the loop into a script, which avoids both problems. The cause also claimed WantedBy=sleep.target reapplies auto-tune after every resume. With Type=oneshot and RemainAfterExit=yes the unit stays active after boot, so pulling it in again from sleep.target is a no-op. Omarchy-specific check: omarchy-settings 4.0.4-1 ships /etc/modprobe.d/omarchy-usb-autosuspend.conf with options usbcore autosuspend=-1, but usbcore is built into linux-omarchy 7.2.5-3 (modinfo says builtin) and /sys/module/usbcore/parameters/autosuspend reads 2. So Omarchy does not prevent the powertop effect, and the record still applies on Omarchy 4. Not exercised: powertop is not installed here. Second audit confirmed the corrected text: Read the Arch wiki Powertop page (raw wikitext): the unit with WantedBy=multi-user.target sleep.target, the one-line ExecStartPost with -printf '%f\n' and nested single quotes, and --auto-tune-dump are all there, so the earlier correction's reading of the source holds. The %f specifier and nested-quote problem is a sound reading of systemd unit syntax and the script replacement avoids both. The script loop was checked by hand: /sys/bus/usb/drivers/usbhid/*:* matches only interface entries such as 1-2:1.0, and ${dev%%:*} yields the device 1-2. The RemainAfterExit=yes point is correct: starting an already active oneshot unit is a no-op. Omarchy-side claims confirmed on this workstation: /etc/modprobe.d/omarchy-usb-autosuspend.conf contains options usbcore autosuspend=-1, usbcore is listed in modules.builtin for 7.2.5-3-omarchy, /sys/module/usbcore/parameters/autosuspend reads 2, and power-profiles-daemon 0.30-1 is installed. powertop 2.16-1 is in extra. Not exercised: powertop is not installed here and no unit was run.
Symptom
Since I added a powertop --auto-tune service for battery life, my USB mouse freezes for a second when I first move it, the keyboard drops its first key press, and some USB devices disconnect at boot or after resume.
Cause
powertop --auto-tune sets every tunable to its 'Good' value, including power/control=auto for every USB device. That enables USB autosuspend, so idle input devices are put to sleep and lose the first movement or key press when they wake. The setting lasts until reboot. The Arch wiki's unit lists sleep.target in WantedBy=, but with Type=oneshot and RemainAfterExit=yes the unit stays active after boot, so suspend does not run it again. Omarchy 4 ships /etc/modprobe.d/omarchy-usb-autosuspend.conf with options usbcore autosuspend=-1, but usbcore is built into the kernel, so that file has no effect and the kernel default delay of 2 seconds applies. This is separate from TLP's USB autosuspend, but on the same knob.
Fix
**Option 1, keep auto-tune but exempt input devices.** Put the loop that turns autosuspend back off for every device bound to usbhid in a script. Do not paste the Arch wiki's one-line ExecStartPost=/bin/sh -c '...' into the unit: systemd expands %f in it as a unit specifier and unescapes the nested quotes, so the loop writes to the wrong paths.
sudo tee /usr/local/bin/usbhid-no-autosuspend <<'EOF'
#!/bin/sh
for d in /sys/bus/usb/drivers/usbhid/*:*; do
[ -e "$d" ] || continue
dev=$(basename "$d")
dev=${dev%%:*}
echo on > "/sys/bus/usb/devices/$dev/power/control"
done
EOF
sudo chmod 755 /usr/local/bin/usbhid-no-autosuspend
# /etc/systemd/system/powertop.service
[Unit]
Description=Powertop tunings
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/powertop --auto-tune
ExecStartPost=/usr/local/bin/usbhid-no-autosuspend
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl restart powertop.service
cat /sys/bus/usb/devices/*/power/control | sort | uniq -c
**Option 2, apply only the tunables you want.** Print what auto-tune would do, and keep only the useful lines as udev rules or sysctl settings:
sudo powertop --auto-tune-dump
**Option 3, stop using it:**
sudo systemctl disable --now powertop.service
Then reboot to undo the tunings it already applied.
On Omarchy 4, power-profiles-daemon already manages CPU EPP and platform profile, so auto-tune mostly adds USB, SATA and PCI runtime PM on top of it.
Verify
cat /sys/bus/usb/devices/<mouse>/power/control prints on after boot and after a suspend and resume. Find the device path with lsusb -t or grep -l <idProduct> /sys/bus/usb/devices/*/idProduct.