0

I have the Lenovo R61 Thinkpad with Ubuntu 18.04. It has 4GB memory, Samsung SSD 860 EVO 500GB with 9GBs swap partition, Core™2 Duo CPU T7500 @ 2.20GHz × 2 and Intel® 965GM (CL) graphics.

Soon after I starts using memory heavy software like GIMP or Google Map for a while, all of sudden, the swapping begins and it freezes up with the hardware led light continuously flickering. The clock sometimes does not advance for more than 20 to 30 minutes, and sometimes it crashes with the blank screen and restarts by itself. I do not think it uses up all 9GB swap space.

I tried to solve this myself by researching, but so far all the suggestions on the web failed. Previous, it had the Kingston SSD, and I learned that it has a firmware problem with Linux, so I changed to Samsung SSD. But still the freeze problem persists.

Is this normal because of my old hardware or faulty hardware? Or is my software configuration or setting not correct? Where can I start looking further?

Thank you very much.

PS

Here is the output after I changed the swap partition to 32GB. enter image description here

Here is another one after I use up some memory. enter image description here

Update after further testing.

I think I may have found the cause of the freeze. With the increased 32GB swap partition, if I open lots images in GIMP and uses Googlemap extensively, the memory usage goes up to 3.6GB and swap to 4.1GB usage, and the system becomes sluggish and the mouse movement jerky. But it does not freeze. However, if I open a few images with the image viewer in the Files(nautilus) by double clicking an image(it may be after several images opening), the system freezes with or without the blank screen. Last night, it went blank screen and logged me off after 5 to 10 minutes freeze. I though it was a restart, but it was not from looking at the uptime.

This morning, with memory at 3.1GB usage and swap at 3.2GB usage, after double clicking a image in the Files, the screen went blank for almost 2 hours and I had to restart it manually. Other image viewer did not cause the freeze. Only the image viewer somehow triggers this freeze, if I recall the past freezes. If the memory usage is light, I do not think this happens.

So, is there any way to capture the snapshots of what is going on in the background when I open the image viewer, so that I can forward this to the image viewer programmers for review. There may be a bug with the program.

Thank you.

7
  • If the clock is not updating for as many as 30 minutes, I would wonder how much you're running in the background. Google Maps will easily use all of that memory and 9GB swap is likely not enough to handle everything in the system. If you can upgrade the RAM to 8 or 16GB, that would be a good start. The swap would likely be better around 16GB as well. You may also benefit from a lighter desktop, such as XFCE or MATE 🤐
    – user1091774
    Feb 15, 2021 at 22:53
  • Matigo, thank you. The desktop clock icon stays the same for 20-30 min or more sometimes when it freezes. I can not find out what is going on in the background because it is frozen, but from the disk LED continuously flickering, I assume it is the system background process that transfers data from RAM to swap space. But still, I think it's taking too long for the SSD. And it is all of sudden that it happens. My laptop's max RAM is 4GB, so I can not add more. I will try changing swap space to 16GB and see what happens. I will look into XFCE or MATE. Thank you. Feb 16, 2021 at 2:13
  • If your machine is limited to 4GB RAM, then a 16GB swap may be insufficient. If you have plenty of space available on your SSD, consider going with something closer to 32GB. This may be sub-optimal for some situations but will hopefully resolve some of the issues you face when using a number of browser tabs.
    – user1091774
    Feb 16, 2021 at 2:31
  • Thank you, Matigo. OK, I have enough space, so I will try 32GB. I think 32GB is plenty, if it still freezes up, then something else may be the cause. Usu. I opens 20 - 40 tabs on the browser. Thank you. Feb 16, 2021 at 2:50
  • Increasing the swap size to 32GB did not help. I tested by using Google Map & opening photo files in GIMP. I monitored with the system monitor the memory & swap usage before opening photo files each time.I noticed the memory usage at 3.7GB (about 100% usage) and the swap space at 420MB(1.3% usage). Then I opened a photo file of 21MB with the image viewer, and it froze, with the clock not advancing, mouse stuck, and the HD LED continuously flickering. The laptop was hot to the touch & froze more than 1 hr. So I shut it down manually. Where can I look to find out the problem? Thank you. Feb 17, 2021 at 1:08

1 Answer 1

0

From the looks of your updates, I would lean towards changing your swappiness value as it's contributing to a lack of disk cache. The default value for an Ubuntu installation is 60 and, unless you are running a server or have a great amount of RAM on hand, it's a decent number to stick with. However, as every system and every configuration is slightly different, it's best to start by testing solutions.

Start by changing the swappiness value in place:

sudo sysctl vm.swappiness=60

This value will be reset to 10 on your next reboot. If you notice the system is performing better as a result of being set at 60 (or any other value), you can make it permanent like this:

  1. Open Terminal (if it's not already open)
  2. Edit the sysctl.conf file as root:
    sudo vi /etc/sysctl.conf
    
    Note: Feel free to use any text editor you prefer. The use of vi here is more muscle memory than an explicit endorsement.
  3. Find vm.swappiness and set it to the value that works best for you
  4. Save the file and apply the change:
    sudo sysctl -p
    

A little bit on vm.swappiness ...

A swappiness value of 10 does not mean that data only gets swapped out when there is 10% of RAM remaining. This is better thought of as a "ratio of preference" for stealing pages from cache vs. swapping to make memory available. A low value will strongly prefer stealing pages from the cache while a high value strongly prefers swapping pages to disk. The setting is mostly ignored by the system until the memory is almost completely used and the kernel is forced to decide how to free some of the memory for use by other processes.

The cache that is referred to in the above explanation is disk cache so, by decreasing the value of swappiness, you increase the chance that a process will not be swapped out of memory. This also decreases the overall amount of disk cache that the system has available, which can make reading/writing to the SSD much slower than it needs to be. As a result, the effects of this setting on the actual performance of your system are not as two-dimensional as many people think.

There is no "magic formula" to determine what the correct amount of swappiness for any given system might be, so a little trial and error may be in order. That said, the default of 60 that ships with many Debian-based OSes seems to be a good balance for the vast majority of people running a desktop.

I hope this gives you what you need to have a more reliable system.

7
  • Thank you Matigo. I noticed I had changed vm.swappiness to 10 in /etc/sysctl.conf file about 2.5 years ago probably from research on the web to fix this problem. But it did not help and I gave up. Later, I learned that Kingston SSD had a firmware issue with Linux. So, I changed the SSD to Samsung last year. At first, it seemed to have solved this problem, but it didn't. Maybe this swappiness value is the cause. I changed it to 60 now, and the testing so far seemed better with swap usage at 1.1GB and not freezing yet. I will do more testing later and let you know. Thank you very much. Feb 17, 2021 at 5:02
  • Matigo, even with swappiness value at 10, it should not take more than an hour(I do not know how long because I shut it down after 1 hour) to swap out memory data only a few GB to disk. Is that thrashing what is happening inside, and thus making the laptop feel hot to the touch? Thank you. Feb 17, 2021 at 5:06
  • With only 600 characters per comment, I'm not sure I can fully answer your statement about swapping out "only a few GB to disk", as it's not that straightforward. As for the heat issue, SSDs can get really hot. The 860 EVO can hit temperatures of 70˚C when working at maximum speed, but the R61 is limited to a SATA I interface, which caps out at 150MB/sec (almost 1/4 the SSD's rating). The heat is likely due to the notebook's 245 Btu/hr dissipation rating 😕
    – user1091774
    Feb 17, 2021 at 5:19
  • Matigo, I think I might have the cause of the freeze. I updated the original question. Could you help on this? Thank you. Feb 17, 2021 at 17:51
  • 1
    Matigo, I have been avoiding using the image viewer, and I have not had the freeze for several days. Instead, I used the Gwenview or Shotwell viewer with the swap space usage at a few to several giga bytes. I think the image viewer triggers the freeze when there is not enough space in the memory and swapping starts. While testing swappiness from your suggesting, I found the cause of the freeze. Thank you for your help. Feb 23, 2021 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .