Tracking down failure to wake from sleep

UPDATE: work around successful (at least during the day time)

UPDATE2: works at nite too… using systemctl suspend in the script and leaving int in the (S3) overnite produced no issues.

WORKAROUND:

set plasma power management to “do nothing” and instead after a period of time run a script to operate systemctl controls

systemctl requires the sudo privilege escalation but also requires a password, which is difficult and unwise to include in a bash script.

instead, used sudo visudo to add a line at the end of the file

[username] [pcname]=(ALL:ALL) NOPASSWD: /usr/bin/systemctl

which allows me [username] on my PC [pcname] to impersonate all users and all groups and to use systemctl without it asking for a password

you can check the settings were applied correctly by using sudo -ll

then i just made script in bash
heyy.sh

#!/bin/bash
sudo systemctl suspend-then-hibernate

note: it’s important for the script to be on your $PATH and set as executable…i created a ~/bin for scripts and kubuntu will automatically add that to the path for me when i log in.

and made sure the /etc/systemd/sleep.conf settings are correct for my hardware

AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
AllowHybridSleep=no
SuspendState=mem
HibernateState=disk
SuspendMode=suspend platform
HibernateMode=platform shutdown
MemorySleepMode=deep
HibernateDelaySec=2h
#SuspendEstimationSec=60min

and now my script will put the machine to sleep (suspend to RAM) and 2hrs later it will wake up momentarily to save everything to disk for the nite (S4).

the only variable left is will this actually work over nite since that seems to be the time it all goes tits up.

i would write a bug report detailing this but my previous bug report on plasma 6.1 was shot down due it not being “officially supported”, so it’s not fixed when 6.2 hits the development track then i will revisit.

1 Like