It's really annoying as I have to unplug the mouse after a suspend to ensure that an occasional bump doesn't wake up the system. I haven't found anything in system settings which could disable this neither by googling around.

  • IMPORTANT: Pretty much all the answers below are bad and wrong. There is something enabling the mouse wake up in the first place. That should be altered! Leaving the enabling be, and adding a disabling thing later, is just a really really shoddy suggestion. Doing it via a script instead of in UDEV, on UDEV systems, is even worse. … On almost all systems, there is a toggle for this in the BIOS, that the user himself or the vendor set. Only if you can’t turn that off, try the UDEV solution. Also, check if any other UDEV rule enables it first. Oct 19, 2022 at 6:18
  • I've been using the echo disabled > /sys/devices/pci0000:00/0000:00:1a.0/power/wakeup (or whatever - see some of the answers below) solution since 2014 on my old Thinkpads. They do not have an USB bios setting and I don't remember if UDEV was already in place that time..
    – kanehekili
    Nov 5, 2022 at 16:23

16 Answers 16


I haven't checked the BIOS yet, but I've found a solution!

Short summary: In /proc/acpi/wakeup, you can see which devices are currently enabled to resume from suspend. That list shows names (abbreviated) of so called "Devices". Example "PWRB" means "power button".

If you write device-names to that file, you toggle them between enabled/disabled.

I wrote a small HowTo for disabling wakeup-by-mouse, based on a blog where I found that info.

  • 1
    This sounds much better than my answer, and I've edited my answer accordingly. Thanks! Mar 8, 2013 at 9:59
  • 5
    So, this works (however, I notice in passing that just using sudo won't work: one has to do sudo su first, then echo to /proc/acpi/wakeup. However, I'm wondering whether anyone has found a way to just disable the mouse? I have both on my desktop connected via (wireless) USB and this will disable the wake from keyboard too. Oct 3, 2014 at 7:38
  • The link is not working.
    – Timo
    May 16, 2021 at 18:13
  • @Timo: Link not working, because our server's currently down for maintenance ;) (Up and running 24/7 for over 9 years up to now)
    – Rooker
    May 17, 2021 at 20:19

Thanks to all posters as the mouse wakeup is a major inconvenience and I got my answers here. I wish to add my twist to the solutions as that may help in more cases. I had to disable 3 different items in /proc/acpi/wakeup. My devices: EHC1, EHC2, XHCI. The first 2 are usb2 and the 3rd a usb3 entry. Please note that although the usb transceiver for my mouse is plugged into a usb2 port and nothing is in any usb3 port, the computer will wake on mouse moves until all 3 items are disabled.

$ cat /proc/acpi/wakeup | sort 
Device  S-state   Status   Sysfs node
EHC1      S3    *disabled  pci:0000:00:1d.0
EHC2      S3    *disabled  pci:0000:00:1a.0
GLAN      S4    *enabled   pci:0000:08:00.0
.. ,, ..
USB7      S3    *disabled
WLAN      S3    *disabled  pci:0000:03:00.0
XHCI      S3    *disabled  pci:0000:07:00.0

To have the wakeup items disabled on every startup, you can add something like this to /etc/rc.local ..

echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup
echo XHCI > /proc/acpi/wakeup

Test which items need to be disabled - as indicated here - for each of the items that were posted as enabled under cat /proc/acpi/wakeup | sort by running in terminal each of the commands below and then testing if the mouse wakes the system (without the need for restart):

sudo sh -c "echo EHC1 > /proc/acpi/wakeup"
sudo sh -c "echo EHC2 > /proc/acpi/wakeup"
sudo sh -c "echo XHCI > /proc/acpi/wakeup"

(in my case the first one was enough even after testing with other USB ports)

If the /etc/rc.local file doesn't exist

According to this post, run:

printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
sudo chmod +x /etc/rc.local

The file should look something like:

echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup
echo XHCI > /proc/acpi/wakeup

exit 0


If that still doesn't work, it might be that the file /etc/systemd/system/rc-local.service is missing or not properly configured.

Test with

sudo /etc/init.d/rc.local start


sudo systemctl status rc-local

Following How to Enable /etc/rc.local with Systemd:

Create the file:

sudo nano /etc/systemd/system/rc-local.service

Then add the following content to it.

 Description=/etc/rc.local Compatibility

 ExecStart=/etc/rc.local start


Save and close the file. To save a file in Nano text editor, press Ctrl+O, then press Enter to confirm. To exit the file, Press Ctrl+X.

Check all is well with no errors with:

sudo systemctl start rc-local.service
sudo systemctl status rc-local.service

Reboot to see changes.

  • If you don't like my edit, please let me know by flagging @cipricus and I'll post as a separate answer linked to the above.
    – user47206
    May 21, 2018 at 12:07
  • sudo sh -c "echo EHC1 > /proc/acpi/wakeup" explained here the need for sh.
    – Timo
    Apr 27, 2021 at 17:24
  • A preachy post why one should not use rc.local
    – Timo
    Apr 27, 2021 at 17:36
  • It's too long, may you need some headers.
    – Jess Chen
    Oct 10, 2021 at 15:02
  • There is no USB. Please fix this answer. ~$ cat /proc/acpi/wakeup | sort Device S-state Status Sysfs node EXP8 S4 *disabled IGBE S4 *enabled pci:0000:00:1f.6 LID S4 *enabled platform:PNP0C0D:00 SLPB S3 *enabled platform:PNP0C0E:00 XHCI S3 *enabled pci:0000:00:14.0 Nov 5, 2022 at 0:18

This solution works with Ubuntu 15.10, 18.04, 20.04, 22.04

Find your mouse idProduct and idVendor by unpluging and replugging your mouse and searching /sys/bus/usb/devices/* folders. Ignore links with : in the name. For example follow the link for 3-3 but ignore 3-3:1.0

Now try to read the idProduct and idVendor. For example: cat /sys/bus/usb/devices/7-2.3/idProduct => 2000, cat /sys/bus/usb/devices/7-2.3/idVendor => 24ae.

Finally I create a script in /lib/systemd/system-sleep directory, name it mouse-suspend.sh


# From lsusb: Bus 007 Device 008: ID 24ae:2000

# Get sys device path by vendorId and productId
function find_device()
    local vendor=$1
    local product=$2
    vendor_files=( $(egrep --files-with-matches "$vendor" /sys/bus/usb/devices/*/idVendor) )
    for file in "${vendor_files[@]}"; do
       local dir=$(dirname "$file")
       if grep -q -P "$product" "$dir/idProduct"; then
         printf "%s\n" "$dir"

sysdev=$(find_device $idVendor $idProduct)

if [ ! -r "$sysdev/power/wakeup" ]; then
    echo $idVendor:$idProduct not found 1>&2
    exit 1

case "$1" in
    echo $1 > "$sysdev/power/wakeup"
    echo "$0 enabled   -- to enable the wakeup for this device"
    echo "$0 disabled  -- to disable the wakeup for this device"

grep --color=auto -H ".*" "$sysdev/power/wakeup"
exit 0

If it doesn't work then run sudo chmod +x mouse-suspend.sh && ./mouse-suspend.sh enabled

  • It works with Ubuntu 18.04 on my laptop. Jul 17, 2018 at 3:33
  • 1
    Still works with Ubuntu 20.04 and disables only the necessary device
    – jeb
    Jul 2, 2021 at 14:03
  • Thanks! I had to change grep -P "$product" "$dir/idProduct" to grep -q "$product" "$dir/idProduct" otherwise find_device outputs $product\n$dir\n causing the check after defining sysdev to fail. Jul 5, 2021 at 5:11

The solution I'm using is a udev rule that disables wakeup from a particular USB device. It should be agnostic to which port the device is plugged in to.

Create /etc/udev/rules.d/90-usb-wakeup.rules with the following content (modify idVendor and idProduct as appropriate, see output from lsusb):

# Disable waking up from Logitech unified receiver
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", ATTR{power/wakeup}="disabled"

Inspiration comes from https://wiki.archlinux.org/title/udev#Waking_from_suspend_with_USB_device

  • This is actually a very elegant solution. It worked for me on Fedora 36 with a slight alteration for idProduct. My G603 mouse has this receiver: 046d:c539 Logitech, Inc. Cordless Mouse Receiver
    – Silviu C.
    Sep 8, 2022 at 13:38
  • Much better solution than all the other /proc echoing hack job answers. Oct 19, 2022 at 5:57
  • Thank you so much! I was unable to put my Lenovo P14s Gen1 AMD into s2idle / modern sleep for hours. Took me ages to find out it's because of my Bolt Receiver (MX Mechanical) plugged into the docking station. This solution fixed the issue for me in a very elegant way.
    – Flatron
    Nov 27, 2022 at 3:36
  • The best answer. Just to note, for me, it worked after disconnecting and reconnecting the USB device.
    – SlimDeluxe
    Apr 2 at 9:58
  • sudo udevadm control --reload-rules
    – robertchen
    May 19 at 12:39

The above solution (https://askubuntu.com/a/265389/1467620) works, but it is crude and, also it disables the keyboard wake, which is actually useful.

A more granular alternative can be this: First, we start by enumerating the USB devices connected to the system:

lsusb | sort

from here, it’s pretty obvious which one is the mouse:

 Bus 002 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver

then we proceed with finding where the devices are mapped to:

grep . /sys/bus/usb/devices/*/power/wakeup | grep enabled


Finally, to figure out which is which, we use:

dmesg | grep Logitech | grep -o -P "usb.+?\s"

usb 2-1.2.7:

at which point it’s pretty obvious which one needs to be disabled:

sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.2.7/power/wakeup"

note: every time you need to echo as superuser, sh -c is necessary, or the system will not allow redirecting to a priviliged file.

Then it’s just a matter of suspending the system and verifying that, while the mouse does not wake it, the keyboard will.

this does not survive a system reboot, so either you need to re-run the last command, or add it to your .bashrc or .zshrc.

This is something that has been annoying me on Ubuntu since when I installed 16.04, and probably there forever, I cannot understand why Canonical wouldn’t add this in the System Settings.

Source: https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/

  • 1
    Worked like a charm. This solution is much cleaner than the accepted one and deserves more upvotes.
    – grabantot
    Feb 20, 2022 at 19:54
  • 1
    Can't Linux desktops have this in GUI? I mean, in Windows, you can do this by going to the Device Manager, open the mouse's property, and uncheck "allow wake". Why should this so complex in Linux desktops? I wish there was some sort of third-party GUI app to manage wake-up sources/devices. Mar 13 at 9:54

Ridiculous, but plug out, plug back in to determine the device code method is the least tedious. So:

  1. find
grep . /sys/bus/usb/devices/*/power/wakeup | grep enabled

figure out the offender using plug-out-plug-in method

  1. disable
sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/YOUR_DEVICE/power/wakeup"

inspired by this blog post


This is my step-by-step "tutorial" to make it work for you:

  1. Use command cat /proc/acpi/wakeup to show the list of wake up devices
  2. Use command sudo sh -c "echo XXXX >/proc/acpi/wakeup" (replace "XXXX" with your device code) to toggle the device state (enabled/disabled). Go one device at a time and try to suspend your machine and wake it up using the device you want to disable until the deserved device will not be able to wake up the machine. Don't forget to always enable back the devices that you do not want to have disabled.
  3. When you find the right device create on your desktop file "acpi_wakeup" containing following code: #!/bin/sh printf "XXXX" > /proc/acpi/wakeup (don't forget to replace "XXXX" with your device code)
  4. Move or copy the file to folder /etc/init.d/. To copy the file use following command: sudo cp /home/USERNAME/Desktop/acpi_wakeup /etc/init.d/acpi_wakeup (replace "USERNAME" with your actual user name)
  5. Make the file executable: sudo chmod 755 /etc/init.d/acpi_wakeup
  6. Then use 'update-rc.d' to make the required symbolic links automatically in other directories: sudo update-rc.d acpi_wakeup defaults (it shows WARNING: ...missing LSB tags and overrides but it is OK. You don't need to worry about it)
  7. Reboot your computer.

Sources and further reading:

http://www.das-werkstatt.com/forum/werkstatt/viewtopic.php?f=7&t=1985 http://ubuntuforums.org/showthread.php?t=814939&page=3


Here is an easier solution. I just wrote the first line:

sudo sh -c "echo disabled > /sys/bus/usb/devices/1-1/power/wakeup"

Now, the USB no:1 doesn't wake up the computer.

Note: by rebooting the system this procedure will reset and will need to be re-run.


In Kubuntu 19.10 the /etc/rc.local setting stopped working for me. I first noticed this on a Manjaro KDE, and found this solution, that worked there. It also works in Kubuntu 19.10, which may mean there are some changes in newer systems (whether related to the kernel or the Plasma version I don't know).


sort /proc/acpi/wakeup

and look for items that are marked "enabled". Note their names (e.g EHC1,EHC2, NXUC). Then, test which of the commands like below stop the mouse from waking up the PC:

sudo sh -c "echo EHC1 > /proc/acpi/wakeup"
sudo sh -c "echo EHC2 > /proc/acpi/wakeup"
sudo sh -c "echo NXUC > /proc/acpi/wakeup"

Create a folder ~/.bin

mkdir ~/.bin

(If you prefer another location, replace that accordingly in the following files.)

Create a systemd service. In terminal:

nano /etc/systemd/system/wakeup-events.service 

With this content:

Description=Disable wakeup events on startup

ExecStart=/bin/bash ~/.bin/wakeup-events.sh


Save and enter password.

In terminal:

nano ~/.bin/wakeup-events.sh

with the following content:

# Disable wakeup events

echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup
echo NXUC > /proc/acpi/wakeup

(Replace accordingly: e.g EHC1,EHC2, NXUC).

Don't forget:

sudo systemctl enable wakeup-events

And reboot.


For me all the above solutions only worked temporarily, that is all the changes got reset after plugging out and in the device or reboot.

Disabling the process using the sudo sh -c "echo XXXX > /proc/acpi/wakeup" command works well until reboot (in my case it was sudo sh -c "echo XHC > /proc/acpi/wakeup"), but none of the solutions above made this setting permanent. Eventually, I found a working solution here: https://unix.stackexchange.com/questions/417956/make-changes-to-proc-acpi-wakeup-permanent

I'm using Ubuntu 20.04.


The solution that worked for me, was got from here.

First, we start by enumerating the USB devices connected to the system:

lsusb | sort

from here, it’s pretty obvious which one is the mouse:

Bus 002 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver

then we proceed with finding where the devices are mapped to:

grep . /sys/bus/usb/devices/*/power/wakeup | grep enabled


Finally, to figure out which is which, we use:

dmesg | grep Logitech | grep -o -P "usb.+?\s"

usb 2-1.2.7:

at which point it’s pretty obvious which one needs to be disabled:

sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.2.7/power/wakeup"

(note: every time you need to echo as superuser, sh -c is necessary, or the system will not allow redirecting to a priviliged file).

Then it’s just a matter of suspending the system and verifying that, while the mouse does not wake it, the keyboard will.

This does not survive a system reboot, so either you need to re-run the last command, or add it to your .bashrc or .zshrc

  • this is as complicated as all other answers here Apr 4, 2022 at 18:50
  • Works fine with 22.04, but I added the line via sudo crontab -e with @reboot option
    – Guillaume
    Oct 11, 2022 at 8:40
  • I'm using this solution since 2014 for a Thinkpad T510.
    – kanehekili
    Nov 5, 2022 at 16:20

Prevent all devices from waking up. Power button and RTC timer are the only methods left to wake the system. I add this to /etc/udev/rules.d/99-nowakeup.rules:

ACTION=="add", SUBSYSTEM=="pci|usb", ATTR{power/wakeup}=="enabled", ATTR{power/wakeup}="disabled"

A way to look at all the ways the system can wake up:

find /sys -type f -name "wakeup" | while read a; do echo "$(cat $a) $a"; done |sort
  • Thanks for answering! It looks like your answer is technically accurate, but it would be hard to understand for someone who lacks your expertise. Can you provide more details about how these changes affect your system, and a link to any relevant documentation? Also, is 99-nowakeup.rules a new file you created, or an existing one that you modified? Thanks!
    – jpaugh
    May 3 at 21:28

There may be a way specific to your hardware, in which case the option may be available through your system's BIOS settings.

Getting to your BIOS menu to change settings is also system specific. Usually you press a key just after rebooting, and the key to press is often displayed on the screen.

However, user138339's answer seems like a more general way to achieve what you need, and you can do this from the running system.

  • @Evi1M4chine: : my old Thinkpad can't do this. In this case you need to hack. Otherwise you are correct. The correct answer should be: If you can't tweak your bios then ...
    – kanehekili
    Nov 5, 2022 at 16:18
  • @kanehekili: There’s actually unlocked BIOSes for old Thinkpads. I ran a script that patched my BIOS and let me install any battery or expansion card I like. That script also unlocked all possible settings, safe and unsafe, in the BIOS. I just can’t stand when businesses want to treat people like children and literally domesticate them. Nov 6, 2022 at 23:59

this script solved my problem. check it out.


# allow only one instance
r=$(pidof -x -o $$ ssmonoff.sh)
set -- $r
if [ "${#@}" -ge 1 ]; then
    echo "Script already running. Exit..."

dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | ( while read line; do
    if echo $line | grep "boolean true" &> /dev/null; then
            xinput --set-prop "Dell Premium USB Optical Mouse" "Device Enabled" "0"
            xset dpms force off
            xinput --set-prop "Dell Premium USB Optical Mouse" "Device Enabled" "1"
done )

All you have to do is, first, run sudo xinput list, find the given Name of your USB mouse, and put it on the script. Then, save the file as "ssmonoff.sh", make it executable, and set it to run on startup.


Great explanation. I simply added to rc.local the following command

for d in $(cat /proc/apci/wakeup | grep enabled | grep -v PS2K | cut -b -4); do echo $d > /proc/acpi/wakeup ; done

to disable every device than PS2K (keyboard PS2) from wakeup.


Tested in Ubuntu 22.04

A Step-by-Step to the solution:

lsusb | sort

This command lists all usb devices in your computer, it is only informational.
If you don't know the manufactor of your mouse, probably you'll find here.

sudo ls /sys/bus/usb/devices

Using this command you'll see all usb connectors, in my computer I see something like this:
1-0:1.0 3-0:1.0 3-10 3-10:1.1 3-1:1.1 3-7:1.0 4-0:1.0 usb2 usb4 2-0:1.0 3-1 3-10:1.0 3-1:1.0 3-7 3-7:1.1 usb1 usb3

You can see in each connector the status about suspended mode, looking inside /sys/bus/usb/devices/{connector}/power/wakeup, for example:

sudo gedit /sys/bus/usb/devices/3-1/power/wakeup

To make your life easer, instead of open each file inside each folder, you can use grep to open all wakeup files and shows you only files containing enabled.

grep . /sys/bus/usb/devices/*/power/wakeup | grep enabled

This command shows you devices that wakeup your computer when suspended.
This command open each file /power/wakeup inside all folders inside /sys/bus/usb/devices and lists all files containing enabled inside.

grep . /sys/bus/usb/devices/*/power/wakeup | grep disabled

This command shows you devices that doesn't wakeup your computer when suspended.

If you don't know the mouse manufactor, you can search inside messages about device driver initialization using dmesg command:

sudo dmesg

Try to find something like Mouse, if it is wireless, try to find Wireless etc.

To simplify the search, you can use grep utility:

sudo dmesg | grep Mouse
sudo dmesg > drivers_initializations.txt
gedit ./drivers_initializations.txt
search for Mouse

knowing what usb connector the mouse uses, you need to disable the wakeup feacture in /sys/bus/usb/devices/{connector}/power/wakeup

Now open /sys/bus/usb/devices/{connector}/power/wakeup
In my case it was /sys/bus/usb/devices/3-1/power/wakeup

Change enabled to disabled

Suspend your computer and move the mouse, if it works, go to the next step:

Now you need to include this command inside a system startup script, it doesn't work inside .bashrc .profile, because you need to use sudo, and it is before session loading.

I used rc.local script. It is a superuser startup script. It is called after all services are loaded.

Change /etc/rc.local if it exists, if doesn't exists, create it.

sudo gedit /etc/rc.local

add the content:

#!/bin/sh -e
sh -c "echo 'disabled' > /sys/bus/usb/devices/3-1/power/wakeup"
exit 0

Note the example uses connector 3-1, you need to change to your connector.

The script needs to be executable:
sudo chmod +x /etc/rc.local

Reboot and suspend your computer and check if mouse wakeups your computer, if it still wakeups, rc.local is disabled in your Systemd, go ahead and enable rc.local:

sudo systemctl is-enabled rc-local.service sudo systemctl status rc-local.service

if it is static or disabled, then type the following commands to enable /etc/rc.local with systemd under Linux.

sudo systemctl enable rc-local.service

Reboot and suspend and try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.