BIOS
ASRock AB350M
You have a very old BIOS version P3.10 dated 08/30/2017. Go to here and download and install the newer BIOS.
Note: Carefully read the various version warnings on the site.
Note: Have good backups before updating the BIOS.
overclocking
If your CPU or RAM is overclocked, please set it back to default, and retest.
memory
Ryzen 5 1600x (Summit Ridge)
Kingston KHX2666C16/8G
Ryzen processors are very fussy about memory compatibility. Your Kingston memory does not appear on the ASRock memory compatibility list.
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.
swap/vm.swappiness
Your /swapfile is too small at 2G, and your vm.swappiness is wrong.
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 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
Edit /etc/sysctl.conf and set vm.swappiness=10 and then do sudo sysctl -p
. This will still minimize swapping, which, I believe, was your original intent.
Ubuntu
If all of the above fails to solve the problem, prepare a Ubuntu Live 21.04 DVD/USB and boot to it. Install the latest Nvidia video driver (if possible). Retest.
Update #1:
The BIOS has been updated. It did not help with the problem.
Update #2:
memtest
passed. vm.swappiness set to 10. /swapfile resized to 4G, overclocking set to "Auto". Ubuntu Live 21.04 USB has same problem (but of course it has a smaller /swapfile).