How to prevent Linux from waking up due to USB devices

I’ll start this one off with a funny story. Whenever I spark something in the room (like, my hand on a doorknob), my linux box wakes up from sleep. I tracked the problem down to the wireless receiver for the Logitech M570 wireless mouse on my desk – the electrostatic discharge from the spark causes the USB receiver to send some signal to the computer.

The problem is, that every time this happens (4+ times per day), it wakes up my machine. I then have to wait for everything to wake up, enter my password to unlock it, then put it back to sleep. Not fun. So I determined what I needed to do was prevent the USB ports from waking up the machine (or replace my beloved mouse). I chose the former, but for the longest time, could not figure out how the hell to do it. I finally figured it out, and to save anyone else from my misery, here’s the short version.

Just add the following to /etc/rc.local:
echo "EHC1" > /proc/acpi/wakeup
echo "EHC2" > /proc/acpi/wakeup
(add more if you have more than two USB2.0 host controllers)

If you have something plugged into a USB3.0 port, then add:
echo "XHC" > /proc/acpi/wakeup

Now, when the computer boots, it disables waking up for USB events. It seems a little counterintuitive, but the above lines actually toggle the wakeup states in /proc/acpi/wakeup.

Categorized as Fixes Tagged


    1. Actually, not really. This tip is not working for every one.
      In spite of all EHCI/XHC entries being disabled, USB devices wake up my laptop.

  1. Hi, it’s working for me.
    I’m just adding simple script that check status and disable wakeup only if it’s enabled.

    ## parse wakeup and disable wakeup for ARPT(wifi) and XHC1(usb)
    cat /proc/acpi/wakeup | tail -n +2 | awk ‘{print $1,$3}’ | while read ss st;
    if [ $ss = “ARPT” ] || [ $ss = “XHC1” ]

    if [ $st = “*enabled” ]
    echo $ss > /proc/acpi/wakeup


  2. In Ubuntu 18.04 I had to use “sudo sh -c” otherwise I get a permission denied.

    For instance: sudo sh -c “echo PCI0 > /proc/acpi/wakeup”

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.