Ubuntu whole system goes unresponsive from time to time
Solution 1:
Let's increase your /swapfile 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 8G RAM and 4G swap
Edit /dev/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
Update #1:
Remove nomodeset
from your /etc/default/grub and then sudo update-grub
.
You have an older version of the AMD video driver. Download and install version 20.20 at https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-20 or https://drivers.amd.com/drivers/linux/amdgpu-pro-20.20-1098277-ubuntu-20.04.tar.xz.
Installation instructions are at https://amdgpu-install.readthedocs.io/en/latest/.
Reboot your computer.
Solution 2:
sorry for posting as an answer (I just recently joined and cannot comment yet)
@ Elgin Cahangirov: I also experience these random freezes, and most of the time there is an update waiting for me when I restart my computer... Have you run Software Updater after your crash?
Here is the full story:
I have the same problem (I just restarted my machine after this annoying freeze-of-death) and also tried resolving it via swap-settings:
My swap settings before the crash were:
-
manually changed swappiness to 95 or 100 (default is 60, haven't yet figured out how to change swappiness permanently)
-
8 GB RAM
-
2 GB swap (during installation, on "hard drive 1", dual boot with windows)
-
a second swap partition of almost 20 GB (on "hard drive 2" (created and activated with disk and gparted ))
-
set these priorities to my swaps: * -1 for the 2 GB swap (system default) * 3 for the 20 GB swap (chanced manually, permanent setting)
What was running?
-
some firefox windows (no videos, just plain texts (how-tos for R) and google sheets)
-
R (luckily I had saved everything)
-
system monitor (cause these crashes happen all the time & I'm trying to figure out why... (however, it was in the background, so I couldn't see what caused the crash))
What did I do?
Actually nothing... I was AFK, R was just open (no calculation running or anything), firefox was just open (no page loading)
=> no apparent reason for crashing... (and this happens all the time, totally random... e.g. :
- when the machine is idle (just left switched on when I went to bed),
- when I'm running R
- when I'm running salmon
- when I'm watching a youtube tutorial (with the extra annoying special effect that the last seconds of whatever was playing are stuck on repeat -.- )
- when I had some programs open but was doing nothing at the moment (I notice the freeze when I come back to resume my work after a short break)
- ...)
However, after I restarted my computer, I checked whether Software Updater had any updates or something like that and there was yet another update (ubuntu base) I have disabled livepatch (because I thought it might be the reason for those freezes). My settings in Software Updater say: "subscribe to all updates" (for other packages), "check for updates weekly", security updates immediately, other updates weekly, notify about other LTS ubuntu versions.
Is there anything I can do to fix that?
It reminds me of my Windows 10: Whenever there is an update the PC will be really slow, proudly announce that there's an update and ask for a restart, restarting will take forever, and most of the time it needs a second restart until everything is back to normal... However, in Win 10 I can pause updates for a week if I want to make sure that my machine will not be slow or crash (e.g. during an important project) Can I pause my Software Updater updates, too? (checking weekly didn't work, it caught 2 updates (& two freezes) yesterday and caught another update just now... or is ubuntu base one of the security updates?)
Sorry for rambling, I'm new to Ubuntu and wanted to give all the information that might be important :)