If I try to suspend the system it just wakes up either immediately or after a couple of minutes. I have an excerpt of my system log showing when it entered suspend and exited but I don't know how to upload it here in an easy to read format.
5 Answers
I had the very same problem after upgrading from ubuntu 16.04 to ubuntu 18.04.
I solved by disabling the wakeup option for the device that in my case was enabled.
$ cat /sys/bus/usb/devices/*/power/wakeup
disabled
enabled
disabled
disabled
$ ll /sys/bus/usb/devices/*/power/wakeup
-rw-r--r-- 1 root root 4,0K mag 19 11:04 /sys/bus/usb/devices/1-7/power/wakeup
-rw-r--r-- 1 root root 4,0K mag 19 11:02 /sys/bus/usb/devices/1-9/power/wakeup <-- the bad guy
-rw-r--r-- 1 root root 4,0K mag 19 10:46 /sys/bus/usb/devices/usb1/power/wakeup
-rw-r--r-- 1 root root 4,0K mag 19 10:46 /sys/bus/usb/devices/usb2/power/wakeup
But what really helped me to identify the device were its ids.
cat /sys/bus/usb/devices/1-9/idVendor
8087
cat /sys/bus/usb/devices/1-9/idProduct
0a2b
After googling a bit, turns out it's the bluethooth controller.. https://usb-ids.gowdy.us/read/UD/8087/0a2b
Finally disable it
echo "disabled" > /sys/bus/usb/devices/1-9/power/wakeup
Now my laptop really suspends. Hope this helps you too.
Too make it persistent after reboot:
according to this post
add this command to /etc/rc.local
if this file does not exist, 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:
#!/bin/bash
echo "disabled" > /sys/bus/usb/devices/1-9/power/wakeup
exit 0
Test start the rc.local service with
sudo /etc/rc.local start
and test it with
sudo systemctl status rc-local
Reboot to see changes.
This happened to me after an update of Ubuntu 21.04 Hirsute Hippo. The problem was nvidia graphics card and installed CUDA.
To fix the issue, disable CUDA repository in Software Updater. Image of software updater
Update nvidia drivers.
sudo apt install nvidia-driver-[your drive number]
If you don't know your driver number, check your installed drivers.
apt list -i | grep nvidia
Enable these services in systemd.
sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service

- 21
- 2
-
OMG, you are right, some NVIDIA stuff is was interfering with suspend even though I had disabled using the graphic drivers. I purged all NVIDIA packages and then suspend worked! This as part of debugging at: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-510/+bug/1953674 Final summary at: https://askubuntu.com/questions/1032633/18-04-screen-remains-blank-after-wake-up-from-suspend/1391917#1391917 – Ciro Santilli OurBigBook.com Feb 09 '22 at 10:21
What is working for me is to use the power button.
We can configure it on the settings to suspend (instead of shutdown).
(You can always long press tho to force a hard shutdown).
It seems here that the notebook wont remain suspended if I use the suspend application/command from the menu.
I tried changing all usb's wakeup to disabled too but that didnt work here.
I could guess that the power button is working because I am avoiding touching the keyboard. Even disabled, I still can use the keyboard to wakeup tho.

- 161
Simple script to add to bashrc based on cventr's answer:
for path in `sudo ls -l /sys/bus/usb/devices/*/power/wakeup | awk '{print $9}'`;
do
sudo echo "disabled" > $path
done
I also use this one:
for usb in `cat /proc/acpi/wakeup | grep ".*" | cut -f1`;
do
state=`cat /proc/acpi/wakeup | grep $usb | cut -f3 | cut -d' ' -f1 | tr -d '*'`
if [ "$state" == "enabled" ]
then
echo $usb > /proc/acpi/wakeup
fi
done

- 97
- 1
- 3
I would suggest to follow this approach since rc.local
is deprecated and mainly there for specific use cases and backward compatibility.
In my case the service under /etc/systemd/system
looks like this:
[Unit]
Description=Disables wake-up from keyboard and mouse
# the service runs before the computer goes to sleep
Before=sleep.target
[Service]
Type=simple
ExecStart=/usr/bin/bash -c "sudo echo disabled > /sys/bus/usb/devices/1-10/power/wakeup & sudo echo disabled > /sys/bus/usb/devices/1-9/power/wakeup"
[Install]
this does the hook to sleep.target
WantedBy=sleep.target
Teested it a couple of times now and it seems to work as expected.

- 101
grep "enabled" /sys/bus/usb/devices/*/power/wakeup
pin point the clue easier :) – VeganEye Jun 03 '20 at 19:28echo "disabled" |sudo -k tee /sys/bus/usb/devices/2-1.2/power/wakeup
as it requires root, also to know about the device we just need to use this commandlsusb |grep 0e8f:0022
(vendor:product) – VeganEye Jun 04 '20 at 01:31