Kubuntu won't wake up from sleep after long period

when the machine normally goes to sleep everything seems normal, i’m able to wake it from a USB device and i’m back at the lock screen almost instantly.

however if enough time passes, say overnite, sometimes it will not wake from sleep via USB (no power) and the only way to wake it is with a hard reset by holding down the power button… stranger still is when it reboots it puts me back at the lock screen rather than the login screen… so clearly hibernation to disk is working.

having to do this repeatedly has led to a destroyed CMOS chip that could only be repaired by a lengthy RMA process.

i want to correct this behavior

system details

Operating System: Kubuntu 24.10
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.6.2
Kernel Version: 6.11.0-13-generic (64-bit)
Graphics Platform: X11
Processors: 28 × Intel® Core™ i7-14700K
Memory: 62.6 GiB of RAM
Graphics Processor: AMD Radeon RX 6800
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7D27
System Version: 1.0

i have the power settings page configured as shown

i also get a false result from both of these queries

qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement CanSuspendThenHibernate
qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement CanHibernate

which makes me think my motherboard does not support hibernation, but it clearly does hibernate to disk as i noted above in the description.

the /etc/systemd/sleep.conf file shows the following situation, note the sequence of commands for SuspendState

[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#MemorySleepMode=
#HibernateDelaySec=
#SuspendEstimationSec=60min

when i query cat /sys/power/state, i get the following result

freeze mem disk

which does not match up with the compile time defaults

should this be a concern?
should i change sleep.conf to conform?

if so what is the best way to do that?

The same is happening for me, waking from “hibernate after sleep” fails with kernel 6.11 and kernel 6.12, but it works with 6.6.

i may have made some progress, at least last nite it woke up via USB as it should.

my supported states according to cat /sys/power/state are

freeze mem disk

but freeze seems to be what is giving me difficulty since my firmware does not seem to support S2idle or standby mode.

i modified /etc/systemd/sleep.conf like so

[Sleep]
AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
AllowHybridSleep=no
SuspendState=mem disk
HibernateMode=platform shutdown
MemorySleepMode=deep
HibernateDelaySec=60
#SuspendEstimationSec=60min

so that my system will suspend but it does so by going directly to deep (which is suspend to RAM).

removing the failing freeze string seems to work

also i’ve made these other changes prior to this which may also be required, so i will note them here for completeness

#this file also needs to have the defaults changed to enable hibernate
/var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

[Disable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
#ResultActive=no  # commented this line
ResultActive=yes  # and replaced with this line

[Disable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
#ResultActive=no  # commented this line
ResultActive=yes  # and replaced with this line

# also important that the kernel knows where to find the stored image on disk so add this to grub
GRUB_CMDLINE_LINUX="resume=UUID=[redacted]"

# then be sure to rebuild everything to its up to date
sudo update-grub
sudo update-initramfs -k all -c

I have the same/similar problem with freshly installed MX-Linux 23.5 with KDE.

Like yourself - the only solution (so far) seems to be to disable Power Management (Screen Energy Saving and Suspend Session)
see: MX fails to wake up after being suspended - MX Linux Forum

Similar problems are reported here:
https://forums.debian.net/viewtopic.php?t=160588

stable so far with the changes i’ve made, all long overnite sleep times have woken via USB as expected.

i’m thinking i have found the solution, but i don’t want to jinx it .

planning to back out all of the hibernate changes i’ve made since according to the output my my machine does not support it and see if the [deep] state is doing yeoman’s work here.

further testing has shown that /etc/systemd/sleep.conf must have this setting in the config

AllowHibernation=yes

and you must have the kernel parameter set up in grub so it knows where to look.

but the changes to polkit do not seem to be required.

however now i’m suspecting that when my machine goes to sleep it only does mem and deep as the ram LED are still on… i would like to use the full hibernate feature but plasma does not seem to want to go there.

so i would need to run the additional command of
sudo systemctl hibernate
after some time asleep for it to shut everything off.

there is a command line window in the power settings but adding that command there does not seem to do anything.

my sleep.conf (un-changed so far) looks as follows:

[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=
#SuspendEstimationSec=60min

interestingly, I have another PC with the same OS and KDE
both Screen Energy Saving and Suspend session are On
and work perfectly OK

and… sleep.conf is exactly identical

so maybe?? sleep.conf is a red herring?

and the issue is with hardware?

the config file does nothing until you uncomment the lines… those are the as complied defaults.

to use different values you need to either uncomment and modify this file or create a .d directory and use that… i’m choosing to just modify this file because it’s easier.

the values here are used by plasma and systemd to determine the suspend, and hibernate methods and options available to the user.

freeze is one method of suspend that locks up my system hard, but mem coupled with the [deep] option to suspend to RAM is fine and hibernate is fine.

i can run sudo systemctl suspend and it will suspend to RAM leaving only the RAM modules with power, everything else is off and it will resume from that state via USB

i can run sudo systemctl hibernate and it will hibernate to DISK leaving nothing on and it will resume from that state via USB

i can run sudo systemctl suspend-then-hibernate and it will go thru all the motions, following the timer delay of 60s, where it wakes back up momentarily in order to write to disk and then shut off

when i resume from hibernation, it’s as tho i’m rebooting from scratch until it gets to the splash screen where it says it is resuming from disk and when it comes up i see brief glimpse of my desktop and then the lock screen

when i unlock it, everything is exactly where i left it…including the unfinished text in this very window that i’m typing in right now.

so it’s not the hardware and it’s not the kernel, it’s plasma that’s not letting me do the hibernation at all, and before i’ removed the “freeze” string it was not reliably resuming from suspend.

@skyfishgoo
thank you for detailed (and helpful) explanation

what confuses me is that I have two PCs (both with identical distro and KDE version)
one behaves perfectly OK as far hibernation/suspension and waking up from it is concerned
the other has exactly the same symptoms as you describe (black screen on waking and just cursor… nothing works)

The only difference between two PCs is hardware,
so maybe I am missing something?

that’s something else, i don’t get a black screen with a cursor… that sounds like you need to delete “splash” from the kernel call in grub

my machine would not respond at all … literally frozen.

a hard reset was the only option and even that stopped working right before the machine refused to even POST… i had to RMA the motherboard for a new CMOS chip.

i don’t know if they were related, but it started freezing in suspend again after the service, so that’s why i dug into this.

removing the “freeze” string so it is never written has worked to prevent it freezing in the suspend state… i think freeze and mem [deep] do not get along.

this is my currently working config


[Sleep]
AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
AllowHybridSleep=no
SuspendState=mem disk
HibernateMode=platform shutdown
HibernateState=disk
MemorySleepMode=deep
HibernateDelaySec=60
#SuspendEstimationSec=60min

Yes, you case sounds a bit more serious than mine :slight_smile:
even though the only way I could get things going was by “holding power down”
I will watch your thread with interest and thank you for your suggestions

the solution seems to be two fold with the first one being solved and the second part still open

two separate bug reports have been filed

https://bugs.kde.org/show_bug.cgi?id=499089
and
https://bugs.kde.org/show_bug.cgi?id=499105

first, solving the title issue involved editing the /etc/systemd/sleep.conf to look like this:

[Sleep]
AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
AllowHybridSleep=no
SuspendState=mem disk
HibernateMode=platform shutdown
MemorySleepMode=deep
HibernateDelaySec=60
#SuspendEstimationSec=60min

notice the “freeze” and “standby” strings have been omitted entirely because they are apparently not supported by the firmware.

hybrid sleep is not allowed because my preference would be suspend-then-hibernate, and i will likely increase the delay significantly if i can get it to work from the power management settings

which brings me to the second part… plasma does not seem to be providing the support for systemd that it should since it doesn’t seem to think my machine can hibernate at all even tho it can if i run the systemctl commands in a terminal

plasma will do the suspend part and write everything to RAM but it will not do the hibernate part in spite of turning these things on in sleep.conf, and use of the command line feature in power management has so far been fruitless… i will likely make another post about this part.

UPDATE: the problem seems to be that plasma’s power management suspend feature is different than systemctl suspend

when i use “do nothing” as the option for plasma suspend and add my own script that runs systemctl suspend everything works as expected.

details of the workaround can be found here

1 Like

i figure i should amend this post with my workaround for completeness

there still seems to be something wrong with plasma 6.1, and i will revisit this again if the upgrade to 25.04 does not improve the situation, but basically having to abandon plasma’s suspend feature and resort my own scripts for systemctl is not a user friendly solution.

see edits to the SOLUTION post above.