There is a good chance that your system is looking for free swap space that does not exist.
When this happens, the system will grind to a halt as the system constantly pages your storage device for swap space that is not there.
There are two things causing this to happen.
1 - Your swappiness is set too high. For a solid state drive with 16 GB of RAM, you don't need to set your swappiness to 60.
Run the following command to set your swappiness to 10:
echo 'vm.swappiness = 10' | sudo tee -a /etc/sysctl.conf
To change your swappiness in the future you can edit the file /etc/sysctl.conf
or you can use sed
. The following example will change swappiness from 10 to 20:
sudo sed -i 's/swappiness = 10/swappiness = 20/g' /etc/sysctl.conf
Run the following command to apply the changes:
sudo sysctl -p
You can play around with this setting. You may do better with setting swappiness to 20 or higher using a solid state drive as the system will be able to take advantage of cached RAM. Personally, I have about 5GB of RAM with a solid state drive and 10 works fine.
2 - You can also increase your swap space to free up more RAM. Right now, you have 16 GB of RAM which is a lot. However, you don't have much swap space. This can cause the system to slow down when RAM usage is too high.
Use the following commands to increase the size of your swapfile:
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1M count=8192
sudo mkswap /swapfile
sudo swapon /swapfile
this will set your swapfile to 8 GB. To set your swapfile to 16 GB you can increase count=8192
to count=16384
. Use count=4096
reset the size back to 4 GB.
You will not need 16 GB of swap space for RAM unless you use hibernation. If you use hibernation, it is recommended you set your swap space the same size as your RAM. The recommended minimum for 16 GB of RAM on a system that does not use hibernation is 4 GB.
Also, when your swappiness is set to a lower number, the size of your swap file becomes less important.
EDIT
I just checked your laptop model and it says that you have Nvidia graphics. Run the following commands to install the Nvidia drivers:
sudo apt update
sudo ubuntu-drivers autoinstall
Reboot to apply the changes.
Best Answer
I had the same problem, and I spent several days trying different
.ISO
files, USB sticks, UEFI and secure-boot settings, all to no avail.I finally did find a workaround, but you're not going to like it because it is time-consuming. First install Ubuntu 16.04, and then upgrade to 18.04 with this:
The upgrade takes a few hours, but at least it works.