My PC is running Ubuntu 22.04, with KDE Plasma 5.24. When I select Sleep from the Application Launcher, it always starts t go to sleep, but then it seems like a 50-50 chance that it will stay asleep. Many times, it wakes right back up again within 10 seconds. If I try to make it sleep two or more times, sometimes it will eventually sleep but not always.

I’ve done some searching and cannot find a resolution to this.

It seems I’m not the only one too - https://superuser.com/questions/1795451/kde-plasma-does-not-sleep

  1. Is there a sure-fire way to tell Ubuntu KDE to sleep?

  2. If not, what are some things which might wake it up again?

Thanks!

  • perishthethought@lemm.eeOP
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 months ago

    Soooooooooo… thank you so much. I finally had time for trying out solutions here and your link to askubuntu helped me solve this. Specifically, the answer from Ali Hoza is what I tried first and it seems to work very well. I am copying that answer here for anyone else at Lemmy to try.


    The above solution (https://askubuntu.com/a/265389/1467620) works, but it is crude and, also it disables the keyboard wake, which is actually useful.

    A more granular alternative can be this: First, we start by enumerating the USB devices connected to the system:

    lsusb | sort
    

    from here, it’s pretty obvious which one is the mouse:

    Bus 002 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver

    then we proceed with finding where the devices are mapped to:

    grep enabled /sys/bus/usb/devices/*/power/wakeup
    

    /sys/bus/usb/devices/2-1.2.6/power/wakeup:enabled /sys/bus/usb/devices/2-1.2.7/power/wakeup:enabled

    Finally, to figure out which is which, we use:

    dmesg | grep Logitech | grep -o -P "usb.+?\s"
    

    usb 2-1.2.7:

    at which point it’s pretty obvious which one needs to be disabled:

    sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.2.7/power/wakeup"
    

    note: every time you need to echo as superuser, sh -c is necessary, or the system will not allow redirecting to a priviliged file.

    Then it’s just a matter of suspending the system and verifying that, while the mouse does not wake it, the keyboard will.

    this does not survive a system reboot, so either you need to re-run the last command, or add it to your .bashrc or .zshrc.

    This is something that has been annoying me on Ubuntu since when I installed 16.04, and probably there forever, I cannot understand why Canonical wouldn’t add this in the System Settings.

    Source: https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/