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.
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.
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.
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
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.
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.
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.
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?
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.