Ubuntu: Fix Unintended ACPI Wakeups
Now that I am rolling Kubuntu as my daily, I’ve had a chance to experience some of the more nuanced bugs that seem to plague different types of hardware at different times. With all of the other bugs that crop up, none was more annoying to me than the USB ACPI bug that kept waking my trusty Lenovo T460s up while it was sealed in my bag. There’s nothing worse than rolling up to a meeting with a dead battery in a laptop that’s like 3000 degrees.
The solution to this was pretty straight forward but eluded me was to check out the /proc/acpi/wakeup entries:
cat /proc/acpi/wakeup Device S-state Status Sysfs node LID S4 *enabled platform:PNP0C0D:00 SLPB S3 *enabled platform:PNP0C0E:00 IGBE S4 *disabled pci:0000:00:1f.6 EXP2 S4 *disabled XHCI S3 *enabled pci:0000:00:14.0
And with a little research, I found out that the XHCI is the USB keyboard interface (internal), which corresponded with wake notices in dmesg
.
Now the quick fix for this was to simply run the following commands:
sudo su echo XHCI > /proc/acpi/wakeup
Which fixed it until I rebooted. Boo. Now to make it permanent…
To make this happen on reboot automatically, create a new file in the /etc/systemd/system/
folder named acpi_fix.service
. Place the following content in that file:
[Unit] Description=something [Service] ExecStart=/bin/bash -c "echo XHCI >> /proc/acpi/wakeup" [Install] WantedBy=multi-user.target
Just swap out the ACPI device name to whatever is making yours wake up.
After that is done, fun the following commands to:
Refresh the service index:sudo systemctl daemon-reload
Start the service:sudo systemctl start acpi_fix.service
Tell it to autostart:sudo systemctl enable acpi_fix.service
That should be it. You can restart and confirm that it’s working by running the cat
command back at the top.
Happy Linuxing!