当 SWAP 激活时,Ubuntu 20.04 崩溃。我应该退回我的笔记本电脑吗?

Alb*_*coc 0 swap dell crash

我提出这样的问题是因为我也在寻找一些一般性的建议,除了可能是这个问题的技术解决方案。

只是用 Firefox 浏览(打开一百万个标签页),计算机最终冻结,我可以移动光标,但不能移动。我重新启动了计算机,并top在角落里留下了一个带有监控功能的终端。当它再次发生时,kswapd0使用了 99% 的 CPU。我拍了一张冻结屏幕的照片:

在此处输入图片说明

我想我kswapd0这个不错的答案中明白了什么。

问题:我应该尝试应用@Zzzach 的建议...并尝试一下,还是 ubuntu 崩溃的事实指向一个更基本的问题?更实际的是:我应该退回我的新笔记本电脑并再买一台(也许有更多内存)?

现在任何建议都会对我有用。谢谢你。

DELL Precision 3551(8Gb,i7-10 代,6 核)。直接购买DELL。预装 Ubuntu 20.04


编辑

的输出free -h由@heynnema的要求(之前做变化到交换配置):

              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
Run Code Online (Sandbox Code Playgroud)

sudo swapon -s

Filename                Type        Size    Used    Priority
/swapfile                               file        2097148 0   -2
Run Code Online (Sandbox Code Playgroud)

free -h 之后的变化

              total        used        free      shared  buff/cache   available
Mem:          7,4Gi       1,9Gi       141Mi       509Mi       5,3Gi       4,7Gi
Swap:         4,0Gi          0B       4,0Gi
Run Code Online (Sandbox Code Playgroud)

磁盘截图

在此处输入图片说明

sudo nvme smart-log /dev/nvme0(之后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
Run Code Online (Sandbox Code Playgroud)

顶部全输出

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 
Run Code Online (Sandbox Code Playgroud)

输出 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

Run Code Online (Sandbox Code Playgroud)

hey*_*ema 5

交换

你的/swapfile 在 2G 时太小了...让我们将其增加到 4G...

在此处输入图片说明

注意rmdd命令的不正确使用会导致数据丢失。建议复制/粘贴。

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
Run Code Online (Sandbox Code Playgroud)

编辑 /etc/fstab,使用sudo -H gedit /etc/fstabsudo pico /etc/fstab

确认 /etc/fstab 中的此 /swapfile 行...并确认没有其他“交换”行...在此行中使用空格...确认没有制表符...

/swapfile  none  swap  sw  0  0
Run Code Online (Sandbox Code Playgroud)
reboot                    # reboot and verify operation
Run Code Online (Sandbox Code Playgroud)

更新 #1:

如果您要添加内存,您最终会希望得到一组匹配的 SODIMM,所以再购买一个总内存为 16G 的 SODIMM...

在此处输入图片说明