16

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.

5 Answers5

10

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.

Stefano
  • 121
  • Welcome to Ask Ubuntu and for your interest in this site. While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes or is deleted. – CentaurusA Jun 19 '19 at 19:46
  • Ok, thanks. I modified the answer, I hope it is more useful now. – Stefano Jun 20 '19 at 09:26
  • 1
    Thanks buddy helped me. To just extend it, I wrote a script and placed it in the etc/init.d i.e startup directory. bash -c 'echo "disabled" > /sys/bus/usb/devices/1-1.1/power/wakeup' bash -c 'echo "disabled" > /sys/bus/usb/devices/1-1.2/power/wakeup' – user2688323 Jun 25 '19 at 02:00
  • superb ..helpful..it's working – user2688323 Jul 10 '19 at 03:28
  • 2
    sudo echo "disabled" > /sys/bus/usb/devices/1-7/power/wakeup bash: /sys/bus/usb/devices/1-7/power/wakeup: Permission denied and when i open the file it says [ Error writing lock file /sys/bus/usb/devices/1-7/power/.wakeup.swp: Permission denied ] – vipul petkar Sep 24 '21 at 09:31
2

This is just a summary of Stefan's answer, in the form of runnable code.

Maybe someone could provide a more readable version; the awk part is hideous.

#!/bin/bash
for file in /sys/bus/usb/devices/*/power/wakeup
do
    [ $(cat $file) = "enabled" ] || continue
device=${file%/power/wakeup}
vendor=$(cat $device/idVendor) || continue
product=$(cat $device/idProduct) || continue
verror="### name for vendor '$vendor' not found ###"
perror="### name for product '$product' not found ###"

curl -s http://www.linux-usb.org/usb.ids -o - | awk '
    /^'$vendor' / { e=$0; print ""; print; next }
    /^[^[:space:]]/ { if (e) { print "'"$perror"'"; exit } }
    /^[[:space:]]+'$product'/ { if (e) print $0; exit }
    END { if (!e) print "'"$verror"'" }
'
read -p "Disable wakeup by this device? [y|N] " yn
case "${yn:-n}" in
    [yY]) echo "disabled" > $file ;;
esac

done

AimoE
  • 81
1

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?

zx485
  • 2,426
ADz
  • 11
1

I can not post a comment to the last answer by ADz but the exact opposite worked for me.

I had this problem where after hitting suspend, the system would shut down the screen for a second, turn off wifi and bluetooth and then do nothing. After 30 seconds it would go back to normal.

Per ADz's instructions, I intended to enable Automatic screen lock and I discovered it was already on. Then, I disabled it and lo and behold that did it. It now sleeps instantly as normal.

Settings -> Privacy -> Screen Lock -> DISABLE Automatic Screen Lock

My system is an HP Envy 13 that always had some issue on sleeping but after a kernel upgrade stopped going into sleep altogether.

Denvy
  • 11
0

Using Ubuntu 20.04.1 LTS, I installed dconf editor and changed this to false:

/org/mate/desktop/lockdown/disable-lock-screen