Skip to main content
Topic: Cannot hibernate if ram is used (Read 707 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Cannot hibernate if ram is used

I am now using Hyprland on my desktop.
I am trying the nouveau drivers for my (nvidia) card.

I have trouble when hibernating if there is some ram used it fails:
Code: [Select]
echo disk > /sys/power/state
bash: echo: write error: Cannot allocate memory

I have a 20gb swap file that was working fine,  when I was using bspwm (xorg) with the proprietary driver.
Sometimes when resuming it is stuck and I have to unplug the power, if there was some ram usage when I hibernated.

I searched the error and I found this https://forums.gentoo.org/viewtopic-t-1134165-start-0.html.
Indeed I cannot hibernate if ram is above 50% it seems.
I have only 4gb of ram so I can't have much opened.

Is normal that I need 50% of ram free?

Re: Cannot hibernate if ram is used

Reply #1
Try this
Code: [Select]
echo platform > /sys/power/disk
echo disk > /sys/power/state

Re: Cannot hibernate if ram is used

Reply #2
Code: [Select]
echo platform > /sys/power/disk
echo disk > /sys/power/state
bash: echo: write error: Cannot allocate memory
(No output for the first command).


Re: Cannot hibernate if ram is used

Reply #4
From the above Gentoo link:
Quote
Documentation/power/pci.rst:   
The freezing of devices is carried out after enough memory has been freed (at
the time of this writing the image creation requires at least 50% of system RAM
to be free) in the following three phases:

I can hibernate with only "echo disk > /sys/power/state" when I have enough ram free.

Is it possible to write the image directly to the disk instead of pre-creating it in ram?
I didn't have this problem before.

Re: Cannot hibernate if ram is used

Reply #5
Try dropping all caches before attempting to hibernate; if it fails again, there's something rotten:
Code: [Select]
# echo 3 >| /proc/sys/vm/drop_caches

Re: Cannot hibernate if ram is used

Reply #6
It still fails "Cannot allocate memory" if there is some ram used.

Re: Cannot hibernate if ram is used

Reply #7
Try older kernels. If it worked before got to be a kernel change that broke it. As the command you are using is talking to it directly.

Re: Cannot hibernate if ram is used

Reply #8
I tried "6.1.12-artix1-1", same allocation error.

Is it possible that the change from nvidia to nouveau is preventing me to hibernate?

Re: Cannot hibernate if ram is used

Reply #9
Is it possible that the change from nvidia to nouveau is preventing me to hibernate?
Possibly. In my limited experience video drivers have caused problems coming back from suspend/hibernation not going into it. But I wouldn't rule it out without testing it.
It would still be kernel related in a way as both drivers have kernel modules.

If you are able swap back. try it, see what happens.
You are probably gonna solve it by trial and error or one day , after an update, it just starts working again.

If it did work what have you changed since ? It has to be one of, or a combination of, those things.
And as I said it has to be low level as the command you use is low level.

Re: Cannot hibernate if ram is used

Reply #10
I was holding back the kernel and then I was missing the nvidia modules after rebooting.
So I tried the nouveau.

I updated the kernel and I installed the nvidia package.
The problem persist.

Re: Cannot hibernate if ram is used

Reply #11
I was holding back the kernel and then I was missing the nvidia modules after rebooting.
nvidia-dkms is what you want. The nvidia driver is tied to a specific kernel with each version. nvidia-dkms isn't.


 

Re: Cannot hibernate if ram is used

Reply #12
Before when I installed nvidia it didn't "activate" it as the first time.
I was still using nouveau.

I installed nvidia-dkms, blacklisted nouveau and enabled the nvidia-uvm module.
And I am back on X11, I can hibernate fine.