Frequent Complete Freezes On 20.04

au flag

Over the last few days, for no reason I can tell (no recent big updates), I've been experiencing frequent instances of complete system freezes. The mouse won't move, no key combinations trigger, and cannot reboot with Alt+SyReq either. The only way to do anything is to hold down the power button until it powers off. After rebooting it freezes again, sometimes after many hours, sometimes after only a few minutes. It is never linked to me running a program, happens inexplicably while i'm just browsing websites.

free -h gives:

 total        used        free      shared  buff/cache   available
Mem:           11Gi       1.0Gi       9.0Gi       134Mi       1.4Gi       9.9Gi
Swap:         2.0Gi          0B       2.0Gi

sysctl vm.swappiness gives:

vm.swappiness = 60

swapon -s gives:

Filename                Type        Size    Used    Priority
/swapfile                               file        2097148 0   -2
heynnema avatar
ru flag
Edit your question and show me `free -h` and `sysctl vm.swappiness` and `swapon -s`. Start comments to me with @heynnema or I'll miss them.
Judah Wolf avatar
au flag
@heynnema added the results you requested.
heynnema avatar
ru flag
Status please...
heynnema avatar
ru flag
Status please...
it flag

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 fallocate 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.

heynnema avatar
ru flag
This information is just dated, and incorrect. Sorry.
ru flag

With 12G RAM, your /swapfile may be a little small, and causing your freezes. Let's bump it from 2G to 4G and see if it helps.

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 12G 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

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.