17
  • I've just installed Ubuntu 22.04 on my laptop with 8GB ram (no dual boot, ext4 + 20GB linux swap);
  • Installed 2 gnome shell extensions (Dash to panel, Workspace Matrix);
  • My working environment is just vs code, webpack dev server, and chrome;
  • During the active development something dies ~ every 10 minutes. Could not find any error logs, it looks like app is closed (in case of webpack dev server the terminal window is closed). If it's chrome - no chrome processes left.
  • For now, it did not happen with the active app - only background ones die. It's like you save a code, switch to the browser - and there's no browser, or you inspect something in devtools, switch to vs code - and there's no vs code.

What should be the first step investigating this? Where to look for any logs/crash reports?

4
  • 2
    Have you checked your systemd journals (journalctl) for systemd-oomd closing processes down due to them using excessive memory.. You can disable systemd-oomd. See askubuntu.com/questions/1404888/… if this is the issue
    – guiverc
    May 16, 2022 at 6:38
  • 1
    Thank you, systemd-oomd closed the apps, I managed to turn off the service with "systemctl disable --now systemd-oomd"
    – Kasheftin
    May 16, 2022 at 7:19
  • 1
    Does this answer your question? How do I disable the systemd OOM process killer in Ubuntu 22.04?
    – guiverc
    May 16, 2022 at 7:25
  • Yes. But something else is wrong with ubuntu 22. I see many process clones, it was not that many before. When I turn off systemd-oomd, system sometimes goes to unresponsive state with no other option except hard reset. I had to downgrade to ubuntu 20.
    – Kasheftin
    May 17, 2022 at 8:04

2 Answers 2

18

I had the same problem, and it turned out that systemd-oomd (a userspace out-of-memory (OOM) killer) was killing my applications whenever I was running low on swap space.

As suggested by @guiverc, you can run the following command to see if it is the case for you as well:

journalctl -u systemd-oomd

Example output:

mai 09 07:03:25 caterpillar systemd[1]: Starting Userspace Out-Of-Memory (OOM) Killer...
mai 09 07:03:26 caterpillar systemd[1]: Started Userspace Out-Of-Memory (OOM) Killer.
mai 09 14:05:24 caterpillar systemd-oomd[573]: Killed /user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox.d00df170-f05e-4de1-a1c8-4c1d53664dc1.scope due to memory used (7277371392) / to>
mai 10 10:32:34 caterpillar systemd-oomd[573]: Killed /user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox.4fad3166-da1d-4084-8a67-8a2ddfe4ab68.scope due to memory used (7352815616) / to>

Two options:

  1. Disable systemd-oomd:

    systemctl disable --now systemd-oomd
    

    For more information: How do I disable the systemd OOM process killer in Ubuntu 22.04?

  2. Increase swap size (recommended).

7
  • 1
    In my case creating/increasing swap is a must. If I recall correctly, previously the default ubuntu setup created ext4 + linux swap partition, but this time ubuntu 22 installation did not created a swap partition. Without swap and systemd-oomd system constantly goes to unresponsive state.
    – Kasheftin
    May 23, 2022 at 12:11
  • Hey. I'm facing the same issue. I had first allocated 4gb to swap partition but some apps were still crashing. Then I increased it to 16gb, and the OS got a little bit slow, so I decreased it to 8gb and the crash is still happening. Is it something like allocating a high swap partition makes the OS slow?
    – s.khan
    Jun 22, 2022 at 13:54
  • @s.khan if the system is actually using a lot of swap, that means that it has to transfer data between memory and hard disk all the time, which will make the system slow. The system decides to swap when it doesn't have enough memory, so it shouldn't be using tons of swap space unless it needs more space (or [swappiness(askubuntu.com/a/103916/1083397) is set very high). Since apps crash with less swap, it seems that you actually need all that memory/swap space. Your options are to install more RAM or use less memory overall (don't open so many programs/tabs, etc).
    – Esther
    Jun 22, 2022 at 21:10
  • 1
    In my case, I increased swap to 2*RAM (8Gb RAM, swap 165Gb) and everything ok, during thу all day Jun 29, 2022 at 7:31
  • 1
    Human beings are lazy creatures. If option #2 is the recommended approach as specified, then I recommend it's listed before the other option, so that people who choose the first option they see try it first. Jul 7, 2022 at 18:12
0

apparently the systemctl disable --now systemd-oomd does not persist on reboot, so we need to do:

sudo systemctl mask systemd-oomd.service

source: https://youtu.be/XotltmuFUyU?t=794

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.