我提出这样的问题是因为我也在寻求一些一般性建议,除了可能针对这个问题的技术解决方案。
只是用 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
和sudo swapon -s
Filename Type Size Used Priority
/swapfile file 2097148 0 -2
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
磁盘截图
输出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
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
输出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
答案1
交换
您的 /swapfile 太小了,只有 2G……让我们将其增加到 4G……
笔记:错误使用rm
和dd
命令可能会导致数据丢失。建议复制/粘贴。
在里面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
sudo -H gedit /etc/fstab
使用或编辑 /etc/fstab sudo pico /etc/fstab
。
确认 /etc/fstab 中的此 /swapfile 行...并确认没有其他“交换”行...在此行中使用空格...确认没有制表符...
/swapfile none swap sw 0 0
reboot # reboot and verify operation
更新#1:
如果您要添加内存,您会希望最终得到一组匹配的 SODIMM,因此请再买一个这样的内存条,以获得 16G 的总 RAM...