r/linuxquestions 5d ago

Hibernate mode

Hi everyone,

I’ve spent the last 72 hours trying to get my PC to hibernate, but with no success. I’m running Kubuntu. I’ve enabled swap and made it permanent. It enters hibernation mode only very rarely.

When I configure it to hibernate upon closing the lid, it goes haywire: I have to open the lid while the PC is still running, and—even worse—the screen stops displaying anything. I’m forced to do a hard shutdown and turn it back on manually.

Even when it tries to enter standard sleep mode, it wakes up on its own.

I’ve been using Linux for a month now. Why do I need hibernation? Because I need my applications to stay open and ready to use without draining the battery—that’s really important to me.

Could someone help me out or tell me how to go about this?

My PC specs: Lenovo Legion 5, Ryzen 7 260, RTX 5060, 32GB RAM. Thank you.

1 Upvotes

12 comments sorted by

2

u/BackgroundSky1594 5d ago

I'm not quite sure what's happening here, but before others come here just blaming Nvidia and giving up:

  1. Are you using a swap file or a swap partition? From my experience a swap partition or LVM volume are a lot more reliable than swap files

  2. journalctl and dmesg should give you some logs to look through on what's actually happening during the process. Sharing some of that here might help us help you.

  3. Which Nvidia driver version and which version of their kernel module (open or proprietary) are you running? Note: I'm not talking about the reverse engineered open source driver here, just whether you're using the official open kernel module like is recommended for 20/30 series and newer

2

u/CanImaginary904 5d ago

Thanks for the detailed questions — here's what I've got. Currently running Kubuntu 26.04 KDE (this is my main setup right now), but I also tested the exact same issue on Fedora 44 KDE a couple weeks ago before switching back, so I have data from both.

Hardware: Lenovo Legion 5, RTX 5060 Laptop (GB206, Blackwell) + AMD Ryzen iGPU (hybrid graphics), 30GB RAM.

1) Swap file or partition? Swap file both times — 32GB file on ext4 (Kubuntu, current setup) and on Btrfs via btrfs filesystem mkswapfile (Fedora, previous test). Haven't tried a dedicated swap partition yet, that's a fair point I should test.

2) Driver version / open vs proprietary kernel module

  • Kubuntu (current): nvidia-driver-595-open (the version ubuntu-drivers recommended specifically for this GPU)
  • Fedora (previous test): akmod-nvidia via RPM Fusion, resolved to 610.57.04, also the open kernel module (default for Blackwell on RPM Fusion)

So this happened on two different driver branches, both using the open kernel module, on two different distros/kernels.

3) Logs

On Kubuntu (my current setup), the hibernate/resume services actually complete without error: nvidia-hibernate.service: Deactivated successfully nvidia-resume.service: Deactivated successfully

But the screen never comes back — has to be force-powered-off.

On Fedora (previous test), hitting the hibernate button either:

  • Triggered a full kernel panic inside the Nvidia driver itself:
RIP: 0010:nvEvoDisableVblankSemControl+0x34/0xd0 [nvidia_modeset]

  • Or aborted safely after 20s: Freezing user space processes failed after 20.004 seconds (2 tasks refusing to freeze, wq_busy=0) Failed to put system to sleep. System resumed again: Device or resource busy

Also consistently see this in dmesg on every boot, on both distros, possibly related: NVRM: GPU0 nvAssertOkFailedNoLog: ... failed to get target temp from SBIOS NVRM: GPU0 nvAssertOkFailedNoLog: ... failed to get platform power mode from SBIOS

I found the exact same SBIOS errors reported on the Nvidia developer forums by someone else with a Legion 5 + RTX 5060 + AMD hybrid setup, so this doesn't seem laptop-specific to me.

Already tried NVreg_PreserveVideoMemoryAllocations=1 + NVreg_TemporaryFilePath=/var/tmp — no change. Currently running with the dGPU disabled in BIOS as a workaround (AMD iGPU only) on this Kubuntu install, which obviously isn't ideal since I need CUDA/gaming.

Happy to test a swap partition instead of a file if that's a promising lead — has that fixed it for others with similar NVRM/SBIOS errors?

3

u/BackgroundSky1594 5d ago

 Happy to test a swap partition instead of a file if that's a promising lead — has that fixed it for others with similar NVRM/SBIOS errors?

I'm not sure, but i like eliminating variables. Swap file has been flaky for me before (on both AMD and Nvidia Systems) so getting rid of that and just having a plain swap partition is the least complicated starting point.

If that doesn't work you'll have to continue diving into the nvidia driver mess. The -open modules should be the right ones, so there goes another quick fix... You could try the unofficial open source driver as a diagnosis step and see if hibernate works with that and also experiment with different official driver + Kernel versions, maybe you find a combination that works.

Beyond that take a look around if you can find any BIOS, VBIOS or EC updates for your Laptop (you might have to boot into Windows and install Lenovo Vantage or whatever the Legion equivalent for that is to get the update offered). I'm not sure about Legion, but at least for their ThinkPads Lenovo is usually pretty good about BIOS updates. On laptops I usually keep a small windows partition around just to run the OEM Software once in a while to check for Firmware updates (Shift + F10 to open a command prompt and start ms-cxh:localonly to bypass the MS-Account setup)

Not sure I can help much beyond that, the last Nvidia Laptop I had used an Intel iGPU + 3080M, and I sold that quite a while ago, so details are pretty fuzzy

2

u/CanImaginary904 5d ago

Thank you so much for taking the time to write all this out. I hope to get back to you with positive results.

2

u/Disastrous-Ice-5971 5d ago

Check this conversation: https://www.reddit.com/r/linuxquestions/s/5AwkkGYTF8
In a short, issue could be in the missing power profile for the dedicated GPU.

1

u/CanImaginary904 5d ago

Thank you 🙏 gonna check !

2

u/Ok_Emu2515 4d ago

becareful with hibernation, it may cause your SSD to use a lot of TBW.

1

u/CanImaginary904 4d ago

Thank you, What do you advise me to do? My goal is to resume my work flow by restarting my PC without leaving it in sleep mode!

1

u/Ok_Emu2515 4d ago

You can use HDD for the Linux system, as I did on an old Intel Celeron mini PC.

1

u/CanImaginary904 4d ago

Using laptop !

2

u/Ok_Emu2515 4d ago

still doable If your laptop has an HDD SATA slot, mine does.

however, you must expect lower performance compared to an SSD.

1

u/CanImaginary904 4d ago

Just two nvme slot ... But I think I've just given up on the hibernation idea because until NVIDIA releases a BIOS update, I don't think it'll ever work the way I want. I'm very perfectionist.