this post was submitted on 04 Jun 2024
16 points (83.3% liked)

Linux

48220 readers
713 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

So here's my situation:

I'm on Fedora 40 on a laptop and I've recently decided to add a Hibernate option to my own logout/powermenu script that I use. The script executes systemctl hibernate but there's a problem. It didn't seem to work. When I ran the above command in terminal, I got an error stating that there's not enough suitable swap space for that. Turns out that I'm using swap-to-zram hence why Hibernate doesn't work.

So, I decided to ask ChatGPT and it recommended creating a swapfile. I can do that no problem.

The thing is, if I'm using swap-to-zram, I concluded it is likely that if I'm making use of that swap-to-zram all the time, I will probably need a larger swapfile for the hibernation.

So I asked our AI overlords if there's a risk in that. It said there isn't any real risk, other than increased drive wear-and-tear and potential performance issues.

Dear Linux users of Lemmy, are there any issues or concerns I should be aware of before attempting something like this (running multiple types of swap simultaneously, excess swapfile space, etc.)? Thank you.

Edit: Not sure how relevant it is, seeing as I'm not asking about swap partitions, but I'll mention using BTRFS, just in case. And no, I don't know anything about it, I just know it has cool features I'm yet to start learning about.

top 8 comments
sorted by: hot top controversial new old
[–] we_avoid_temptation@lemmy.zip 28 points 5 months ago (1 children)

Can I suggest reading documentation instead of asking LLM's that are routinely known to just make shit up?

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate says it's possible with a swap file as the backing device but that swap to zram isn't supported. I haven't personally tried it though.

[–] theshatterstone54@feddit.uk 3 points 5 months ago

So it IS possible, as I already found out. If the Arch wiki isn't saying things like "doing this can break your system" then it's fine by me.

[–] dingdongitsabear@lemmy.ml 5 points 5 months ago* (last edited 5 months ago)

you need a swap file, a swap subvolume, or a swap partition that's RAM + 50%, on account of zram. then you need systemd scripts that disable zram and enable swap on suspend and do the reverse on resume. also, you need some selinux tuning to allow you to write to said file. you have a detailed howto in Fedora Magazine.

stop using bullshitgpt.

edit: here's the article.

[–] bjoern_tantau@swg-empire.de 3 points 5 months ago (1 children)

I mean, the swap file just has to be large enough to accommodate your system RAM. Everything in zram is already in system RAM, just compressed.

[–] theshatterstone54@feddit.uk 1 points 5 months ago (1 children)

Okay, my concern was that if I have, say 1.4G in zram, that would unpack to, say, 2G, which, when added to 7G, would go over the 8G limit. I was worried that RAM might be saved in its uncompressed manner, when saved in the swapfile for hibernation.

[–] gnuhaut@lemmy.ml 1 points 5 months ago

I think the hibernation image is compressed by default (all of it). Also, some of what is in your RAM is just files from disk. I think those don't need to be saved into the hibernation image, since they're already on disk. For example, libc.so.6 would definitely be in RAM and in use, but it's also on disk, so no need to save it during hibernate.

So the hibernation image should be substantially smaller than your used RAM.

[–] boredsquirrel@slrpnk.net 1 points 5 months ago

Ask on discussion.fedoraproject.org, there are many people doing similar things

[–] HarriPotero@lemmy.world 1 points 5 months ago* (last edited 5 months ago)

I'd only use zram if I had no swap device/file.

In my experience zswap performs better, and doesn't get in the way of hibernation. In fact, most distros enable it by default today, and it doesn't always work so great with zram.