Suspend not working in Ubuntu 18.04 and 19.04

When I tried to suspend by holding mouse on shutdown icon, it goes to suspend for 2 secs and comes to back to previous state again. Though I upgraded to 19.04 Ubuntu, issue still appears.


Solution 1:

In my case, I solved using the procedure explained here: Ubuntu 18.04.2 immediately wakes up from suspend.

Practically there is a device that has the ability to wake up the computer.
In my case it was the Bluetooth and WiFi card.

Using these two commands (when the computer is not connected to the dock) you can see if there is a device with that ability and which device it is:

$ cat /sys/bus/usb/devices/*/power/wakeup

$ ll /sys/bus/usb/devices/*/power/wakeup

The first command gives you a list of enabled and disabled that corresponds to the devices listed by the second command.

Then you can investigate which device is using

$ cat /sys/bus/usb/devices/1-4/idVendor
$ cat /sys/bus/usb/devices/1-4/idProduct

(You need to replace 1-4 with the concerned device).

In this way you will get two codes idVendor (in my case 8087) and idProduct (in my case 0025) that you can google to see what it is.

At the end you can disable it with:

# echo "disabled" >  /sys/bus/usb/devices/1-4/power/wakeup

I hope that can help you too.

Solution 2:

Fix in my case (Ubuntu 19.10) was to enable Automatic screen lock in:

Settings -> Privacy -> Screen Lock

Without Automatic screen lock ON, the system would suspend/shutdown for few seconds, and then it would wake up (power up) into an unknown state - unusable.

I am not sure if this is a feature, or a bug?