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.

3
  • what options have you configured in the BIOS of your motherboard?
    – tatsu
    Jun 17, 2019 at 13:14
  • 1
    i dont think i made any changes related to this since my first installation of ubuntu 18.x Jun 19, 2019 at 15:21
  • what I mean is do you have options like "wake up from network" enabled?
    – tatsu
    Jun 20, 2019 at 6:04

5 Answers 5

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.

5
  • 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, 2019 at 19:46
  • Ok, thanks. I modified the answer, I hope it is more useful now.
    – Stefano
    Jun 20, 2019 at 9: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' Jun 25, 2019 at 2:00
  • superb ..helpful..it's working Jul 10, 2019 at 3: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 ] Sep 24, 2021 at 9: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
2
  • I keep getting access denied on it. any idea how I can use sudo here?
    – warmwhisky
    Sep 16, 2022 at 7:29
  • I used su -i in Ubuntu 22.04 to switch over to root and it worked great
    – warmwhisky
    Sep 16, 2022 at 9:30
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?

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.

0

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

/org/mate/desktop/lockdown/disable-lock-screen
3
  • You're using Ubuntu Mate, not the standard Ubuntu, and you should install all updates ASAP. Mar 6, 2022 at 14:14
  • I am using gnome, @ChanganAuto Mar 8, 2022 at 6:52
  • I see sub-folders like gmone, mate, and yorba in the org folder, but the above change worked for me - @ChanganAuto Mar 8, 2022 at 7:04

You must log in to answer this question.

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