0

I'm brand new to Linux and Ubuntu and need a little help. I'm running 20.04.2 and frequently my system freezes up completely. I have zero knowledge of how to troubleshoot this problem. So far to restart I have been using Alt+PrtScrn+REISUB. Normally if I'm playing music on spotify it will continue despite everything else having frozen.

EDIT: I seem to have the most problems when running PyCharm.

EDIT2: This is my free -h and sysctl vm.swappiness

heynnema
  • 73,649
Rwzfs
  • 1

2 Answers2

0

Your 2G /swapfile is too small. Let's increase it from 2G to 4G...

Note: Incorrect use of the rm and dd commands 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 8G 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
heynnema
  • 73,649
-1

System "freezes" are often caused by running too many, too large programs and running out of available memory. Use free to see if you have swap space, read man mkswap swapon fstab to create some. Swap space must be contiguous. use mkswap or fallocate, not dd. Traditionally, swap space of 1.5 × RAM has been recommended, but YMMV. If you don't plan to hibernate your system, you can have less than 1.0 × RAM.

waltinator
  • 37,856