I had a problem with my Ubuntu 12.04 waking up immediately after going into suspend. I solved the problem by changing the settings in /proc/acpi/wakeup, as suggested in this question: How do I prevent immediate wake up from suspend and/or hibernation?.

After changing the settings, the system goes flawlessly into suspend and stays suspended, but after I wake it back up, the settings in /proc/acpi/wakeup are different from what I set them to.

Before going to suspend:

cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
SMB0      S4    *disabled  pci:0000:00:03.2
PBB0      S4    *disabled  pci:0000:00:09.0
HDAC      S4    *disabled  pci:0000:00:08.0
XVR0      S4    *disabled  pci:0000:00:0c.0
XVR1      S4    *disabled  
P0P5      S4    *disabled  
P0P6      S4    *disabled  pci:0000:00:15.0
GLAN      S4    *enabled   pci:0000:03:00.0
P0P7      S4    *disabled  pci:0000:00:16.0
P0P8      S4    *disabled  
P0P9      S4    *disabled  
USB0      S3    *disabled  pci:0000:00:04.0
USB2      S3    *disabled  pci:0000:00:04.1
US15      S3    *disabled  pci:0000:00:06.0
US12      S3    *disabled  pci:0000:00:06.1
PWRB      S4    *enabled   
SLPB      S4    *enabled

I tell the system to suspend, and it works as it should. But later after waking it up, the settings are changed to either:

USB0      S3    *disabled  pci:0000:00:04.0
USB2      S3    *enabled   pci:0000:00:04.1
US15      S3    *disabled  pci:0000:00:06.0
US12      S3    *enabled   pci:0000:00:06.1


USB0      S3    *enabled   pci:0000:00:04.0
USB2      S3    *enabled   pci:0000:00:04.1
US15      S3    *enabled   pci:0000:00:06.0
US12      S3    *enabled   pci:0000:00:06.1

Any ideas?

Thank you for your response. Unfortunately it did not solve my problem.

all of


as well as


are set to disabled, and the notebook still wakes up by itself right after going to sleep. The only thing it seems to react to are the settings in /proc/acpi/wakeup, which keep changing (resetting) every time i power off/restart my notebook.

6 Answers 6


I ran into this problem again on Ubuntu 12.10. The suggestions from user MTS unfortunately also did not work for me. However, you can write a script to automatically set the usb properties in /proc/acpi/wakeup right before every suspend.

The solution is based on creating a suspend hook (based on this Archwiki article). Save the following as /usr/lib/pm-utils/sleep.d/45fixusbwakeup, and make sure to make it executable (chmod +x /usr/lib/pm-utils/sleep.d/45fixusbwakeup).

case $1 in
            echo "Going to suspend to disk!"
            echo "Fixing acpi settings."
            for usb in `cat /proc/acpi/wakeup | grep USB | cut -f1`;
                    state=`cat /proc/acpi/wakeup | grep $usb | cut -f3 | cut -d' ' -f1 | tr -d '*'`
                    echo "device = $usb, state = $state"
                    if [ "$state" == "enabled" ]
                            echo $usb > /proc/acpi/wakeup
            echo "Suspending to RAM."
            echo "Suspend to disk is now over!"
            echo "We are now resuming."
            echo "Somebody is callin me totally wrong."

What this does is change the status of every USB device that is currently enabled to disabled. If you only want to change specific USB devices, change the for loop in the script. For example to change only USB1 and USB3 change

for usb in `cat /proc/acpi/wakeup | grep USB | cut -f1`;


for usb in 'USB1' 'USB3';

Hopefully this helps someone else who has the same problem. This approach solved the issue for me.

  • 1
    Thanks! I modified this script to disable wakup from USB devices on my Sony Vaio laptop: gist.github.com/rutsky/1ed8e9779f0b2941c5a6 Commented Jun 8, 2014 at 19:26
  • I modified your script to disable wakeup on LID open (really stupid and annoying feature from my point of view). Thank you!
    – humkins
    Commented Jul 5, 2014 at 22:09
  • This extra useful hook works in Ubuntu & Kubuntu, but not in Xubuntu 15.04. I wonder why... :(
    – Reloader
    Commented Jun 30, 2015 at 17:19
  • 1
    Here is modified script from Vladimir Rutsky for systemd sleep hook instead of pm-utils: gist.github.com/kepi/9dea7aee8a59f3e7c10a
    – Kepi
    Commented Feb 27, 2016 at 15:07
  • 1
    If this could be updated for Ubuntu 16.04, it'd be great. I used solution from here: askubuntu.com/a/620555/463546 (the older solution), but it's a bit cumbersome in total. Commented Aug 24, 2016 at 7:38

Perhaps http://forum.xbmc.org/showthread.php?tid=121158 will help?

This is what it says:

For those who are updating to the 3.2 kernel (which should be everyone due to the recent root exploit), you'll notice your USB wakeup is probably broken. They changed the default wakeup policy (http://www.spinics.net/lists/linux-usb/msg53661.html), so you'll need to make a couple of changes:

  • you no longer need to enable wakeup in /proc/acpi/wakeup, it's enabled by default
  • you need to enable wakeup for the USB hub in addition to the device in /sys/bus/usb/devices/*/power/wakeup

So, this:

echo USB1 > /proc/acpi/wakeup
echo enabled > /sys/bus/usb/devices/3-1/power/wakeup


echo enabled > /sys/bus/usb/devices/usb3/power/wakeup
echo enabled > /sys/bus/usb/devices/3-1/power/wakeup

Hopefully this saves others from troubleshooting the same problem.


For Ubuntu 15+, you must use systemd instead of rc.local. You may google "Creating a systemd service" and follow the instructions, but note that redirecting output to /proc/acpi/wakeup is tricky. To get it to work correctly, you must do something like:

/bin/sh -c '/bin/echo XHC > /proc/acpi/wakeup'

Example output for the service file (e.g., /etc/systemd/system/suspendfix.service):

Description=fix to prevent system from waking immediately after suspend

ExecStart=/bin/sh -c '/bin/echo XHC > /proc/acpi/wakeup'


Or here in this gist

  • Simply adding file /etc/systemd/system/suspendfix.service with the contents you listed, and rebooting, did not produce the expected results in cat /proc/acpi/wakeup (it is still enabled). Commented Apr 6, 2022 at 11:37

The preferred way to do this is by creating a service with systemd.
Adding script in rc.local is the deprecated way.

  1. Create a script file wherever you wish. Ex: ~/scripts/disable-devices-as-wakeup.sh.

declare -a devices=(USB0 USB2 US12 US15) # <-- Add your entries here
for device in "${devices[@]}"; do
    if grep -qw ^$device.*enabled /proc/acpi/wakeup; then
        sudo sh -c "echo $device > /proc/acpi/wakeup"
  1. Test it by executing it from the terminal.

  2. If everything is okay then let's make a service.

$ touch ~/scripts/disable-devices-as-wakeup.service

~/scripts/disable-devices-as-wakeup.service -

Description=Disable devices as wakeup


  1. Copy or move the service to /etc/systemd/system/.
$ sudo cp ~/scripts/disable-devices-as-wakeup.service /etc/systemd/system/
  1. Enable the service.
$ systemctl enable disable-devices-as-wakeup.service
  1. Restart the OS and check the status.
$ systemctl status disable-devices-as-wakeup.service

Detailed explanation found on https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/chap-managing_services_with_systemd

  • Script produces a bunch of errors such as grep: RP05: No such file or directory. Mint 20. Commented Mar 25, 2021 at 20:34
  • @CodeGuy123 I fixed it by removing the quotes from the "declare" line like this: declare -a devices=( LID0 XHC1 )
    – Bart
    Commented Apr 15, 2021 at 20:49
  • Please note, if you create the script in your home, the file will have wrong SELinux type. It must by of type bin_t. Its better to create the script in /usr/local/bin and it will automatically get this type. For more info see answer here unix.stackexchange.com/a/588207/553497
    – stove
    Commented Dec 17, 2022 at 14:52

Based on @Hrishikesh Kadam's answer, but with more details and some improvements. 🤗

Disable the computer from waking up using the keyboard, mouse and others

List devices that can wakeup the system

List devices that can wakeup the system (they are as "*enabled")...

cat /proc/acpi/wakeup

Find out which device is

To find out which device is...


""" Device S-state Status Sysfs node [...] XHC S3 *disabled pci:0000:00:14.0 [...] """

... write down the device "node" - which in the example above is "00:14.0" - and use "lspci" utility to see which device it is...


lspci | grep "00:14.0"

PLUS: The cat /proc/bus/input/devices command also displays information about devices.

Configure the bash script

Knowing which devices are, configure the bash script below in the indicated location...


read -r -d '' FILE_CONTENT << 'HEREDOC'

declare -a devices=("XHC" "RP05" "RP09" "RP13" "AWAC") # <<<--- ADD YOUR DEVICES HERE!
for device in "${devices[@]}"; do
    if grep -qw ^$device.*enabled "/proc/acpi/wakeup"; then
        echo "$device" > "/proc/acpi/wakeup"

echo -n "${FILE_CONTENT:6:-3}" > "/usr/local/bin/disable-devices-as-wakeup.bash"

NOTE: The code above will create the file "/usr/local/bin/disable-devices-as-wakeup.bash".

... and make the script executable...

chmod +x /usr/local/bin/disable-devices-as-wakeup.bash

Create service file

Create a file to configure and run the created script as a service...

read -r -d '' FILE_CONTENT << 'HEREDOC'
Description=Disable devices as wakeup



echo -n "${FILE_CONTENT:6:-3}" > "/etc/systemd/system/disable-devices-as-wakeup.service"

NOTE: The code above will create the file "/etc/systemd/system/disable-devices-as-wakeup.service".

Enable the "disable-devices-as-wakeup" service

Enable the "disable-devices-as-wakeup" service...

systemctl enable disable-devices-as-wakeup.service

Restart the OS and check the "disable-devices-as-wakeup" service status

Restart the OS and check the "disable-devices-as-wakeup" service status...

systemctl status disable-devices-as-wakeup.service

... and list devices that can wakeup the system...

cat /proc/acpi/wakeup

...to check if the expected result happened.

[Ref(s).: https://askubuntu.com/a/1316641/134723 , https://tecadmin.net/run-shell-script-as-systemd-service/ ]


I would like a more secure and accurate method to effectively identify what each device in the "/proc/acpi/wakeup" file is. I was not able, for example, to identify and disable my notebook's built-in keyboard to wakeup (I don't even know if this is possible) my syste. I was able to disable only the USB external keyboard, the USB mouse and the touchpad.

This is too basic a problem for us to have to resort to strategies like these in Linux. I see it as something that should have been solved simply and a long time ago in Linux... 🙄

  • If you want to limit these settings to a specific user, you can try running the script at the startup of the desired user's session or some configuration in the service file (WantedBy=multi-user.target?). 😉 Commented Oct 11, 2023 at 22:40

The systemd way:

Create /etc/tmpfiles.d/disable-bluetooth-wake-from-sleep.conf:

#    Path                  Mode UID  GID  Age Argument
w+   /proc/acpi/wakeup     -    -    -    -   OCH1
w+   /proc/acpi/wakeup     -    -    -    -   XHCI

# It is possible to write multiple lines to the same file, either with \n in the argument
# or using the w+ type on multiple lines (including the first one) for appending

Apply the changes without reboot:

sudo systemd-tmpfiles --create

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .