26
submitted 8 months ago by perishthethought@lemm.ee to c/linux@lemmy.ml

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!

top 16 comments
sorted by: hot top controversial new old
[-] randomlemmyid@sopuli.xyz 5 points 8 months ago

I've had that same problem. Thought I was the only one. It almost seems like some event interrupts the process of going to sleep. I've tried being really careful not to move the mouse after I've selected sleep from the menu. Also, I make sure to turn off my Bluetooth headphones prior to selecting sleep. Seems to help but I may just be imagining it all.

[-] perishthethought@lemm.ee 2 points 8 months ago* (last edited 8 months ago)

Ok, let's compare notes - I have nvidia, using the nvidia provided driver, asus m'board, amd ryzen 5 CPU. I run with KDE on X11.

I have a bluetooth dongle I use for my headset too and right, sometimes it seems to help to remove that before sleeping.

I wish there was a "I really want you to go to sleep no matter what option", like to have the PC ignore whatever signals it's getting that make it wake up again.

Not relevant, but I have this same problem on a Windows laptop rn too. I have no idea why that's happening either.

[-] ABeeinSpace@lemmy.world 3 points 8 months ago

Make sure power management is properly configured on the Nvidia card.

I had this exact issue on an MSI motherboard. What ended up being the fix for me was changing the “Wake Up Event By” toggle in my UEFI. It was set to “BIOS”. Changing it to “OS” immediately fixed all the issues I was having with suspend

[-] perishthethought@lemm.ee 2 points 8 months ago

Oh nice - thanks, will check it out.

[-] ABeeinSpace@lemmy.world 2 points 8 months ago

Of course. I troubleshot a similar issue for a while. Finally found the toggle in BIOS and felt a bit dumb

[-] dandroid@sh.itjust.works 2 points 8 months ago

m'board tips fedora

[-] undrwater@lemmy.world 1 points 8 months ago

Which Nvidia device? The 970 is currently problematic.

[-] perishthethought@lemm.ee 1 points 8 months ago
[-] undrwater@lemmy.world 1 points 8 months ago

Ok, similar to mine. I'm not on Ubuntu though.

[-] carcus@lemmy.ml 2 points 8 months ago* (last edited 8 months ago)

Depending on what method of suspend you are employing, it could be due to lack of sufficient swap space. That’s a common problem.

[-] e0qdk@reddthat.com 2 points 8 months ago

I don't know about KDE in particular, but I've had problems with USB mice waking various Ubuntu systems when they're not directly connected (i.e. there's a hub or KVM in between it and the computer). The workaround I used for that was to remove the mouse input (e.g. by carefully pressing a physical button on the KVM) -- which was good enough for me -- but I think there is a programmatic way to block particular classes of input from waking the system if some device is waking your system inappropriately.

Doing a quick search turned up this: https://askubuntu.com/questions/252743/how-do-i-prevent-mouse-movement-from-waking-up-a-suspended-computer -- I can't vouch for any of the specific techniques there though.

Worth noting that while I had a problem with the mouse specifically, other hardware could be causing your system to wake up.

[-] perishthethought@lemm.ee 2 points 8 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/

[-] scrooge101@lemmy.ml 1 points 8 months ago

You could try to change the sleep state from s2idle to deep. Not sure how to do this on Kubuntu though.

[-] Bell@lemmy.world 1 points 8 months ago

I have this problem too. Kubuntu 22.04. The PC will sleep and then randomly I'll see that it's awake again. One theory I have is that KDE connect events on my phone are waking it?

[-] perishthethought@lemm.ee 2 points 8 months ago

Oh snap! I AM using kdeconnect but never thought of that. I'll check that out, thanks!

[-] avidamoeba@lemmy.ca 1 points 8 months ago* (last edited 8 months ago)

Check the logs around that time. journalctl is your friend. Meticulously walk over the events from beginning to enter sleep to the wakeup. See where it stops sleeping and what event precedes it.

this post was submitted on 06 Mar 2024
26 points (86.1% liked)

Linux

48152 readers
791 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS