I have a fairly new Ubuntu 24.04.1 LTS installation on my ThinkPad T490.
Sometime during Sleep my Ubuntu seems to want to hibernate. I usually come back from lunch to see my laptop has powered down with all the work on my RAM, lost.
systemctl hibernate confirmed my suspisions that the system cannot recover from hibernation. If I have debugged this correctly (see the first screenshot), my installation doesn’t have the swap file configured correctly. This has happened on many Ubuntu flavors before on this machine.
Am I understanding this right? The short-term solution, which I can do, would be to configure my swap correctly. Long-term would be to find out why this happens on a fresh Ubuntu installation so that others wouldn’t be affected.
I don’t have any data from the journal indicating a hibernation attempt during suspend since I don’t know the exact duration from suspend to hibernation, i.e. I cannot force the original issue organically right now.
Forcing hibernation gives me the same results though so I figured I would tackle the hibernation problem instead of looking for a problem on why suspend powers my laptop down at some point.
I was assuming you would have had recent logs. No problem.
Are you able to trigger it with either systemctl hybrid-sleep or systemctl suspend-then-hibernate?
Neither systemctl hybrid-sleep nor systemctl suspend-then-hibernate seems to trigger it. They seem to enter suspend state gracefully and journalctl -r didn’t show anything seemingly interesting to me.
I was always under the impression that Ubuntu switched ‘off’ the ability to hibernate because it was unreliable. That’s why there’s no option in the Ubuntu desktop UI to immediately trigger a hibernation.
However, perhaps the hybrid suspend options in modern laptops bypass that, by waking the system and triggering the hibernate. I don’t know enough about this, sorry. I did stumble on the Arch Linux Wiki page Suspend and hibernate, which seems pretty good.
I quite fancy trying this on my ThinkPad Z13 to see if it works. I take it you literally just unplug your laptop and wait for the battery to drain down?
Haha nice insight on the reason for Ubuntu not having Hibernate GUI option anymore!
You’re right, it could be that my ThinkPad triggers hibernation automatically when left for a longer time on suspension. It’s good to note here that my battery level is fine (above 50%) when these poweroffs happen. IIRC they happen even when on AC.
Do you think it could be possible that based on my 2 screenshots from before, Ubuntu has been unable to configure swap properly during installation?
Hibernation is disabled. Linux itself is incompatible with Secure Boot (I don’t know why), hence why Ubuntu has specifically disabled it.
It’s possible to get hibernation to work without Secure Boot, but it’s been many years since I did that, and so I no longer know how to do so.
If you don’t care about Secure Boot (though I think that you should care), you can disable it, and find instructions on how to enable hibernation. However, I can’t promise that it will work.
The best solution is for Linux to be fixed to allow for hibernation, but I don’t see that happening any time soon.
The next-best is to set your computer to sleep (suspend) instead of hibernate. That works correctly, but of course power loss will cause you to lose your session.
I haven’t kept any links. According to what I’ve read, there are security problems with hibernation, and Linus Torvalds refused to apply the patch to the kernel (reason unknown to me). It’s probably easy enough to find references.
I have managed to make hibernation work over the years, but inconsistently, only with Secure Boot disabled. However, I’ve had no luck whatsoever with Secure Boot enabled.
The last time I succeeded (Secure Boot disabled, of course) was, if I correctly remember, with 16.04.
to see if my ThinkPad would be so kind as to not force Ubuntu to hibernate during suspend since it’s not supported (and leads to poweroff instead when failing).
If Ubuntu doesn’t support hibernate, then why does
to see if my ThinkPad would be so kind as to not force Ubuntu to hibernate during suspend since it’s not supported (and leads to poweroff instead when failing).
You should be able to change what it does in the Settings.
why does … show as loaded instead of masked?
I don’t know. Perhaps that’s the default setting in Linux? BTW, you don’t need sudo when you’re merely querying the status.
Not trying to blow anything here out of the water but I’ve seen this before.
Only on Windows though.
I’ve never experienced it here on *buntu.
Here’s what I do.
I make sure both hybernate and sleep are disabled.
I don’t just assume they are disabled by default, even if they actually are disabled.
I check anyway.
Help’s prevent this data loss.
If there are things that on-lookers don’t need to see,
set a password for a screensaver and reduce the time the screensaver activates.
Then I reconfigure the swap file.
I don’t use a swap partition.
IMO, swap partition is useless.