0

I made the question like this because I am also looking for some general advice, besides possibly a technical solution to this problem.

Just browsing with firefox (opening a million tabs), the computer ends up freezing, I can move the cursor but nothing else. I rebooted the computer and left a terminal with top monitoring in the corner. When it happened again, kswapd0 was using 99% of CPU. I took a picture of the frozen screen:

enter image description here

I think I understood what kswapd0 does from this nice answer.

Question: Should I try to apply the suggestions by @Zzzach... and give it a try, or the fact that ubuntu crashes points to a more fundamental problem? More practically: should I return my new laptop and get another one (perhaps with more ram)?

Right now any advice would be useful for me. Thank you.

DELL Precision 3551 (8Gb, i7-10th gen, 6 cores). Purchased to DELL directly. Pre-installed with Ubuntu 20.04


EDIT

Output of free -h as requested by @heynnema (before doing the changes to the swap configuration):

              total        used        free      shared  buff/cache   available
Mem:          7,4Gi       1,7Gi       3,1Gi       487Mi       2,6Gi       4,9Gi
Swap:         2,0Gi          0B       2,0Gi

And sudo swapon -s

Filename                Type        Size    Used    Priority
/swapfile                               file        2097148 0   -2

free -h after the changes

              total        used        free      shared  buff/cache   available
Mem:          7,4Gi       1,9Gi       141Mi       509Mi       5,3Gi       4,7Gi
Swap:         4,0Gi          0B       4,0Gi

Screenshot of Disks

enter image description here

Output of sudo nvme smart-log /dev/nvme0 (after sudo apt install nvme-cli)

Smart Log for NVME device:nvme0 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 47 C
available_spare                     : 100%
available_spare_threshold           : 50%
percentage_used                     : 0%
data_units_read                     : 706.904
data_units_written                  : 856.973
host_read_commands                  : 9.475.078
host_write_commands                 : 5.844.114
controller_busy_time                : 24
power_cycles                        : 40
power_on_hours                      : 42
unsafe_shutdowns                    : 9
media_errors                        : 0
num_err_log_entries                 : 0
Warning Temperature Time            : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1                : 40 C
Temperature Sensor 2                : 40 C
Thermal Management T1 Trans Count   : 0
Thermal Management T2 Trans Count   : 0
Thermal Management T1 Total Time    : 0
Thermal Management T2 Total Time    : 0

Full Output of top

top - 13:07:20 up 55 min,  1 user,  load average: 0,89, 1,18, 1,44
Tasks: 328 total,   1 running, 327 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6,9 us,  1,4 sy,  0,0 ni, 91,5 id,  0,0 wa,  0,0 hi,  0,2 si,  0,0 st
MiB Mem :   7591,1 total,    511,9 free,   4898,2 used,   2180,9 buff/cache
MiB Swap:   4096,0 total,   4096,0 free,      0,0 used.   1589,2 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                        
   1042 avahi     20   0   14368   9496   3448 S  28,8   0,1  15:21.02 avahi-daemon                                   
   3046 joanruiz  20   0 5984172   1,1g 520880 S  17,5  14,3  14:10.57 firefox                                        
   1229 joanruiz   9 -11 2722496  20328  15860 S   7,0   0,3   3:17.65 pulseaudio                                     
   1240 root      20   0  364124 119072  77516 S   5,6   1,5   2:13.41 Xorg                                           
   1627 joanruiz  20   0 5023716 267952 114456 S   5,6   3,4   3:06.26 gnome-shell                                    
   4184 joanruiz  20   0 3328404 610948 162244 S   5,3   7,9   1:52.83 Web Content                                    
   4105 joanruiz  20   0 3459772 736820 173096 S   5,0   9,5   5:40.82 Web Content                                    
   4379 joanruiz  20   0 3361924 605584 164780 S   4,3   7,8   3:03.59 Web Content                                    
   3344 joanruiz  20   0  817116  51172  38580 S   4,0   0,7   0:07.65 gnome-terminal-                                
   3880 joanruiz  20   0 3238656 521872 158076 S   3,6   6,7   1:30.71 Web Content                                    
   3140 joanruiz  20   0 2464024 132104  96708 S   3,3   1,7   0:11.56 Privileged Cont                                
   3805 joanruiz  20   0 3331928 603492 159216 S   3,3   7,8   3:42.14 Web Content                                    
   3312 joanruiz  20   0 3230972 478476 155968 S   2,6   6,2   2:16.64 Web Content                                    
   4314 joanruiz  20   0 3324008 532704 159316 S   2,6   6,9   1:29.47 Web Content                                    
   3694 joanruiz  20   0 3269908 569404 164392 S   2,0   7,3   3:45.15 Web Content                                    
    304 root     -51   0       0      0      0 S   0,7   0,0   0:16.99 irq/110-DELL09C                                
      1 root      20   0  168004  11700   8312 S   0,3   0,2   0:13.52 systemd                                        
    676 root     -51   0       0      0      0 S   0,3   0,0   0:03.33 irq/167-iwlwifi                                
    677 root     -51   0       0      0      0 S   0,3   0,0   0:05.22 irq/168-iwlwifi                                
    678 root     -51   0       0      0      0 S   0,3   0,0   0:04.82 irq/169-iwlwifi                                
    687 root     -51   0       0      0      0 S   0,3   0,0   0:04.74 irq/172-iwlwifi                                
    705 root     -51   0       0      0      0 S   0,3   0,0   0:04.87 irq/178-iwlwifi                                
   1046 message+  20   0    9756   6172   3868 S   0,3   0,1   0:04.37 dbus-daemon                                    
   1048 root      20   0  617360  20896  17044 S   0,3   0,3   0:05.23 NetworkManager                                 
   1076 root      20   0       0      0      0 I   0,3   0,0   0:18.56 kworker/10:3-events                            
   1403 root      20   0       0      0      0 S   0,3   0,0   0:00.36 nv_queue                                       
   3951 joanruiz  20   0  360060   5756   5124 S   0,3   0,1   0:00.28 sd_dummy                                       
   5481 root      20   0       0      0      0 I   0,3   0,0   0:00.29 kworker/u24:0-events_unbound                   
   6294 joanruiz  20   0   14656   4264   3408 R   0,3   0,1   0:00.08 top                                            
      2 root      20   0       0      0      0 S   0,0   0,0   0:00.00 kthreadd                                       
      3 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_gp                                         
      4 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_par_gp                                     
      6 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/0:0H-events_highpri                    
      9 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 mm_percpu_wq                                   
     10 root      20   0       0      0      0 S   0,0   0,0   0:00.14 ksoftirqd/0                                    
     11 root      20   0       0      0      0 I   0,0   0,0   0:03.52 rcu_sched                                      
     12 root      rt   0       0      0      0 S   0,0   0,0   0:00.02 migration/0                                    
     13 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/0                                  
     14 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/0                                        
     15 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/1                                        
     16 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/1                                  
     17 root      rt   0       0      0      0 S   0,0   0,0   0:00.10 migration/1                                    
     18 root      20   0       0      0      0 S   0,0   0,0   0:00.06 ksoftirqd/1                                    
     19 root      20   0       0      0      0 I   0,0   0,0   0:00.22 kworker/1:0-events                             
     20 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/1:0H-kblockd                           
     21 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/2                                        
     22 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/2                                  
     23 root      rt   0       0      0      0 S   0,0   0,0   0:00.11 migration/2                                    
     24 root      20   0       0      0      0 S   0,0   0,0   0:00.03 ksoftirqd/2                                    
     26 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/2:0H-kblockd                           
     27 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/3                                        
     28 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/3                                  
     29 root      rt   0       0      0      0 S   0,0   0,0   0:00.11 migration/3                                    
     30 root      20   0       0      0      0 S   0,0   0,0   0:00.02 ksoftirqd/3                                    
     32 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/3:0H-events_highpri                    
     33 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/4                                        
     34 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/4 

Output of lshw -C memory

joanruiz@joan-Dell-Precision:~$ sudo lshw -C memory
[sudo] password for joanruiz: 
  *-firmware                
       description: BIOS
       vendor: Dell Inc.
       physical id: 0
       version: 1.4.3
       date: 12/23/2020
       size: 64KiB
       capacity: 32MiB
       capabilities: pci pnp upgrade shadowing cdboot bootselect edd int13floppynec int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb smartbattery biosbootspecification netboot uefi
  *-memory
       description: System Memory
       physical id: 1c
       slot: System board or motherboard
       size: 8GiB
     *-bank:0
          description: DIMM [empty]
          physical id: 0
          slot: DIMM A
     *-bank:1
          description: SODIMM DDR4 Synchronous 3200 MHz (0,3 ns)
          product: 4ATF1G64HZ-3G2E2
          vendor: Micron Technology
          physical id: 1
          serial: 2CD53823
          slot: DIMM B
          size: 8GiB
          width: 64 bits
          clock: 3200MHz (0.3ns)
  *-cache:0
       description: L1 cache
       physical id: 3f
       slot: L1 Cache
       size: 384KiB
       capacity: 384KiB
       capabilities: synchronous internal write-back unified
       configuration: level=1
  *-cache:1
       description: L2 cache
       physical id: 40
       slot: L2 Cache
       size: 1536KiB
       capacity: 1536KiB
       capabilities: synchronous internal write-back unified
       configuration: level=2
  *-cache:2
       description: L3 cache
       physical id: 41
       slot: L3 Cache
       size: 12MiB
       capacity: 12MiB
       capabilities: synchronous internal write-back unified
       configuration: level=3
  *-memory UNCLAIMED
       description: RAM memory
       product: Comet Lake PCH Shared SRAM
       vendor: Intel Corporation
       physical id: 14.2
       bus info: pci@0000:00:14.2
       version: 00
       width: 64 bits
       clock: 33MHz (30.3ns)
       capabilities: pm cap_list
       configuration: latency=0
       resources: memory:ed542000-ed543fff memory:ed54a000-ed54afff

Albercoc
  • 123
  • 1
  • 5
  • Run `memtest`; it should be available through the grub menu... – Levente May 13 '21 at 23:54
  • Also, buying a laptop with 8GB memory was kind of a mistake. Now you could buy more RAM, but that could become your next headache; when your RAM units are not 100% matching, that could, in theory, lead to further similar problems. I would get the current RAM out, and would buy and install a minimum of 16GB anew... – Levente May 13 '21 at 23:56
  • Also, since SWAP involves the disk too, test the disk as well: it's called SMART tools, and is available through e.g. the Gnome Disks app. If it's an NVMe SSD, then possibly directly through `smartmontools`... – Levente May 13 '21 at 23:59
  • Also, look at heynnema's answers, sorted by new: https://askubuntu.com/users/4272/heynnema?tab=answers&sort=newest and search on these pages for `freez` and `swap`. I had seen him helping a lot of people with similar issues recently: look through those posts. – Levente May 14 '21 at 00:04
  • Your swap is completely used up. Edit your question and show me `free -h` and `sudo swapon -s`. Start comments to me with @heynnema or I'll miss them. – heynnema May 14 '21 at 00:42
  • @Levente thank you for the comments. I added the output of ```smart-log``` to the edited question. Is there anything suspicious there? Or are there other relevant tests I could conduct and report here? – Albercoc May 14 '21 at 03:11
  • You seem to be getting a lot of good suggestions already. I think I would just add that maybe returning the PC isn't a great idea. At least, the PC doesn't seem "broken" to me. No matter how much RAM you get -- 8 GB or 16 GB -- you will have a limit. Perhaps combined with what others are saying, you can consider another browser and/or try to open up less tabs. Or maybe a specific plugin is causing you problems? – Ray May 14 '21 at 03:27

1 Answers1

5

SWAP

Your /swapfile is too small at 2G... let's increase it to 4G...

enter image description here

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 8G 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

Update #1:

IF you were going to add memory, you'd want to end up with a matched set of SODIMMs, so get another one of these for 16G total RAM...

enter image description here

heynnema
  • 68,647
  • 15
  • 124
  • 180
  • Thank you very much @heynnema for your detailed instructions. Everything worked smoothly. I confirm the line in /etc/fstab. The output of ```free - h``` is added to the question. As to whether this solves the issue, I do not know yet. I will recreate the same conditions tomorrow to see if it crashes again. Anyway it looks strange that this happens only from browsing webpages without heavy data. Do you also think that an 8Gb RAM is way too short for nowadays standards? – Albercoc May 14 '21 at 01:53
  • I just understood the first lines of the ```top``` monitoring that I put in the question... So, answering myself: with this "light" usage I filled up nearly all the RAM, and also the 2 G of the extra SWAP space. It feels like I would need either **much more RAM** or much more SWAP space just for basic internet browsing. This is a bit puzzling. – Albercoc May 14 '21 at 02:26
  • @Albercoc Are you using Chrome or Firefox, or something else? Yes, if you show me a complete `top` output (no reason to redact any info), I may tell you that you need more RAM. Also show me `sudo lshw -C memory`. – heynnema May 14 '21 at 03:14
  • @Albercoc Once you've decided if my answer has helped with the problem, please remember to accept it by clicking on the checkmark icon that appears just to the left of my answer. Thanks! – heynnema May 14 '21 at 03:17
  • I just added the full output of ```top``` and ```sudo lshw -C memory``` to the question. Before calling ```top```, I opened 50 tabs in firefox, similarly to what triggered the crash. Doing the same in chrome uses a similar amount of memory, although there all the processes have COMMAND 'chrome' (and not 'Web Content'). I'm worried that this happens without running actually heavy programs. – Albercoc May 14 '21 at 11:25
  • 1
    @Albercoc But... when opening all of those tabs, did the system continue to work? It would have frozen with the smaller swap. Also... 50 tabs open in a web browser... if that's your normal usage... is nuts. Nobody can actively use/manage that many open tabs... and you can see what it does to memory. On a different note... are you connecting via wifi? In `top` I see a number of network-related, and iwlwifi-related processes that are a little strange. – heynnema May 14 '21 at 12:28
  • Yes I'm connecting via wifi to the university network. Anyway, I understood how the RAM/SWAP works with this discussion, for which I'm very grateful. I will extend the RAM in the near future. About the number of firefox tabs: I was searching for some product in ebay, and simply didn't bother to close the tabs. My idea was that this computer should support something like that without crashing. I just did the same exercise on a MacBook also with 8Gb and it used way less memory to open the same pages. I will post that as a separate question though. Thank you very much @heynnema. – Albercoc May 14 '21 at 13:40