Bug 31895

Summary: Hybrid sleep fails to resume from sleep (but not from hibernation) (suspend and hibernation works separately)
Product: Mageia Reporter: Morgan Leijström <fri>
Component: RPM PackagesAssignee: Kernel and Drivers maintainers <kernel>
Status: NEW --- QA Contact:
Severity: major    
Priority: Normal CC: brtians1, ghibomgx, kde, kernel
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
See Also: https://bugs.mageia.org/show_bug.cgi?id=32157
Whiteboard:
Source RPM: CVE:
Status comment:
Attachments: Xfce Platform - journalctl

Description Morgan Leijström 2023-05-07 16:06:55 CEST
Description of problem: Session is lost

Version-Release number of selected component (if applicable):
Kernel 6.3.1-desktop-1.mga9
Nvidia470.182.03
systemsettings-5.27.4.1-1
...i.e a Current updated install of Cauldron with Plasma, Gnome, Xfce and some apps.  Only testing Plasma so fas as it is my main DE.



How reproducible: always per below

MB: AsRock P55 Pro
CPU: i7-870
GPU: GTX750, elder revision, using nvidia470

DM=LightDM
DE=Plasma

Encrypted install: 
 /, swap, /home in LVM whose pv is LUKS encrypted,
 /boot in a separate physical partition.
Note that hibernation-resume do work with this;
after Grub, i enter LUKS key, then it loads image, then I am at login.


Steps to Reproduce:
1. First make sure both suspend-resume and hibernate-suspend works separately.
  (if not, see/create another bug for that)
  I tested both sleep modes both by timeout and by desktop lauch menu.
2. In Plasma settings; ($ LC_ALL=C systemsettings5 )
  Power Management > Energy Saving > [X] Suspend session, Hybrid sleep, 1 minute, Apply 
3. Wait a minute... screen go black, it saves, powers off (i.e all fans stop), power lamp start blinking.
4. hit a key: power lamp continous, fans on..... but screen remain black.  No response to ctrl-alt-backspace,backspace or del,del. no response to pressing power button for 2 seconds... have to press reset or cycle power.
5. next boot is *not* restoring from saved image, and fsck runs.
Which I interprete as it in 4) did wake up enough to somehow invalidate it... 

If instead of 4), cut power, wait, apply power and start, it works: after Grub, i enter LUKS key, then it loads image, I login to a restored desktop.  So the hibernation part works.

And suspend-resume by itself works.

It is just that resuming from suspend fail in hybrid mode, plus it then somehow invalidates the hibernation save.


Setting this as major, because session is lost, including unsaved work.
Morgan Leijström 2023-05-07 16:07:32 CEST

CC: (none) => kde, kernel

Morgan Leijström 2023-05-07 23:48:32 CEST

Keywords: (none) => FOR_ERRATA9

Comment 1 Lewis Smith 2023-05-08 20:56:31 CEST
Thanks for the report. Can you clarify (to help describe the exact problem you found, the terminology is confusing) what is meant by:
- sleep
- hibernation
- suspend
- hybrid sleep [is there a hybrid hibernation?]

I see 'suspend & 'hibernate' in other desktops. Is this a Plasma specific issue? You say you have other desktops to play with.

CC: (none) => lewyssmith

Comment 2 Morgan Leijström 2023-05-08 21:14:34 CEST
Yes, things are called different by different applications etc... then add translations...  ;-)

sleep = suspend: save to RAM, which keeps powered but all else except keyboard shut off, power lamp blinking.

hibernation: save to swap, power off. At next boot after grub and eventual LUKS, it restores, then go to DM login.

hybrid: yes there is such selection in Plasma settings.
The idea is that it works like suspend, but also save to swap so if power gets cut / battery runs out, system gets restored like from hibernation. 


The specific issue with Plasma is that hybrid is selectable but broken.
(Should be renamed hybris instead :^)   ;-)  ) 

IIRC I last tested hybrid working OK with Xfce with one laptop (forgot which one... using mga8, should try on mga9 :)

So much sofware, and even more hardware in shop, soo little time to play...
Comment 3 Lewis Smith 2023-05-08 21:38:10 CEST
Thanks.
* sleep|suspend is only effective while power is maintained, resuming from RAM on wake-up; most systems powered off, but not the box itself.
* hibernation (to swap) saves system to swap for restoration at next power on, then powers off - completely?
* hybrid is both, but not shutting down the box; and looks like it should resume from RAM if power has not been lost, from swap if it has [reboot implied].

> Power Management > Energy Saving > [X] Suspend session, Hybrid sleep,
> 1 minute, Apply 
> 3. Wait a minute... screen go black, it saves, powers off (i.e all fans stop),
> power lamp start blinking.
> 4. hit a key: power lamp continuous, fans on..... but screen remain black
Step 3 is ambiguous. If the power light blinks, surely the box is still powered. Would you expect it to resume from RAM on wake-up?
Comment 4 Morgan Leijström 2023-05-08 21:58:10 CEST
(In reply to Lewis Smith from comment #3)

> * hibernation (to swap) saves system to swap for restoration at next power
> on, then powers off - completely?

Basically. Modern desktop supplies as well as laptops have standby power to some parts of main board and ports so they can be wake up by hitting a key, or serial port or special network communication.

Not very different from suspend, with the difference that in suspend also RAM is powered (but probably at lower voltage) and the system know how to continue rather than boot.


> > 3. Wait a minute... screen go black, it saves, powers off (i.e all fans stop), power lamp start blinking.

> Step 3 is ambiguous. If the power light blinks, surely the box is still
> powered.

Only standby power is on, in suspend mode powering RAM and some I/O incl ports and keyboard.  In full shut down, including when hibernated, RAM is not powered, and power lamp is off (but 5V standby from power supply is still on and some main board have an onboard LED to show it) 

Desktop power supplies have a small 5V "standby" output always on, and a signal from mainboard to power supply enables the main power supply which deliver main 5V and other voltages.
Then power converters and switches main board an also act to divert power.
Even more complicated in laptops where there is battery management...
Comment 5 Lewis Smith 2023-05-10 20:46:26 CEST
Once again, thank you Morgan for your elaborate explanations.
LxQt at least (& probably other desktops) offer just Suspend|Hibernate, so this looks like a Plasma special [too clever].

Assigning accordingly.

CC: lewyssmith => (none)
Assignee: bugsquad => kde

Comment 6 Morgan Leijström 2023-05-11 20:56:47 CEST
I now tested with xfce, same there, suspend and hibernation works, but if i at logout dialogue select hybrid and later wake it up it just start and screen remain black, and it is not reacting on sctl-alt-2xbackspace/del.

So it is not plasma. 

That probably implies kernel/driver


Side note:
Xfce offers hybrid as button but not by timeout, plasma vice versa.

Gnome only offers suspend, not hibernation. Strange. I am not used to Gnome so i may miss somewhere needing to be enabled.

Assignee: kde => kernel

Comment 7 Brian Rockwell 2023-05-12 14:49:25 CEST
Created attachment 13831 [details]
Xfce Platform - journalctl

The suspend sleep is around 7:3x in journal.  Might be helpful.

This AMD APU on a laptop.  Xfce desktop.

Hope it helps.
Brian

CC: (none) => brtians1

Comment 8 Giuseppe Ghibò 2023-05-12 15:05:12 CEST
I did some attempts, core i7 intel skylake.

Clean cauldron installation with kernel 6.3.2-2.mga9 and latest mesa-23.1.0-2.mga9. resume partition big enough to contain the whole available ram plus a tiny swap space and with a few GB of margins.

1st attempt: hibernation from Plasma menu fails: it tries to hibernate, then after a few seconds it goes back to login screen like if you were awakening (keyboard, mouse, etc. were not touched).

2nd attempt: sleep from Plasma menu fails. same as hibernation, i.e. back to login screen after a few seconds.

3rd attempt: sleep now freezes. Mouse pointer on screen totally frozen, and had to force power down the machine manually.

4th attempt: sleep freezes. There is no mouse pointer, just black screen. Had to force power down the machine.

5th attempt: after reboot sleep/resume worked once, but "hibernation" is no longer available in the Plasma Power/Session menu (I haven't changed anything in the Plasma configuration, where is gone?).

6th attempt: installed kernel 5.15.110-2.mga8 (from mga8, it just requires extra lib64openssl1.1-1.1.1t-mga8 from mga8). sleep/resume worked. hibernation couldn't test because it's disappeared from Plasma Power/Session menus.

7th attempt: same other tests with kernel-6.1.27-2. sleep/resume worked. Hibernation couldn't test because item still missed from Plasma Power/Session menus.

CC: (none) => ghibomgx

Comment 9 Morgan Leijström 2023-06-21 09:17:22 CEST
Hibernation on linux seem to be known to be a mess

Too complicated for errata.

What we could do is point to a comprehensive help site or similar.
Any tip welcome.

For now, removing FOR_ERRATA9

Keywords: FOR_ERRATA9 => (none)

Lewis Smith 2023-08-05 21:12:21 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=32157

Comment 10 Morgan Leijström 2024-01-29 10:04:29 CET
Some kind of status update on my systems:

Suspend:
Works on all my laptops.
On my P55 main board with nvidia GTX750, resume from suspend fail to make picture on my monitor unless i power cycle the monitor, when kernel desktop or server is used with nvidia driver. Workarounds 1) manually power cycle monitor after resume, 2) use linus kernel, 3) use nouveau (slow) or modesetting (decent).

Hibernate:
Latest kernels solves earlier fail of hibernation on Asus Aspire 7.
Also works on Dell Precision M6300
But kernel panics on Lenovo Thinkpad T510

May try hybrid after 6.6.x is released.