I have a 16GB RAM system and whenever I hit the limit of RAM the whole system freezes even the mouse cursor starts to become jittery until it doesn't move at all. Keyboard, mouse, nothing. So I am forced to do a hard power-off which isn't probably good for the electronics.
I've set up a 16GB swap which shows up properly in free -m
and in top
but it's always at 0 usage.
total used free shared buff/cache available
Mem: 15960 5823 3915 704 6220 9104
Swap: 16383 0 16383
Any ideas why my system doesn't want to use the swap to save me from a total crash?
More info:
$ grep -i swap /etc/fstab
/swapfile none swap sw 0 0
$ sysctl vm.swappiness
vm.swappiness = 80
$ swapon -s
Filename Type Size Used Priority
/swapfile file 16777212 0 -2
$ ls -al /swapfile
-rw------- 1 root root 17179869184 Jan 16 2021 /swapfile
Output of sudo lshw -C memory
: https://pastebin.com/TGbjiLdm
I've played with the swappiness from 10 to 40 to 60 to 80 and it doesn't seem to make much difference.
Also, the system isn't hitting the limit very often. Only when I am editing very large video files with Kdenlive or running VirtualBox and things of that nature. I'm usually careful about it, but sometimes I accidentally hit that threshold of 16GB (with swap unused) and my system crashes.
Best Answer
SWAP
Edit /etc/fstab...
sudo -H gedit /etc/fstab
And edit this line to remove tabs, and use only spaces...
Reduce your /swapfile... it's way too big...
Note: Incorrect use of the
rm
anddd
commands can cause data loss. Suggest copy/paste.In the
terminal
...Edit /etc/fstab, using
sudo -H gedit /etc/fstab
orsudo pico /etc/fstab
.Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...
Reset your vm.swappiness...
Edit /etc/sysctl.conf...
sudo -H gedit /etc/sysctl.conf
Find the line that contains
vm.swappiness=80
and change it to =60.Save the file.
sudo sysctl -p
BIOS
ThinkPenguin Snares https://www.thinkpenguin.com/gnu-linux/snares-penguin-gnu-linux-notebook
You have a very old BIOS version 1.03.06 dated 06/25/2014. Tell me the EXACT make/model of your computer or motherboard, and we'll check for a newer BIOS.
Update #1:
Let's check your file system...
terminal
window by pressing Ctrl+Alt+Tsudo fdisk -l
sudo fsck -f /dev/sdXX
, replacingsdXX
with the number you found earlierfsck
command if there were errorsreboot
Update #2:
Initial failure during
dd
command. Freeze at login screen.fsck
fixed some errors. Swap is now working correctly. BIOS appears to be old, but current. Runs ok when booted to Ubuntu Live DVD/USB. Needs Ubuntu reinstall.