2

I previously had an 8GB of RAM and 1TB of hard disk on my ASUS VivoBook R542UQ-DM153. I've added a 250GB WD Blue SSD and an 8GB of RAM. Total RAM now is 16GB. I've also made a fresh installation of Ubuntu on SSD. Now every time there is somewhat like heavy use the system freezes and I am left with no other option but to hard shutdown. Please help how can I fix that.

$ sudo dmidecode --type memory
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.

Handle 0x0008, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 64 GB
    Error Information Handle: Not Provided
    Number Of Devices: 4

Handle 0x0009, DMI type 17, 40 bytes
Memory Device
    Array Handle: 0x0008
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 8192 MB
    Form Factor: SODIMM
    Set: None
    Locator: ChannelA-DIMM0
    Bank Locator: BANK 0
    Type: DDR4
    Type Detail: Synchronous Unbuffered (Unregistered)
    Speed: 2400 MT/s
    Manufacturer: 859B
    Serial Number: E0F2D27D
    Asset Tag: 9876543210
    Part Number: CB8GS2400.C8D       
    Rank: 1
    Configured Clock Speed: 2133 MT/s
    Minimum Voltage: 1.2 V
    Maximum Voltage: 1.2 V
    Configured Voltage: 1.2 V

Handle 0x000A, DMI type 17, 40 bytes
Memory Device
    Array Handle: 0x0008
    Error Information Handle: Not Provided
    Total Width: Unknown
    Data Width: Unknown
    Size: No Module Installed
    Form Factor: Unknown
    Set: None
    Locator: ChannelA-DIMM1
    Bank Locator: BANK 1
    Type: Unknown
    Type Detail: None
    Speed: Unknown
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown
    Configured Clock Speed: Unknown
    Minimum Voltage: Unknown
    Maximum Voltage: Unknown
    Configured Voltage: Unknown

Handle 0x000B, DMI type 17, 40 bytes
Memory Device
    Array Handle: 0x0008
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 8192 MB
    Form Factor: SODIMM
    Set: None
    Locator: ChannelB-DIMM0
    Bank Locator: BANK 2
    Type: DDR4
    Type Detail: Synchronous Unbuffered (Unregistered)
    Speed: 2400 MT/s
    Manufacturer: 04CB
    Serial Number: 01210200
    Asset Tag: 9876543210
    Part Number: AO1P24HC8T1-BSFS    
    Rank: 1
    Configured Clock Speed: 2133 MT/s
    Minimum Voltage: 1.2 V
    Maximum Voltage: 1.2 V
    Configured Voltage: 1.2 V

Handle 0x000C, DMI type 17, 40 bytes
Memory Device
    Array Handle: 0x0008
    Error Information Handle: Not Provided
    Total Width: Unknown
    Data Width: Unknown
    Size: No Module Installed
    Form Factor: Unknown
    Set: None
    Locator: ChannelB-DIMM1
    Bank Locator: BANK 3
    Type: Unknown
    Type Detail: None
    Speed: Unknown
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown
    Configured Clock Speed: Unknown
    Minimum Voltage: Unknown
    Maximum Voltage: Unknown
    Configured Voltage: Unknown
galoget
  • 2,963
  • How much swap space do you have and what is your swappiness set to? You can run: cat /proc/sys/vm/swappiness to show the swappiness and you can run free -h to show how much swapspace you have. – mchid Aug 04 '19 at 08:01
  • swappiness is 60 – Avirup Aditya Aug 04 '19 at 08:03
  • and I have 4GB of swap space – Avirup Aditya Aug 04 '19 at 08:03
  • Thanks, I have an answer for you. When your swappiness is set higher, your system will try to cache out more RAM to your swapfile. Lowering your swappiness and/or increasing the size of your swapfile can improve performance. – mchid Aug 04 '19 at 10:09

3 Answers3

2

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.

mchid
  • 43,546
  • 8
  • 97
  • 150
  • I've made the changes you mentioned. Swap is now 8GB and swappiness is 10. Let me use the system now for a few time to check if the problem is resolved. Thanks for your help. – Avirup Aditya Aug 04 '19 at 10:30
  • 1
    @mchid For your education. Yes, largest server I ever deployed had 8TB RAM. – Fabby Aug 05 '19 at 06:39
  • @mchid The problem is still not resolved! It's still freezing sometimes. And the command you told to change the swap area, it's changing it but only until next power on. – Avirup Aditya Aug 11 '19 at 15:20
  • @AvirupAditya If it is freezing only when opening applications, you can increase swappiness by editing the /etc/sysctl.conf file and changing vm.swappiness = 10 to vm.swappiness = 20 and then run: sudo sysctl -p. If the system is freezing when using a lot of RAM, try lowering it to 5. – mchid Aug 11 '19 at 15:38
  • @AvirupAditya Also, do you have the Nvidia drivers installed? Run the following command to install the Nvidia drivers: sudo apt update; sudo ubuntu-drivers autoinstall – mchid Aug 11 '19 at 15:43
  • @mchid Yes I have nvidia drivers installed. One thing I found out while searching the internet. Is it possible to that the high RAM usage is because of gnome? I saw somewhere there was a memory leak in gnome 3! I use a customized theme and gnome shell. – Avirup Aditya Aug 11 '19 at 15:45
  • @AvirupAditya It's possible. The only way to find out is to try a different desktop. I use the Unity desktop. Here are instruction on how to install the Unity desktop: https://itsfoss.com/use-unity-ubuntu-17-10/ There are also more lightweight desktops like the xubuntu-desktop. Also, if you don't like the Unity style login screen, you can switch back to gdm by running the following command: sudo dpkg-reconfigure gdm then select "gdm". – mchid Aug 11 '19 at 15:56
  • @AvirupAditya Other lightweight desktops you can install are: ubuntustudio-desktop or lubuntu-desktop or ubuntu-mate-desktop. – mchid Aug 11 '19 at 16:02
  • What actually is changing an environment? Will I have to reinstall all my softwares and dependencies? – Avirup Aditya Aug 11 '19 at 16:09
  • @AvirupAditya You won't have to reinstall all of your dependencies but there are dependencies to install. The least dependencies would be to go with the Unity desktop as most of the dependencies are the same as Gnome. Xubuntu has XFCE4 dependencies and Lubuntu has LXDE dependencies. – mchid Aug 11 '19 at 16:53
2

If someone else has similar issue recently, I just had the similar freezing issue, which occured after I updated my Ubuntu 18.04 a few weeks ago. I now realized it broke my Nvidia driver installation. I reinstalled it and now it looks OK.

For the installation this worked:

How do I install the NVIDIA CUDA toolkit on 18.04 with Coffee Lake - is it supported?

Just update the current driver version.

entropy
  • 21
  • 1
    This is a nicely worded first answer by you. But the question is about updating RAM and SSD not nVidia driver woes from upgrading Ubuntu which probably affect most people with nVidia cards. – WinEunuuchs2Unix Nov 14 '19 at 01:51
  • 2
    This is actually the correct answer. The issue OP has is die to Nvidia driver problems. – psv Jun 21 '21 at 19:21
0

True, but I would check to make sure RAM is good if you have further issues like this. Try swapping sticks of RAM into opposite slots. If you have less total and less free RAM, one stick is bad. I say this because I got a brand new Crucial stick that was totally bad--tech found out by having both sticks in and getting no boot. when tech put just one in, computer works with 8GB RAM shown.

Try what was written by others first though, please.