编辑:由于新手,我搞砸了下面的安装,并尝试了 bleachbit 和更新,中间没有重启可能有这种影响。可以修复大部分问题,但感觉不对。所以我转到了 19.10 的全新安装。系统有 6GB 的 RAM,安装再次选择分配太少的交换空间(仍然只有 2GB,而之前安装的是 1GB)然而在 19.10 中物理 RAM 填满的速度并没有那么快,正在使用的交换空间在使用 10 小时后约为 500MB,而 19.04 版本在使用一小时左右后就会填满。3 小时后不得不重启。所以,至少对我来说,19.10 中的内存管理似乎有所改进,或者 19.04 版本中存在问题。我仍然分配了 6GB 内存,只是为了确保万无一失。运行 conky 我可以监控一些东西,我认为这是 Linux 应该运行的方式。因此,我应该不是唯一一个在 Disco Dingo 上遇到此问题的人,请尝试升级到较新的版本。
系统按照我在问题描述中所述执行。我一直在尝试找出哪里出了问题,通过“glances”和“iotop”,我找到了这个问题描述。交换和内存已满,能够在一段时间内保持在 99% 左右(通常需要几个小时系统才会无响应),然后 iowait 就开始飙升。发生这种情况的那一刻,hdd led 开始满载,大多数(如果不是全部)进程的磁盘读写在 iotop 中显示为 0 到几十 MB/s。它没有时间再更新,glances 也没有。唯一有效的方法是硬重置。我每天需要多次这样做,这让我的 Linux 体验很糟糕。
在过去几周里,我能找到的最好的信息就是来自一个遇到了与我的笔记本电脑相同问题的人的这个问题描述。 https://unix.stackexchange.com/questions/373312/oom-killer-doesnt-work-properly-leads-to-a-frozen-os
这是一个严重的问题,似乎有更多人,甚至是经验丰富的人,比我遇到的要多得多。然而,似乎没有人知道该向哪里求助。要验证上述内容,请查阅上述链接及其链接和评论。
有人吗?有什么提示或建议吗?也许可以求助于某个人?
以下是我的系统规格和输出,我将列出以保证完整性。但是,我不确定这是否有任何好处。如果需要任何其他数据,请向我提供所需的命令,我会很乐意执行它们。
echo $MACHTYPE
x86_64-pc-linux-gnu
和
cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.04
DISTRIB_CODENAME=disco
DISTRIB_DESCRIPTION="Ubuntu 19.04"
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco
和
sudo vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 443648 1339308 19684 897180 1 9 48 41 674 536 22 7 66 5 0
和
lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 35,3M 1 loop /snap/gtk-common-themes/1198
loop1 7:1 0 54,4M 1 loop /snap/core18/1144
loop2 7:2 0 2,3M 1 loop /snap/gotop/3
loop3 7:3 0 4,2M 1 loop /snap/gnome-calculator/501
loop4 7:4 0 117,2M 1 loop /snap/screencloud/2
loop5 7:5 0 4M 1 loop /snap/gnome-calculator/406
loop6 7:6 0 317,5M 1 loop /snap/pycharm-educational/14
loop7 7:7 0 14,8M 1 loop /snap/gnome-characters/254
loop8 7:8 0 140,7M 1 loop /snap/gnome-3-26-1604/92
loop9 7:9 0 53,7M 1 loop /snap/core18/941
loop10 7:10 0 12,6M 1 loop /snap/dmd/74
loop11 7:11 0 956K 1 loop /snap/gnome-logs/73
loop12 7:12 0 317,8M 1 loop /snap/pycharm-educational/16
loop13 7:13 0 89M 1 loop /snap/core/7713
loop14 7:14 0 6,5M 1 loop /snap/gnome-clocks/198
loop15 7:15 0 65,9M 1 loop /snap/discord/93
loop16 7:16 0 151M 1 loop /snap/gnome-3-28-1804/31
loop17 7:17 0 52,2M 1 loop /snap/tvheadend/86
loop18 7:18 0 149,9M 1 loop /snap/gnome-3-28-1804/71
loop19 7:19 0 7,9M 1 loop /snap/amass/706
loop20 7:20 0 6,9M 1 loop /snap/dub/37
loop21 7:21 0 42,8M 1 loop /snap/gtk-common-themes/1313
loop22 7:22 0 320,2M 1 loop /snap/pycharm-community/150
loop23 7:23 0 26,7M 1 loop /snap/sickgear/486
loop24 7:24 0 1008K 1 loop /snap/gnome-logs/61
loop25 7:25 0 373,5M 1 loop /snap/anbox/158
loop26 7:26 0 89,3M 1 loop /snap/core/6673
loop27 7:27 0 14,8M 1 loop /snap/gnome-characters/317
loop28 7:28 0 202,9M 1 loop /snap/vlc/1049
loop29 7:29 0 320,9M 1 loop /snap/pycharm-community/155
loop30 7:30 0 310,8M 1 loop
loop31 7:31 0 8M 1 loop /snap/amass/711
sda 8:0 0 55,9G 0 disk
└─sda1 8:1 0 55,9G 0 part
├─ubuntu--vg-root 253:0 0 54,9G 0 lvm /
└─ubuntu--vg-swap_1 253:1 0 976M 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
和
sudo lshw -short
H/W path Device Class Description
=======================================================
system H36ST (To be filled by O.E.M.)
/0 bus H36ST
/0/0 memory 64KiB BIOS
/0/4 processor Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz
/0/4/5 memory 32KiB L1 cache
/0/4/6 memory 256KiB L2 cache
/0/4/7 memory 3MiB L3 cache
/0/25 memory 6GiB System Memory
/0/25/0 memory 4GiB SODIMM DDR3 Synchronous 1067 MHz (0,9 ns)
/0/25/1 memory 2GiB SODIMM DDR3 Synchronous 1067 MHz (0,9 ns)
/0/100 bridge Core Processor DRAM Controller
/0/100/1 bridge Core Processor PCI Express x16 Root Port
/0/100/1/0 display Madison [Mobility Radeon HD 5650/5750 / 6530M/6550M]
/0/100/1/0.1 multimedia Redwood HDMI Audio [Radeon HD 5000 Series]
/0/100/2 display Core Processor Integrated Graphics Controller
/0/100/16 communication 5 Series/3400 Series Chipset HECI Controller
/0/100/1a bus 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
/0/100/1a/1 usb1 bus EHCI Host Controller
/0/100/1a/1/1 bus Integrated Rate Matching Hub
/0/100/1a/1/1/5 communication Bluetooth Module
/0/100/1b multimedia 5 Series/3400 Series Chipset High Definition Audio
/0/100/1c bridge 5 Series/3400 Series Chipset PCI Express Root Port 1
/0/100/1c.1 bridge 5 Series/3400 Series Chipset PCI Express Root Port 2
/0/100/1c.1/0 wlp3s0 network AR9285 Wireless Network Adapter (PCI-Express)
/0/100/1c.2 bridge 5 Series/3400 Series Chipset PCI Express Root Port 3
/0/100/1c.5 bridge 5 Series/3400 Series Chipset PCI Express Root Port 6
/0/100/1c.5/0 enp6s0 network AR8131 Gigabit Ethernet
/0/100/1d bus 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
/0/100/1d/1 usb2 bus EHCI Host Controller
/0/100/1d/1/1 bus Integrated Rate Matching Hub
/0/100/1d/1/1/1 input Compact Optical Mouse 500
/0/100/1e bridge 82801 Mobile PCI Bridge
/0/100/1f bridge HM55 Chipset LPC Interface Controller
/0/100/1f.2 storage 5 Series/3400 Series Chipset 4 port SATA AHCI Controller
/0/100/1f.3 bus 5 Series/3400 Series Chipset SMBus Controller
/0/100/1f.6 generic 5 Series/3400 Series Chipset Thermal Subsystem
/0/101 bridge Core Processor QuickPath Architecture Generic Non-core Registers
/0/102 bridge Core Processor QuickPath Architecture System Address Decoder
/0/103 bridge Core Processor QPI Link 0
/0/104 bridge 1st Generation Core i3/5/7 Processor QPI Physical 0
/0/105 bridge 1st Generation Core i3/5/7 Processor Reserved
/0/106 bridge 1st Generation Core i3/5/7 Processor Reserved
/0/1 scsi0 storage
/0/1/0.0.0 /dev/sda disk 60GB OCZ-VERTEX3
/0/1/0.0.0/1 /dev/sda1 volume 55GiB Linux LVM Physical Volume partition
/0/2 scsi1 storage
/0/2/0.0.0 /dev/cdrom disk DVD A DS8A4S
/1 power To Be Filled By O.E.M.
和
lspci -k
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 12)
Subsystem: Pegatron Core Processor DRAM Controller
00:01.0 PCI bridge: Intel Corporation Core Processor PCI Express x16 Root Port (rev 12)
Kernel driver in use: pcieport
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 12)
Subsystem: Pegatron Core Processor Integrated Graphics Controller
Kernel driver in use: i915
Kernel modules: i915
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset HECI Controller
Kernel driver in use: mei_me
Kernel modules: mei_me
00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
Kernel driver in use: ehci-pci
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset High Definition Audio
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)
Kernel driver in use: pcieport
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06)
Kernel driver in use: pcieport
00:1c.2 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 (rev 06)
Kernel driver in use: pcieport
00:1c.5 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 (rev 06)
Kernel driver in use: pcieport
00:1d.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
Kernel driver in use: ehci-pci
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
00:1f.0 ISA bridge: Intel Corporation HM55 Chipset LPC Interface Controller (rev 06)
Subsystem: Pegatron HM55 Chipset LPC Interface Controller
Kernel driver in use: lpc_ich
Kernel modules: lpc_ich
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset 4 port SATA AHCI Controller
Kernel driver in use: ahci
Kernel modules: ahci
00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset SMBus Controller
Kernel driver in use: i801_smbus
Kernel modules: i2c_i801
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06)
Subsystem: Pegatron 5 Series/3400 Series Chipset Thermal Subsystem
Kernel driver in use: intel ips
Kernel modules: intel_ips
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Madison [Mobility Radeon HD 5650/5750 / 6530M/6550M]
Subsystem: Pegatron Madison [Mobility Radeon HD 5650/5750 / 6530M/6550M]
Kernel driver in use: radeon
Kernel modules: radeon
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Redwood HDMI Audio [Radeon HD 5000 Series]
Subsystem: Pegatron Redwood HDMI Audio [Radeon HD 5000 Series]
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
03:00.0 Network controller: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
Subsystem: AzureWave AW-NE785 / AW-NE785H 802.11bgn Wireless Full or Half-size Mini PCIe Card
Kernel driver in use: ath9k
Kernel modules: ath9k
06:00.0 Ethernet controller: Qualcomm Atheros AR8131 Gigabit Ethernet (rev c0)
Subsystem: Pegatron AR8131 Gigabit Ethernet
Kernel driver in use: atl1c
Kernel modules: atl1c
3f:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
Subsystem: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers
3f:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
Subsystem: Intel Corporation Core Processor QuickPath Architecture System Address Decoder
3f:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
Subsystem: Intel Corporation Core Processor QPI Link 0
3f:02.1 Host bridge: Intel Corporation 1st Generation Core i3/5/7 Processor QPI Physical 0 (rev 02)
Subsystem: Intel Corporation 1st Generation Core i3/5/7 Processor QPI Physical 0
3f:02.2 Host bridge: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved (rev 02)
Subsystem: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved
3f:02.3 Host bridge: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved (rev 02)
Subsystem: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved
和
Sudo free -h
total used free shared buff/cache available
Mem: 5,6Gi 3,6Gi 716Mi 542Mi 1,4Gi 1,3Gi
Swap: 975Mi 0B 975Mi
和
cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/ubuntu--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/ubuntu--vg-swap_1 none swap sw 0 0
和
sudo blkid
/dev/sda1: UUID="TJyyqj-69Oz-taq7-XNnr-Wa1c-KeQr-hE27gh" TYPE="LVM2_member" PARTUUID="d0b08d86-01"
/dev/mapper/ubuntu--vg-root: UUID="fec411bd-5ef0-46fa-8e9e-6dbe26ba91de" TYPE="ext4"
/dev/mapper/ubuntu--vg-swap_1: UUID="a8605c39-db25-47d2-99d3-b9ae97c59042" TYPE="swap"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/loop13: TYPE="squashfs"
/dev/loop14: TYPE="squashfs"
/dev/loop15: TYPE="squashfs"
/dev/loop16: TYPE="squashfs"
/dev/loop17: TYPE="squashfs"
/dev/loop18: TYPE="squashfs"
/dev/loop19: TYPE="squashfs"
/dev/loop20: TYPE="squashfs"
/dev/loop21: TYPE="squashfs"
/dev/loop22: TYPE="squashfs"
/dev/loop23: TYPE="squashfs"
/dev/loop24: TYPE="squashfs"
/dev/loop25: TYPE="squashfs"
/dev/loop26: TYPE="squashfs"
/dev/loop27: TYPE="squashfs"
/dev/loop28: TYPE="squashfs"
/dev/loop29: TYPE="squashfs"
/dev/loop30: TYPE="squashfs"
/dev/loop31: TYPE="squashfs"
答案1
来自评论...
只有 6G RAM,1G 交换空间太小了。我建议至少使用 6G 交换空间。这就是您遇到冻结问题并且磁盘抖动的原因。要么增加交换分区,要么改用 /swapfile。
要创建 /swapfile,您可以使用此作为指南...
sudo swapoff -a
sudo rm /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=6144
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
此外,如果只有 6G RAM,vm.swappiness 应该为 60 或更高。如果交换分区或 /swapfile 较大,我建议将其设置为 80。
要测试 vm.swappiness 的各种设置,请使用sudo sysctl vm.swappiness=80
。vm.swappiness 值大于默认值 60 时,会更多地使用交换空间。小于 60 的值会更多地使用 RAM。
为了使其永久生效,请在最后编辑/etc/sysctl.conf
并添加,然后重新启动。vm.swappiness=80
无论哪种情况,您都需要编辑/etc/fstab
...
注释掉这个...
/dev/mapper/ubuntu--vg-swap_1 none swap sw 0 0
并将其添加到 /swapfile...
/swapfile none swap sw 0 0