Ubuntu 18.04.2 immediately wakes up from suspend
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.
Solution 1:
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.
Solution 2:
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