0

My ubuntu 20.04.2 machine is constantly crashing whenever I use more than a small amount of RAM. If I for example have a Jupyter notebook open in chrome and do some CPU intensive computation the whole system will often freeze completely so I can't even move the mouse. I can "fix it" using Alt-sysrq-f but this is really not ideal.

It seems it might be the OOM killer that is causing the problem. What are the standard settings (swapiness etc) for a 16GB linux box so I can just copy them and see if that fixes things? It is currently driving me crazy.

free -h
              total        used        free      shared  buff/cache   available
Mem:           13Gi       3.0Gi       7.9Gi       119Mi       2.8Gi        10Gi
Swap:         2.0Gi          0B       2.0Gi


sysctl vm.swappiness
vm.swappiness = 10


grep -i swap /etc/fstab
/swapfile                                 none            swap    sw              0       0


ls -la /usr/share/gnome-shell/extensions/
total 20
drwxr-xr-x 5 root root 4096 Apr 23  2020 .
drwxr-xr-x 7 root root 4096 Mar 26 09:01 ..
drwxr-xr-x 2 root root 4096 Aug 14  2020 desktop-icons@csoriano
drwxr-xr-x 3 root root 4096 Dec 17 09:28 [email protected]
drwxr-xr-x 3 root root 4096 Nov 24 12:06 [email protected]


ls -la /var/crash
total 66968
drwxrwsrwt  2 root     whoopsie     4096 Mar 31 18:51 .
drwxr-xr-x 14 root     root         4096 Apr 23  2020 ..
-rw-r-----  1 user     whoopsie 68556347 Mar 31 18:51 _usr_share_teams_teams.1000.crash
-rw-r--r--  1 user     whoopsie        0 Mar 31 18:51 _usr_share_teams_teams.1000.upload
-rw-------  1 whoopsie whoopsie       37 Mar 31 18:51 _usr_share_teams_teams.1000.uploaded

Output of top

top - 16:55:35 up 1 min,  1 user,  load average: 2.35, 0.79, 0.28
Tasks: 364 total,   3 running, 361 sleeping,   0 stopped,   0 zombie
%Cpu(s):  5.4 us,  1.1 sy,  0.0 ni, 90.9 id,  2.1 wa,  0.0 hi,  0.5 si,  0.0 st
MiB Mem :  13939.7 total,   9030.9 free,   2293.8 used,   2615.0 buff/cache
MiB Swap:   4096.0 total,   4096.0 free,      0.0 used.  11294.8 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND  
   4035 user      20   0 6268860 205524 110728 S  24.2   1.4   0:05.56 skypefo+ 
   3579 user      20   0  826360 233764 152592 S   5.3   1.6   0:04.88 chrome   
   1630 user      20   0 5359780 307316 118844 S   4.3   2.2   0:08.09 gnome-s+ 
   4116 user      20   0 5626104 113272  91952 S   4.3   0.8   0:00.56 skypefo+ 
   3618 user      20   0  649480 137168  91180 S   4.0   1.0   0:02.42 chrome   
   1299 user      20   0 1433488  90628  56156 S   2.6   0.6   0:02.52 Xorg     
   3834 user      20   0   36.4g 142796  88768 S   2.3   1.0   0:04.01 chrome   
   3877 user      20   0 2200908 115344  79896 S   2.3   0.8   0:07.09 skypefo+ 
   2258 user      20   0 2747244 134668  94496 S   1.3   0.9   0:01.39 teams    
   2401 user      20   0 2741456 414736 115904 S   1.3   2.9   0:18.69 teams    
   4045 user      20   0  816792  53108  40540 R   0.7   0.4   0:00.55 gnome-t+ 
     65 root      20   0       0      0      0 I   0.3   0.0   0:00.16 kworker+ 
    240 root      20   0       0      0      0 I   0.3   0.0   0:00.23 kworker+ 
    241 root      20   0       0      0      0 I   0.3   0.0   0:00.13 kworker+ 
    663 root      -2   0       0      0      0 S   0.3   0.0   0:00.55 gfx      
   1106 root      20   0  335928  19916  16752 S   0.3   0.1   0:01.09 Network+ 
   4087 user      20   0   12160   4032   3268 R   0.3   0.0   0:00.04 top  

sudo lshw -C memory gives https://paste.ubuntu.com/p/4jS9HFBqN3/

10
  • @Terrance I already have vm.swappiness=10 in /etc/sysctl.conf. What else can I configure that might help?
    – Simd
    Apr 6, 2021 at 15:36
  • Edit your question and show me free -h and sysctl vm.swappiness and grep -i swap /etc/fstab and ls -al /var/crash and top.
    – heynnema
    Apr 6, 2021 at 15:37
  • And ls -al ~/.local/share/gnome-shell/extensions and ls -al /usr/share/gnome-shell/extensions.
    – heynnema
    Apr 6, 2021 at 15:39
  • 1
    You might also want to run a check on your memory chips (i.e., memtest).
    – Ray
    Apr 6, 2021 at 15:41
  • 1
    Without knowing the hardware you have, I would assume that the missing 3GiB is shared with video memory. It is quite common with onboard video cards.
    – Terrance
    Apr 6, 2021 at 16:05

1 Answer 1

1

swap

Your /swapfile may be too small. Let's change it from 2G to 4G and see if that helps...

Note: Incorrect use of the dd command can cause data loss. Suggest copy/paste.

In the terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 16G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.

Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation

memtest

Go to https://www.memtest86.com/ and download/run their free memtest to test your memory. Get at least one complete pass of all the 4/4 tests to confirm good memory. This may take many hours to complete.

Note: vm.swappiness=10 may be too low (60 is default), and 13G RAM is an odd amount. Let's review sudo lshw -C memory. We may modify vm.swappiness later.

Update #1:

Memory

Your memory may be installed incorrectly, and/or you may have a defective DIMM, as you have two 8G DIMMS, but only show 13G RAM, and both DIMMS show up in DIMM1 memory slots.

Note: AMD Ryzen processors are notorious for RAM compatibility issues.

Review the User Manual for your PC/motherboard, and confirm that you have the memory installed into the correct slots for memory interleaving. Re-seat the DIMMS if possible.

Update #2:

BIOS

Gigabyte A320M-S2H

Rev 1 https://www.gigabyte.com/us/Motherboard/GA-A320M-S2H-rev-1x#kf

Rev 2 https://www.gigabyte.com/us/Motherboard/GA-A320M-S2H-rev-20#kf

Rev 3 https://www.gigabyte.com/us/Motherboard/GA-A320M-S2H-rev-3x#kf

You have BIOS version: F51c dated: 07/02/2020. There's a newer BIOS available, based on which revision motherboard you have. See above links.

20
  • Done (except for the memtest86 step). I suspect it isn't the memory as I had exactly the same problem with my previous ubuntu machine which I stupidly threw away thinking it must be a hardware problem. I have no idea why it says 13G. That is odd as you say.
    – Simd
    Apr 6, 2021 at 16:01
  • @Anush Your memory may be installed incorrectly. Wait for the update to my answer.
    – heynnema
    Apr 6, 2021 at 16:02
  • I am trying the PC with the new settings (I guess the only real difference is the swap size). I also just asked a friend who has 16GB of swap and swapiness of 60 on a 8 GB RAM machine. Those are quite different numbers to me.
    – Simd
    Apr 6, 2021 at 16:12
  • @Anush 8G RAM with a 16G swap is excessive swap. vm.swappiness=60 may need to go to 80.
    – heynnema
    Apr 6, 2021 at 16:14
  • 1
    @Anush I might also consider setting vm.swappiness back to 60.
    – heynnema
    Apr 11, 2021 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .