OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
power-suspend high very-common DISPUTE

Stop the machine waking instantly from suspend via the USB controller

archomarchyendeavouroscachyosmanjarolaptopdesktop
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

The diagnosis, the sysfs paths and both udev rules are correct. The gap is that writing to /proc/acpi/wakeup is a TOGGLE, not a set: echo XHC > /proc/acpi/wakeup flips the current state. If XHC is already disabled the command re-ARMS it (making things worse), and if the string does not exist on that board the write silently does nothing. The record never says this, and a user pasting the line twice undoes their own fix. Also, echo disabled > /sys/bus/usb/devices/usb1/power/wakeup disables wake for the root hub only if usb1 is the right bus. It should be picked, not assumed.

The cause above was not rewritten and may still contain the error described. The fix below is the corrected version.
RISK

Disabling wakeup on the USB controller also kills wake-on-keyboard and wake-on-mouse. You will need the power button to wake the machine. Do not disable the one source you rely on to wake it.

Symptom

I hit suspend, the screen goes black and the fans stop for about a second, then the machine wakes straight back up. journalctl -b -1 -k shows: PM: Some devices failed to suspend, or early wake event detected and just above it xhci_hcd 0000:02:00.0: PM: failed to suspend async: error -16.

Cause

An ACPI wakeup source is armed on the USB host controller (or on a device attached to it, e.g. a Logitech Unifying/Bolt receiver or a USB dock). Buggy firmware asserts a wake event as soon as the xHCI controller enters D3, so the kernel aborts the suspend and immediately resumes. On some Intel Haswell/LynxPoint chipsets this is a known firmware bug the kernel only denylists case by case.

Fix

  1. List the armed sources and note the Status column:

cat /proc/acpi/wakeup

The write below is a TOGGLE, not a set. Only echo a device that currently reads *enabled, and never run it twice. A second write re-arms it. Verify after every write:


# only if XHC currently shows *enabled
sudo sh -c 'echo XHC > /proc/acpi/wakeup'
grep -E '^(XHC|EHC)' /proc/acpi/wakeup   # confirm it now reads *disabled
systemctl suspend
  1. Make it permanent with the idempotent sysfs attribute (this one is a set, not a toggle). Take KERNEL from the Sysfs node column with the pci: prefix stripped:

# /etc/udev/rules.d/90-disable-usb-wakeup.rules
ACTION=="add", SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"

sudo udevadm control --reload-rules && sudo udevadm trigger --subsystem-match=pci
  1. To blame one USB device instead, find the right node first rather than guessing usb1:

grep -H . /sys/bus/usb/devices/*/power/wakeup 2>/dev/null | grep enabled
lsusb -t   # map bus/port to the device
echo disabled | sudo tee /sys/bus/usb/devices/usb1/power/wakeup

The per-device udev rule as given is correct. Note that disabling wakeup on the xHCI controller also kills wake-on-USB-keyboard/mouse for the whole controller. Prefer the per-device rule if you rely on that.

Verify

systemctl suspend and leave it for 60 seconds. It should stay asleep and wake only on the power button. Compare grep -F "" /sys/class/wakeup/*/device/power/wakeup_count before and after a sleep cycle to see which source fired.

Sources

suspend-instant-wake-usb-controller