Zram, Zswap, Swap, and Hibernation
Hello!
I have been looking into enabling hibernation. Have discovered that Bazzite uses Zram to do active compression in RAM as swap.
From what I have been reading it should be possible to have both Zram and a traditional swap at the same time, with the Zram taking priority, and then setting up things in grub such that when hibernating the swap is used (for obvious reasons)
I have also heard of a tool called "zram-hibernate" that automates the setup process.
Is there some reason that this is not considered possible with Bazzite? I would really like to use Zram for normal use, then a dedicated swap partition for only hibernate.
75 Replies
EDIT: <answer that didn't solve the problem>
that disables zram
you're so correct
also brings up something called Zswap,
also it would appear that Zram now has a "
config_zram_writeback" command that seems to be what I'm after possibly?Yes this is possible you need setup secondary swap that will be used for hibernation.
but needs to be a partition, not file
Is your pqrtition encrypted?
Using Swap for Additional Memory or Hibernation - Bazzite Documenta...
Bazzite is a custom image built upon Fedora Atomic Desktops that brings the best of Linux gaming to all of your devices.
I'm assuming you mean partition, as in boot? home? no, but it is on the "look into" list, still in my evaluation stages
again, disables zram
Just dont diaable zram as mentioned in guide
Arch wiki state that systemd is smart enough to use swap for hibernation and ignore zram. https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Maintaining_swap_file_for_hibernation_with_zram
so.... I would make a swap (how would I do that as a partition? as the included "disks" does not seem to offer a way to do this)
add it to the FStable, then tell zram to use it as wrightback? do I need to do anything in Grub (ugh)
You can make partition swap or to file. It's up to you.
config_zram_writeback is for something else and not for hibernation
ok so just make the swap and add to fstable?
Yes. You will use zram most of the time. Until it get full which is almost never and swap will be used for hibernation
This does not seem to work, made a swap partition, set it all up, tested a hibernate by simply leaving a few windows open like discord, dolphin, so on, and it did not work.
here is a swapon output on the matter;
so my assumption is that the entire "systemd is smart enough to use swap for hibernation and ignore zram" is not true for Bazzite
my suspicion that it is still using at least in part the zram for hibernation is to blame, opening Brave, it seems to know it was not closed properly last start,
you should check dmesg to see why it failed
ujust logs-last-bootanything in particular I should be searching for since the log is like 3000+ lines....
look for hibernation, you can limit it to only show kernel messages
sudo journalctl --no-hostname -k -b -1similar to these

there are only a few lines that even mention the word;
do one more with
sudo journalctl --no-hostname -k -b -2 this will show boot before thatthis looks like it used the 4GB of the Zram, and the spillover went to the swap partition, and thats why its only like ~1.5 GB
thats what I suspect
can you run
systemctl list-unit-files | grep nvidia your GPU VRAM is not suspending properlythere is also this error
you can probably try to add
resume kernel parameter pointing to your swap partition. I have hibernation to swap file and didn't need to do it
rpm-ostree kargs --append-if-missing="resume=UUID=4209c845-f495-4c43-8a03-5363dd433153" change UUID to your swap partition
restart and try hibernation againNope, still does not wake from hibernation,
But it does seem to be some other issue, even disabled ZRAM as a test and still nope
But I would prefer using a swap partition than a file, especially since eventually I would like to consider encryption,
With that all said, at this point I need to do other stuff, so don’t know when I will be available again
Swap file also does not work, even with zram disabled....
so it would seem as though hibernation is just broken completely...
I’m thinking there is just something wrong with how Bazzite does this… literally following there docs to a T, even on a completely fresh install, does not work…
Spun up a Manjaro install off a USB drive, hibernate works perfectly…
Works on my machine with AMD gpu maybe some nvidia related bug? Do you have same nvidia version of driver on manjaro? Also open/closed driver could make difference.
My Manjaro install uses the closed drivers, it can be changed but, with that said I would have to boot it up again to know the exact version, but as it was just installed I will assume the latest.
Also how would this really be relevant as to my knowledge the NV drivers for Bazzite are baked into the immutable image, and can not be changed by the end user without breaking things.
Don't use a resume parameter
-# oh ya, for got to mention that broke the install, but before messing with any of this I made a disk image with Rescuzilla so.
Do you have any thoughts on why Hibernation is just broken it seems?
What's broken about it
Sometimes it doesn't work because drivers
It does not work at all, can follow the Bazzite doc exactly, but it never successfully wakes from hibernation, even on a completely fresh install of Bazzite
Yes Nvidia you're cooked
Does it wake up forgetting you hibernated?
From what I can tell from logs it tries, but the image saved to the swap is broken, so it falls back to booting normally
The image saved is not broken
The closed drivers are broken
If the image was broken it would scrap it
OK… then why does using the closed driver on Manjaro work fine?
Because this week bazzite has a kernel where hibernation does not work
On your device
And next week Manjaro will have a kernel where hibernation does not work on your device
Ao it’s a temporary bug???
Because randomness because nobody tests hibernation
Especially nvidia
And especially on the closed driver
Try the f43 image
New kernel
Well I kinda need hibernation… I often have to go abroad for work, and just sleeping is not adequate, and need WOL… (MB does not support WOL from shutdown)
But you bought an Nvidia laptop
Desktop,
Built
Why does the desktop need hibernation
Sleep barely works on desktops
For WOL
And for when doing long handbrake encodes it can hibernate to not lose transcoder output information
Also use the open driver
How on Bazzite??? To my knowledge that’s all baked into the immutable image and can not be changed
When you say closed what do you mean
The NV property drivers, VS the open source ones
Are you on the open kernel module?
Arch wiki is wrong
Does your image say open on it
Getting there, (test install on a SSHD, take a little to boot)
bazzite-nvidia-open:stable
Here we go again
SSHD and hibernation?
TEST ENVIRONMENT
It's the correct image
-# though what really sad is Bazzite on an SSHD is often faster than Windows on a gen 4 SSD...
But I digress
it works on my machine i have zram and swap enabled and it hibernate correctly.
That's because you have the resume parameter
I don't have it
Well when I did the testing for that article it didn't work
Unfortunately the DGPU is the only GPU I have, so I cant test it without...
Also as I kinda found earlier, if Zram can a normal swap can not be used, how hard would it be to implement Zswap? I have not looked into it basically at all but it seems to fill a similar role, just uses RAM as a cache for the swap.
Also for either Zswap or a traditional swap, I would think it would be a good idea to make this all into a ujust script? So a simple
ujust enable-hibernation would make a swap based on the RAM in the system, disable Zram, what not.You cannot use zram for hibernation because ram is powered off
I know, I’m talking about Zswap, a different system entirely, does a similar role but must have an attached normal swap as well, when a hibernation is triggered Zswap apparently dumps all it’s ram cache into the swap as one would assume
With that all said, there really shouldn’t be any reason why zram with some logic (that according to multiple sources not just arch) is present should make it so all ram content (including the zram) get dumped to the actual swap.
I will need to spin up that Manjaro install and A. See if it’s already using zram, B. If it’s not if installing/enabling it still allows hibernation to work
Everything I have been reading says that it’s entirely possible to have zram and a normal swap at the same time, and it will (depending on the ago of kernel and low level components) automatically use the swap for hibernation, skipping zram entirely, or by designating the swap that should be used for hibernation (the resume command listed earlier) but it would seem as though the components in Bazzite are not new enough, and the resume (probably do to immutable?) breaks…
P.S. not trying to argue, just really want/need this to work, and it seems to be some bazzite issue
Though the issue at the moment seems to be hibernation AT ALL…
But ya from 4 different sources (including fadora docs) Zram and a normal swap used for hibernation are totally compatible… given the proper swap priorities are set…
- fedora
- Manjaro (also tested works fine first hand)
- CashyOS
- Ubuntu
So this is definitely some Bazzite deficiency…
Same drivers and kernel version on any of them?
Did you install the Nvidia drivers on fedora?
The only one I tested was Manjaro, it’s kernel 6.12 closed NV drivers.
However I did just think of something, it is out of the box X11, wonder if wayland somehow breaks it???
could be
but probably what it is is the kernel
When I have some time I can mess around with stuff, X11 VS wayland, open VS closed NV driver, different kernels…
But with that all said, it is still odd that basic hibernation with zram disabled does not work on Bazzite for me…
(Though would point out that Bazzite is on a more recent kernel? (6.17) So if anything shouldn’t it work better?)
The kernel devs get it right once a yeat
Usually makes it to the lts
The rest of the versions don't hibernate
Well then I cant use Bazzite...
Use manjaro
I'm getting the same issue on a fresh install all AMD rig.
hmm only thing that could affect this I made on my system could be that I edited kernel arguments and fstab to fix systemd-remount-fs.service
GitLab
root mount options from /etc/fstab are not taken into account anymo...
Symptom The systemd-remount-fs.service service fails to start:
I've read it could be be an IOMMU issue but no idea how to debug and trace the offending item to patch out, new to all this.