Ubuntu – What do I do about a machine that is running out of memory and crashing

freezeswap

My spouse is running Ubuntu 18.04 on a Thinkpad X1 that has been crashing a lot. Usually he's got a bunch of tabs open but nothing that should crash a relatively powerful laptop.

The machine freezes and the only solution is a power cycle because it is otherwise unresponsive.

I am used to being able to get to another TTY to troubleshoot with ctrl-alt-F3 but that doesn't seem to work on his machine.

One oddity, when I run top it reports zero swap:

KiB Swap: 0 total, 0 free, 0 used

That can't be right, but free confirms it:

amanda@Flatbush:~$ sudo free -h
              total        used        free      shared  buff/cache   available
Mem:           7.7G        5.4G        164M        1.5G        2.1G        516M
Swap:            0B          0B          0B

By contrast, my machine is a few years older than his and works fine. There, free shows:

amanda@mona:~$ sudo free -h
              total        used        free      shared  buff/cache   available
Mem:           7.7G        1.2G        5.1G        237M        1.3G        5.9G
Swap:          7.8G          0B        7.8G

The good machine has way more memory and way more available swap (though to be fair I just fired it up to compare and don't have anything running on it).

I suspect that the issue is connected to the differences in memory but I don't know how to go about fixing it. s

Best Answer

The description and the free output suggest that the system may be crashing when it runs out of RAM, and swap is not enabled. (Browser tabs can sometimes consume a staggering amount of resources)

One easy solution:

  • Add a swap file if there is not an existing swap partition/swapfile.
  • Activate swap using swapon
  • Tell him that when the system gets sluggish it's time to close a few tabs.
  • If the system remains sluggish with all tabs closed, bring it to you in the sluggish state.
Related Question