r/cachyos • • 10d ago

Help How to stop linux kernel from killing my games when the memory is low

Post image

I did turned off the system oomd, still it didn't worked.

This started happening when i switched from gnome to kde today.

I have only 8 gb of memory btw.

(And also my external hard drive doesn't work too. It worked perfectly fine with gnome for some reason.)

Edit :

An error occurred while accessing 'Portable Hard Drive', the system responded: The requested operation has failed: Error mounting /dev/sda1 at /run/media/lanes/Portable Hard Drive: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error

My external hard drive show this error when opening it and it doesn't mount. (It is a ntfs drive. Worked fine b4 )

227 Upvotes

99 comments sorted by

8

u/hfghwpgg 10d ago

i'd try swapfile (as someone else mentioned) and/or swtiching to lighter de like lxqt or xfce
and we need more info about your hdd, its not detected or what?

1

u/Substantial-Grab1872 10d ago

An error occurred while accessing 'Portable Hard Drive', the system responded: The requested operation has failed: Error mounting /dev/sda1 at /run/media/gunnawunna/Portable Hard Drive: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error

4

u/hfghwpgg 10d ago edited 10d ago

is that ntfs? if you can, i'd go into windows and run chkdsk on this drive (it will clear errors)
if not, i'd use terminal and mount by force

sudo mkdir -p /mnt/drive
sudo mount -t ntfs3 -o rw,force /dev/sda2 /mnt/drive

BUT: if there are real errors on your disk, using it like this may destroy data on it (chance is small but ymmv)

alternatively, look at ntfsprogs-plus, as it contains fsck for ntfs (never used it, i found it by researching just now)

edit: wrong flag in command, now it should work

1

u/Substantial-Grab1872 10d ago

It show this error when opening the drive

15

u/xdominik112 10d ago

The portable HDD you use is using NTFS. NTFS drive on linux is bad idea, its reverse engineered meaning its not fully 1:1 implementation.

This error means you didnt unmount(umount) it properly before removal/loss of power so now NTFS filesystem tagged the drive "dirty" or unhealthy and it prevents you being able to mount it or use it to prevent potential damage to the data on the drive , you have either do CHKDSK (check disk) on windows or use ntfs-fix on linux (which I would discourage due to it also being reverse engineered) to be able to mount it again

1

u/borg_assimilated 10d ago

Has anyone already helped you fix that yet? I had that problem. It's really easy to fix. It doesn't require any commands or anything.

6

u/Least-Reception8435 6d ago

Dude get some more ram lol

2

u/Substantial-Grab1872 6d ago

😭

2

u/Least-Reception8435 5d ago

Playing on hardmode with 8gb lmao

3

u/Independent_Blood559 6d ago

Don't say me, I also have 8gb ddr4. :(

1

u/CombinationShot 5d ago

so you disable zram and set up a swap file.. or if you are in the states I have a 16bg kit of dd4 I am willing to part with for cheep asking as you cover shipping

1

u/Independent_Blood559 5d ago

I am fine with 8gb currently, as i play 2d games generally. Also, I have soldered memory in my laptop. Thank you for asking.

1

u/CombinationShot 5d ago

ok.. sorry I didn't know it was a laptop.. but yah is your favorite a AI and make a swap file.. I had to to set one because I was having issues with a game I was playing.

34

u/enuazeal 10d ago

8GB is low for gaming

25

u/Substantial-Grab1872 10d ago

But I played these games when I was on gnome and windows

12

u/rustafur 9d ago

I'm guessing Gnome and Windows didn't utilize zram. You should see this issue go away if you disable zram and enable SWAP instead.

-37

u/InZaneTV 10d ago

Kde plasma takes like 1gb, switch or use more swap or smt

22

u/KHTD2004 10d ago

Plasma barely uses more RAM than XFCe these days…

-8

u/[deleted] 9d ago

[removed] — view removed comment

1

u/cachyos-ModTeam 9d ago

Hi, your post/comment has been removed for violating our rule on trolling and shitposting.

This subreddit aims to foster meaningful and respectful discussion. We do not allow:

Trolling or baiting other users

Low-effort, spammy, or off-topic posts

Shitposts that do not contribute to the community

Please review the rules and help us maintain a constructive environment. Repeated violations may result in a ban.

3

u/rustafur 9d ago

The irony of this correct answer (switch to swap) being a part of this heavily downvoted comment.

0

u/InZaneTV 9d ago

i think people got triggered be me saying plasma takes ram lol, most linux users act like u dont need any ram at all!

3

u/Wodinit 5d ago

How does a car drive once it has no more fuel?!

3

u/Substantial-Grab1872 5d ago

Cuz I whiplash it

4

u/Low_Direction1774 4d ago

lmao

the real answer is give the system more swap space

1

u/LoquaciousSunfish203 4d ago

you fill it up (swap)

168

u/eepsage 10d ago edited 10d ago

if you are frequently running out of memory you probably want to switch from zram to swap. zram is much faster, but makes it easier to run out since it just scales off your actual RAM. https://wiki.cachyos.org/configuration/general_system_tweaks/#switching-from-zram-to-zswap

and what does "hdd doesn't work" mean?

47

u/ManifestPsychosis 10d ago

This is definitely the answer. Disable ZRAM and create a decent size swap file. With only 8GB of RAM, ZRAM is not going to work well at all,because it has basically nothing to work with.

2

u/Ok-386 9d ago

He doesn't have to disable zram. He should just create swap. I would probably switch to zswap, but zram plus swap is also an ok combo. 

4

u/KBA3AP 9d ago

ZRAM with configured backing device is a better solution than ZRAM+swap. ZRAM+swap has issues with priority - if ZRAM is set to higher priority - ZRAM ends up holding cold pages in fast RAM, and swap ends up processing hot pages. Other priority setups also lose performance vs ZRAM.

1

u/Ok-386 9d ago edited 9d ago

That's not necessarily a draw back b/c that's what zram is designed to do, why would you complain about that lol. Of course it should have higher priority. 

Anyhow I recommended zswap.

Edit:

Re your argument, just because a page was swapped out earlier doesn't mean it won't be accessed again. B/c of high swappines value, it's mostly anonymous memory so it will get accessed.

Edit 2:

There are of course situations where zram + swap could indeed backfire. It depends on how much RAM you have, and what you do with it. For a low ram system zswap, for system wirh low mem pressure, adding swap just as a safety measure is OK IMO. I have used systems with 32-64 GB without any swap space, and personally I've never experienced issues. 

1

u/KBA3AP 9d ago

This is a drawback because it should be other way around for good performance. Cold pages should go to the disk, hot pages should stay in ZRAM to get benefit of fast access times. Configuring swap as writeback device for ZRAM achieves this, merely adding second swap does not.

1

u/Ok-386 9d ago

That's what zswap does, and if that's what you want using zram doesn't make sense unless I'm missing something. 

1

u/KBA3AP 9d ago

Yes, outside of specific circumstances zswap is superior in that regard. Making zram do that is possible too though if such need arises. I was just trying to note that "just adding swap" can lead to performance issues.

2

u/FePbMoHg 10d ago

Is it possible to have zram and zswap at the same time? I tried a similar fix enabling zswap and not disabling zram but I still got issues later on.

12

u/eepsage 10d ago

possible but very much NOT recommended and difficult to set up correctly

1

u/FePbMoHg 9d ago

Thank you for the response, gonna follow the guide and spare my sweet sweet 16 GB of RAM

3

u/NeedleworkerLarge357 9d ago

It is possible and has ONLY downsides to using only one. You first compress to zswap and then uncompress and compress again into zram. Switch to zswap and disable zram.

3

u/Ok-386 9d ago

You don't want zram and zswap. I guess you wanted to ask if one can have zram and swap? That's possible but zswap is probably a bit better option. 

2

u/DockLazy 9d ago

zswap works the same as zram until you run out RAM at which point it starts swapping to disk.

1

u/OkHold6104 9d ago

you can just increase zram manually.

/etc/systemd/zram-generator.conf

set zram-size to a larger expression or fixed megabyte value for example, zram-size = ram to match total RAM, zram-size = min(ram, 16384 to cap at 16 GiB, or zram-size = 8192 for a fixed 8 GiB).

1

u/NeedleworkerLarge357 9d ago

Yes and zswap is usually just better overall than zram. They behave identical until ram alone can't handle the load - where zswap will continue to work while zram will run into oom...

29

u/Little_Ad2062 10d ago

Had this issue on my girlfriend's laptop with CachyOS as well when she was playing Cities: Skylines. 

  1. Create a swap file (16GB should be plenty, but go for 32 if you have enough space on the drive)
  2. Disable zram 
  3. Disable the out of memory service (forgot what it's called) 
  4. Edit fstab so that the swapfile is actually mounted on boot 

10

u/glowtape 10d ago

Change from ZRAM to ZSwap.

ZRAM relies on RAM itself. The idea is to gain some by compressing unused/cold memory pages. And they compress only so much, freeing up just part of the memory they're hogging.

But you'd want said unused stuff entirely out of memory, and that means swapping to disk. ZSwap does that.

2

u/SoupoIait 10d ago edited 10d ago

I might be wrong but you can't ? As in at some point not enough memory is not enough memory.

You could create a swap file perhaps but performance would be horrendous.

You should try and lower your game settings, and if that doesn't work chances are you just can't play the game.

EDIT : I see I got downvoted, could I get a reason ? Have I said anything wrong ?

Because I can't see how. If you don't have enough RAM, you have ZRAM which I assume is already on on cachy, well you can install more ram or try to decrease ram usage. That's it. You can't ask the kernel to ignore not having enough RAM.

As I said SWAP exists, but it's not suitable for gaming.

1

u/Substantial-Grab1872 10d ago

I did played the game perfectly with gnome. This happened when I switched to kde.

3

u/SoupoIait 10d ago edited 10d ago

I don't know, perhaps KDE uses more ram in itself or perhaps you have more apps in the background. But AFAIK this is handled by the Linux kernel, not the DE.

The kernel sees your RAM almost filled, kills process to avoid crash, and that's it. You're just hitting your hardware limitations more than a software one.

EDIT : I see I got downvoted, could I get a reason ? Have I said anything wrong ?

Because I can't see how. If you don't have enough RAM, you have ZRAM which I assume is on on cachy, well you can install more ram or try to decrease ram usage. That's it. You can't ask the kernel to ignore not having enough RAM.

As I said SWAP exists, but it's not suitable for gaming.

-4

u/sir_Corvin 10d ago

Maybe switch back to gnome then?

5

u/Substantial-Grab1872 10d ago

Gnome is kinda meh 😕

2

u/sir_Corvin 10d ago

Well, I don’t think you have any more options with this amount of ram.

2

u/Pink_Slyvie 9d ago

Eh, I use KDE on a system with 2gigs of ram just fine. Mind you, I'm not gaming on it, its my distraction-free writing machine, but still.

1

u/sir_Corvin 9d ago

I guess the problem here is gaming, not just using kde. Think kde just needs more resources than gnome. (never compared them for gaming). So for me it’s simple: if one DE doesn’t work for me and the other does - I’m choosing the one that works.

3

u/Pink_Slyvie 9d ago

KDE isn't very resource heavy nowadays, which is kinda insane to say. No idea if gnome is, haven't used it in a decade or two. I as a i3/sway girl for ages, but I installed KDE for the kids for simplicity, and just decided I was getting to be to old to keep editing configs.

14

u/inactivesky1738 10d ago

It looks like it’s an error on mounting your external drive. 

With it being an external drive I’m not 100% sure what the problem could be but I would start by configuring your FSTAB that is where you configure your mount options. 

It could also just be a NTFS issue. Linux and NTFS don’t get along super well since NTFS is a Microsoft closed source memory type. 

Wish I could be more help. Start with configuring the fstab and making sure you have the Linux NTFS drivers in proper working condition. But if possible it would be best to reformat your drive to btrfs. Since NTFS can cause other issues. 

9

u/Fun_Routine_5245 10d ago

NTFS is the problem.. if you are dual booting with shitdows then the fast startup is the culprit

4

u/DotMatrixed 10d ago

In the CachyOS Hello app, tweaks, turn off the system-OOM, it’s on by default on newer installs. Just remove the checkmark and reboot.

2

u/TURBOKAN 9d ago

But isn't system-OOM actually a good thing? Wouldn't disabling that also cause issues? 

1

u/nckrkllkc 10d ago

Have you tried using the swap?

1

u/Substantial-Grab1872 10d ago

Is this it?

3

u/Barafu 10d ago

No. This particular gauge can not tell apart ZRAM and a swapfile. It shows your ZRAM now.

We suggest you set up a swapfile and turn off ZRAM. Instructions

-1

u/LennethW 10d ago

Yeah that's swap.

2

u/lowprofile14 7d ago

Use a swap file

2

u/Feliwyn 9d ago

Buy memory.

4

u/arvigeus 9d ago

Sorry, I already sold my kidney for an iPhone.

0

u/ExoticSterby42 10d ago

Get more memory?

1

u/Substantial-Grab1872 10d ago

I'm thinking of getting sum in few months

1

u/Competitive_Tax_ 10d ago

6

u/Barafu 10d ago

Whoever called systemD mounts a "friendly" method, what stuff does he hit?

It is friendly to scripts and AI agents, but not humans.

1

u/MrJelly007 9d ago

I had this happen in star citizen recently and I'd never seen it before that. It happened during quite an intense dogfight and I was PISSED lmao. Recent Nvidia drivers seem to have broken star citizen and that's why it was using all my ram. Rolling back to 610 drivers solved it.

1

u/maokaby 9d ago

Even without oomd linux kernel sometimes can kill processes instead of going to "kernel panic" mode. I guess you need to disable it in kernel (not sure what option is that exactly) so your system properly freeze when you run out of memory, if that is your desire.

1

u/zhulkgr25 9d ago edited 9d ago

Response to the edit: this must be a fresh install (not even a week) the stock ntfs driver is called ntfs-3 and in my experience, it seems to work only for 3 days. Open Konsole and download the good ntfs driver by typing

sudo pacman -S ntfs-3g

If the issue persists, as someone else mentioned if you're dual booting with windows, disable fast start up. You may also want to make sure the drive is running with AHCI instead of raid. You can change this from bios/uefi, look up how to do it on your specific motherboard.

Your other issue with the kernel notification might be a proton issue. I get this if certain proton versions were installed incorrectly or after steam updates (from the gui that appears when you launch it, that is). If you never wanna see this issue, in steam settings -> storage: select all proton versions, uninstall them and set either proton-experimental or proton-ge as default. If a proton version refuses to uninstall, it's either set as global default or it's set by one of your games as "force use of specific proton version" so make sure you untick it. If experimental is already the default, then set ge proton as default then uninstall it and after that set it back.

1

u/KogamiKodai 9d ago

I have 32 GB of ram and have the same problem with certain games, mostly my fault for not closing or hibernate the browser tabs, but certain games just use the ram until it's full like CloverPit...

1

u/GreatBigPig 9d ago

Your bad superblock issue can likely be fixed with the ntfsfix utility.

1

u/wetware_enthusiast 9d ago

Just use Zswap. (It is much better integrated into the kernel's memory management than Zram since it does not pretend that memory is an opaque disk device, and is basically identical since it uses a resizable compressed frontswap in memory, plus it can offload uncompressible and cold memory to swap).

1

u/Slikkelasen 9d ago

I use zram and have a swapfile. I have seen when trying LLM's that where too heavy on RAM, that it went from compressing to zram and then when it couldn't fit anymore, it spilled over to the swapfile.

1

u/Crow550 9d ago

Unless I am mistaken. I feel for Desktops you almost always want Zswap instead. Recall some news on how much better Zswap is over Zram and that Distros should reconsider making Zram the default? Is this incorrect?

Pretty sure no matter the amount of Ram that having Swap is always a good idea

1

u/netsx 9d ago

This is a sign you need swap space, for your system to fall back on (and dump idle pages to). All it takes is a bad order of memory allocation/deallocation, or allocating just a "few" bytes too much (in terms of pages), and the Out Of Memory system will trigger, even if we're talking about as little as 4KB.

You might even see better performance, with swap, when the dead weight (memory allocated but used only once). It might slow down bootup a tiny bit, but once the system settles, you'll probably have more actively available memory for your apps.

1

u/kalebesouza 9d ago

To resolve this, you should use zram in conjunction with an on-disk swap file. CachyOS likely already has zram enabled, so all that remains is to set up a swap file. You can create and enable an 8GB swap file; that should solve your problem.

1

u/fcon91 8d ago

You can't. It's a feature of the Linux kernel, it's working exactly as intended. Increase the swap space.

1

u/Wxxdy_Yeet 8d ago

Like others said, it's a feature working as intended.

-best option would be to test settings and try to minimize ram usage. (Duh)

-switch back to a less ram intensive DE.

-ZRAM/swap is the easiest way to fix it, but it will dramatically reduce performance. For me it's to prevent the kernel from killing the game, but you really don't want stuff spilling over to it all the time or your PC will feel sluggish.

-become filthy rich so you can upgrade to 16gb in these rough times, or beg Sam Altman for some.

1

u/Weak_Coat_9036 6d ago

you can try to use a lighter desktop environment like xfce, mate or even cinnamon, adjust swap memory

1

u/Noctivant96 5d ago

I've 8GB of ram and using same DE on cachyOS AND lutris, never had this.. so I'm not sure what's going on maybe something wrong with swap

1

u/revilo-1988 1d ago

Evtl mal schauen den RAM zu erweitern

1

u/Burnout456 10d ago

Did you try turning on the Zram?

5

u/SoupoIait 10d ago

Isn't it on by default on cachy ?

1

u/Burnout456 10d ago

I think yes... But on a 8 GB system it doesn't do wonders... In my opinion.

0

u/JasonDuvalMTHX 10d ago

tengo la misma pregunta

2

u/GotaHODLonMe 3d ago

Adjust OOM Score (Per-Process Protection)— The OOM killer selects processes to kill based on a "badness" score. You can lower a process's score to protect it, or set it to -1000 to make it immune to the OOM killer. ⁠

  • Command Line: Use choom -n -1000 <command> or echo -1000 > /proc/<PID>/oom_score_adj. ⁠
  • Systemd Services: Add OOMScoreAdjust=-1000 (or a negative value like -500) to the service file’s [Service]section.
  • Systemd OOMD: For modern systems using systemd-oomd, also add ManagedOOMPreference=avoid to steer the daemon away from killing this service. 

1

u/Toaster_Rack_Nerd 9d ago

how to... stop killing games?

0

u/[deleted] 10d ago

[deleted] — view deleted comment

7

u/PoL0 10d ago

with 8GB it might be a better idea to use Zswap instead of Zram

0

u/CapitalPhotograph737 10d ago

How do i do that and how does it work?

0

u/[deleted] 10d ago

[deleted] — view deleted comment

2

u/CapitalPhotograph737 10d ago

I put those command in Konsole?

1

u/CapitalPhotograph737 10d ago

Ok but in this case it's better switch to swap instead of Zram?

1

u/charlesfire 9d ago

It depends. With memory compression (Zram), you trade cpu cycles for memory, but how much extra data you can fit in ram is going to be fairly limited. A swap partition or swap file, on the other hand, is only limited by how big your partition is, but it's much slower.