我使用的是 Ubuntu 18.04、Gnome 3.28.2,没有双启动,也没有外部 USB 设备。偶尔我会看到一个黑色的终端屏幕,上面有几个错误,如下所示:
[5307.281824] systend-journald(539]:无法写入条目(24 个项目,581 字节),忽略:只读文件系统
当我看到这个黑屏时,计算机不再响应,我必须按下电源按钮重新启动。
硬件和操作系统信息:
(base) x@x:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8074028 0 8074028 0% /dev
tmpfs 1621272 2176 1619096 1% /run
/dev/mapper/ubuntu--vg-root 113125620 97117896 10218236 91% /
tmpfs 8106348 126836 7979512 2% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 8106348 0 8106348 0% /sys/fs/cgroup
/dev/loop3 1024 1024 0 100% /snap/gnome-logs/61
/dev/loop2 69248 69248 0 100% /snap/sublime-text/67
/dev/loop1 4224 4224 0 100% /snap/gnome-calculator/406
/dev/sda1 720368 150420 517556 23% /boot
/dev/loop4 90880 90880 0 100% /snap/core/7396
/dev/loop5 141696 141696 0 100% /snap/thunderbird/29
/dev/loop7 224256 224256 0 100% /snap/gimp/165
/dev/loop8 88448 88448 0 100% /snap/ubuntu-mate-welcome/335
/dev/loop11 19200 19200 0 100% /snap/communitheme/1593
/dev/loop10 58368 58368 0 100% /snap/powershell/36
/dev/loop12 268544 268544 0 100% /snap/gnss-sdr-next/285
/dev/loop14 207232 207232 0 100% /snap/vlc/770
/dev/loop19 15104 15104 0 100% /snap/gnome-characters/317
/dev/loop16 99840 99840 0 100% /snap/ubuntu-mate-welcome/296
/dev/loop15 48896 48896 0 100% /snap/riseup-vpn/152
/dev/loop20 15104 15104 0 100% /snap/gnome-characters/296
/dev/loop21 153216 153216 0 100% /snap/slack/16
/dev/loop22 153600 153600 0 100% /snap/gnome-3-28-1804/71
/dev/loop24 1280 1280 0 100% /snap/tinc-vpn/2
/dev/loop26 150144 150144 0 100% /snap/slack/17
/dev/loop27 43904 43904 0 100% /snap/gtk-common-themes/1313
/dev/loop30 153600 153600 0 100% /snap/gnome-3-28-1804/67
/dev/loop31 207744 207744 0 100% /snap/vlc/1049
/dev/loop33 58368 58368 0 100% /snap/powershell/34
/dev/loop34 16384 16384 0 100% /snap/communitheme/1768
/dev/loop35 88832 88832 0 100% /snap/ubuntu-mate-welcome/319
/dev/loop36 144128 144128 0 100% /snap/gnome-3-26-1604/90
/dev/loop37 127360 127360 0 100% /snap/electron-mail/13
/dev/loop38 36224 36224 0 100% /snap/gtk-common-themes/1198
/dev/loop39 153344 153344 0 100% /snap/chromium/849
/dev/loop40 77568 77568 0 100% /snap/cubicsdr-casept/4
/dev/loop41 3840 3840 0 100% /snap/gnome-system-monitor/95
/dev/loop42 19072 19072 0 100% /snap/communitheme/1524
/dev/loop43 55808 55808 0 100% /snap/core18/1098
/dev/loop45 327936 327936 0 100% /snap/pycharm-community/147
/dev/loop46 69248 69248 0 100% /snap/sublime-text/69
/dev/loop47 3840 3840 0 100% /snap/gnome-system-monitor/100
/dev/loop48 224384 224384 0 100% /snap/gimp/189
tmpfs 1621268 28 1621240 1% /run/user/121
tmpfs 1621268 76 1621192 1% /run/user/1000
/dev/loop49 144128 144128 0 100% /snap/gnome-3-26-1604/92
/dev/loop23 97024 97024 0 100% /snap/telegram-desktop/908
/dev/loop25 91264 91264 0 100% /snap/core/7713
/dev/loop6 1024 1024 0 100% /snap/gnome-logs/73
/dev/loop50 4352 4352 0 100% /snap/gnome-calculator/501
/dev/loop13 97152 97152 0 100% /snap/telegram-desktop/936
/dev/loop17 268544 268544 0 100% /snap/gnss-sdr-next/292
/dev/loop0 159616 159616 0 100% /snap/chromium/853
/dev/loop18 327936 327936 0 100% /snap/pycharm-community/150
/dev/loop28 55808 55808 0 100% /snap/core18/1144
(base) x@x:~$
硬件清单:
root@x:/home/x# lshw
x
description: Notebook
product: 80RU (LENOVO_MT_80RU_BU_idea_FM_Lenovo ideapad 700-15ISK)
vendor: LENOVO
version: Lenovo ideapad 700-15ISK
serial: R90K3F7XR9N0B631000C
width: 64 bits
capabilities: smbios-2.8 dmi-2.8 smp vsyscall32
configuration: administrator_password=enabled boot=normal chassis=notebook family=IDEAPAD frontpanel_password=disabled keyboard_password=disabled power-on_password=disabled sku=LENOVO_MT_80RU_BU_idea_FM_Lenovo ideapad 700-15ISK uuid=800CF8AE-A5E6-E511-88B2-08D40CB5171E
*-core
description: Motherboard
product: Lenovo ideapad 700-15ISK
vendor: LENOVO
physical id: 0
version: SDK0J40709 WIN
serial: R90K3F7X
slot: Part Component
*-cache:0
description: L1 cache
physical id: 2
slot: L1 Cache
size: 128KiB
capacity: 128KiB
capabilities: synchronous internal write-back data
configuration: level=1
*-cache:1
description: L1 cache
physical id: 3
slot: L1 Cache
size: 128KiB
capacity: 128KiB
capabilities: synchronous internal write-back instruction
configuration: level=1
*-cache:2
description: L2 cache
physical id: 4
slot: L2 Cache
size: 1MiB
capacity: 1MiB
capabilities: synchronous internal write-back unified
configuration: level=2
*-cache:3
description: L3 cache
physical id: 5
slot: L3 Cache
size: 6MiB
capacity: 6MiB
capabilities: synchronous internal write-back unified
configuration: level=3
*-cpu
description: CPU
product: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
vendor: Intel Corp.
physical id: 6
bus info: cpu@0
version: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
serial: To Be Filled By O.E.M.
slot: U3E1
size: 2349MHz
capacity: 3500MHz
width: 64 bits
clock: 100MHz
capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d cpufreq
configuration: cores=4 enabledcores=4 threads=8
*-memory
description: System Memory
physical id: 7
slot: System board or motherboard
size: 16GiB
*-bank:0
description: SODIMM DDR4 Synchronous 2133 MHz (0.5 ns)
product: CT8G4SFD8213.C16FBD1
vendor: Conexant (Rockwell)
physical id: 0
serial: 16141922
slot: ChannelA-DIMM0
size: 8GiB
width: 64 bits
clock: 2133MHz (0.5ns)
*-bank:1
description: Project-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <[email protected]>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2018-07-12 13:19+0000X-Generator: Launchpad (build 18719)Project-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <[email protected]>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2018-07-12 13:19+0000X-Generator: Launchpad (build 18719) [empty]
physical id: 1
slot: ChannelA-DIMM1
*-bank:2
description: SODIMM DDR4 Synchronous 2133 MHz (0.5 ns)
product: CT8G4SFD8213.C16FBD1
vendor: Conexant (Rockwell)
physical id: 2
serial: 16270421
slot: ChannelB-DIMM0
size: 8GiB
width: 64 bits
clock: 2133MHz (0.5ns)
*-bank:3
description: Project-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <[email protected]>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2018-07-12 13:19+0000X-Generator: Launchpad (build 18719)Project-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <[email protected]>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2018-07-12 13:19+0000X-Generator: Launchpad (build 18719) [empty]
physical id: 3
slot: ChannelB-DIMM1
*-firmware
description: BIOS
vendor: LENOVO
physical id: d
version: E5CN21WW
date: 12/28/2015
size: 128KiB
capacity: 8128KiB
capabilities: pci upgrade shadowing cdboot bootselect edd int5printscreen int9keyboard int14serial int17printer int10video pc98 acpi usb ls120boot zipboot biosbootspecification netboot
*-pci
description: Host bridge
product: Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers
vendor: Intel Corporation
physical id: 100
bus info: pci@0000:00:00.0
version: 07
width: 32 bits
clock: 33MHz
configuration: driver=skl_uncore
resources: irq:0
*-pci:0
description: PCI bridge
product: Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16)
vendor: Intel Corporation
physical id: 1
bus info: pci@0000:00:01.0
version: 07
width: 32 bits
clock: 33MHz
capabilities: pci pm msi pciexpress normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:120 ioport:d000(size=4096) memory:d1000000-d1ffffff ioport:a0000000(size=301989888)
*-display
description: 3D controller
product: GM107M [GeForce GTX 950M]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:01:00.0
version: a2
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: driver=nouveau latency=0
resources: irq:126 memory:d1000000-d1ffffff memory:a0000000-afffffff memory:b0000000-b1ffffff ioport:d000(size=128)
*-display
description: VGA compatible controller
product: HD Graphics 530
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 06
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:127 memory:d0000000-d0ffffff memory:c0000000-cfffffff ioport:e000(size=64) memory:c0000-dffff
*-usb
description: USB controller
product: 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller
vendor: Intel Corporation
physical id: 14
bus info: pci@0000:00:14.0
version: 31
width: 64 bits
clock: 33MHz
capabilities: pm msi xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:123 memory:d2200000-d220ffff
*-usbhost:0
product: xHCI Host Controller
vendor: Linux 4.15.0-60-generic xhci-hcd
physical id: 0
bus info: usb@1
logical name: usb1
version: 4.15
capabilities: usb-2.00
configuration: driver=hub slots=16 speed=480Mbit/s
*-usb:0
description: Keyboard
product: USB Receiver
vendor: Logitech
physical id: 1
bus info: usb@1:1
version: 29.01
capabilities: usb-2.00
configuration: driver=usbhid maxpower=98mA speed=12Mbit/s
*-usb:1
description: Video
product: Lenovo EasyCamera
vendor: Bison
physical id: 5
bus info: usb@1:5
version: 42.09
serial: 200901010001
capabilities: usb-2.00
configuration: driver=uvcvideo maxpower=500mA speed=480Mbit/s
*-usb:2
description: Bluetooth wireless interface
vendor: Intel Corp.
physical id: 7
bus info: usb@1:7
version: 0.01
capabilities: bluetooth usb-2.00
configuration: driver=btusb maxpower=100mA speed=12Mbit/s
*-usbhost:1
product: xHCI Host Controller
vendor: Linux 4.15.0-60-generic xhci-hcd
physical id: 1
bus info: usb@2
logical name: usb2
version: 4.15
capabilities: usb-3.00
configuration: driver=hub slots=8 speed=5000Mbit/s
*-generic:0
description: Signal processing controller
product: 100 Series/C230 Series Chipset Family Thermal Subsystem
vendor: Intel Corporation
physical id: 14.2
bus info: pci@0000:00:14.2
version: 31
width: 64 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list
configuration: driver=intel_pch_thermal latency=0
resources: irq:18 memory:d222a000-d222afff
*-communication
description: Communication controller
product: 100 Series/C230 Series Chipset Family MEI Controller #1
vendor: Intel Corporation
physical id: 16
bus info: pci@0000:00:16.0
version: 31
width: 64 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list
configuration: driver=mei_me latency=0
resources: irq:128 memory:d222c000-d222cfff
*-storage
description: SATA controller
product: HM170/QM170 Chipset SATA Controller [AHCI Mode]
vendor: Intel Corporation
physical id: 17
bus info: pci@0000:00:17.0
version: 31
width: 32 bits
clock: 66MHz
capabilities: storage msi pm ahci_1.0 bus_master cap_list
configuration: driver=ahci latency=0
resources: irq:124 memory:d2228000-d2229fff memory:d2230000-d22300ff ioport:e080(size=8) ioport:e088(size=4) ioport:e060(size=32) memory:d222e000-d222e7ff
*-pci:1
description: PCI bridge
product: 100 Series/C230 Series Chipset Family PCI Express Root Port #5
vendor: Intel Corporation
physical id: 1c
bus info: pci@0000:00:1c.0
version: f1
width: 32 bits
clock: 33MHz
capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:121 memory:d2100000-d21fffff
*-network
description: Wireless interface
product: Dual Band Wireless-AC 3165 Plus Bluetooth
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
version: 99
serial: 08:d4:0c:b5:17:1a
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-60-generic firmware=29.1044073957.0 ip=192.168.1.69 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:129 memory:d2100000-d2101fff
*-pci:2
description: PCI bridge
product: 100 Series/C230 Series Chipset Family PCI Express Root Port #6
vendor: Intel Corporation
physical id: 1c.5
bus info: pci@0000:00:1c.5
version: f1
width: 32 bits
clock: 33MHz
capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:122 ioport:c000(size=4096) memory:d2000000-d20fffff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0
version: 15
serial: 54:ee:75:94:08:75
size: 10Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=no multicast=yes port=MII speed=10Mbit/s
resources: irq:17 ioport:c000(size=256) memory:d2004000-d2004fff memory:d2000000-d2003fff
*-generic:1
description: Signal processing controller
product: 100 Series/C230 Series Chipset Family Serial IO UART #0
vendor: Intel Corporation
physical id: 1e
bus info: pci@0000:00:1e.0
version: 31
width: 64 bits
clock: 33MHz
capabilities: pm bus_master cap_list
configuration: driver=intel-lpss latency=0
resources: irq:20 memory:d222d000-d222dfff
*-isa
description: ISA bridge
product: HM170 Chipset LPC/eSPI Controller
vendor: Intel Corporation
physical id: 1f
bus info: pci@0000:00:1f.0
version: 31
width: 32 bits
clock: 33MHz
capabilities: isa bus_master
configuration: latency=0
*-memory UNCLAIMED
description: Memory controller
product: 100 Series/C230 Series Chipset Family Power Management Controller
vendor: Intel Corporation
physical id: 1f.2
bus info: pci@0000:00:1f.2
version: 31
width: 32 bits
clock: 33MHz (30.3ns)
capabilities: bus_master
configuration: latency=0
resources: memory:d2224000-d2227fff
*-multimedia
description: Audio device
product: 100 Series/C230 Series Chipset Family HD Audio Controller
vendor: Intel Corporation
physical id: 1f.3
bus info: pci@0000:00:1f.3
version: 31
width: 64 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list
configuration: driver=snd_hda_intel latency=64
resources: irq:130 memory:d2220000-d2223fff memory:d2210000-d221ffff
*-serial UNCLAIMED
description: SMBus
product: 100 Series/C230 Series Chipset Family SMBus
vendor: Intel Corporation
physical id: 1f.4
bus info: pci@0000:00:1f.4
version: 31
width: 64 bits
clock: 33MHz
configuration: latency=0
resources: memory:d222f000-d222f0ff ioport:efa0(size=32)
*-scsi:0
physical id: 0
logical name: scsi0
capabilities: emulated
*-disk
description: ATA Disk
product: ADATA SP550NS38
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 4B
serial: 2G4220000183
size: 111GiB (120GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=cb312d6a
*-volume:0
description: EXT4 volume
vendor: Linux
physical id: 1
bus info: scsi@0:0.0.0,1
logical name: /dev/sda1
logical name: /boot
version: 1.0
serial: 6480205e-88e0-4b20-b930-38dee5b56148
size: 731MiB
capacity: 731MiB
capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover 64bit extents ext4 ext2 initialized
configuration: created=2018-11-11 23:13:29 filesystem=ext4 lastmountpoint=/boot modified=2019-09-08 17:24:42 mount.fstype=ext4 mount.options=rw,relatime,data=ordered mounted=2019-09-08 17:24:42 state=mounted
*-volume:1
description: Extended partition
physical id: 2
bus info: scsi@0:0.0.0,2
logical name: /dev/sda2
size: 111GiB
capacity: 111GiB
capabilities: primary extended partitioned partitioned:extended
*-logicalvolume
description: Linux filesystem partition
physical id: 5
logical name: /dev/sda5
serial: 775a1793-1ea1-4fe2-bcd9-4880a3924ee0
size: 111GiB
capacity: 111GiB
width: 512 bits
capabilities: encrypted luks initialized
configuration: bits=512 cipher=aes filesystem=luks hash=sha256 mode=xts-plain64 version=1
*-scsi:1
physical id: 1
logical name: scsi2
capabilities: emulated
*-disk
description: ATA Disk
product: WDC WD10SPCX-24H
vendor: Western Digital
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sdb
version: 1A02
serial: WD-WXA1AB57JSDL
size: 931GiB (1TB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096 signature=30d5ab25
*-volume
description: EXT4 volume
vendor: Linux
physical id: 1
bus info: scsi@2:0.0.0,1
logical name: /dev/sdb1
version: 1.0
serial: 0210a406-4dce-4a43-ac18-82f1a30c8c2c
size: 931GiB
capacity: 931GiB
capabilities: primary journaled extended_attributes large_files huge_files dir_nlink 64bit extents ext4 ext2 initialized
configuration: created=2018-11-09 17:40:00 filesystem=ext4 label=1TB lastmountpoint=/media/x/1TB modified=2019-09-06 11:31:08 mounted=2019-09-06 11:31:04 state=clean
*-battery
product: Smart Battery
vendor: Intel Corp.
physical id: 1
version: 2008
serial: 1.0
slot: Rear
我进行了一次快速智能测试smartctl -l selftest /dev/sda
,结果显示:
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-60-generic] (local build)
=== START OF READ SMART DATA SECTION ===
Warning! SMART Self-Test Log Structure error: invalid SMART checksum.
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 90 -
# 2 Short offline Completed without error 00% 90 -
# 3 Short offline Completed without error 00% 90 -
# 4 Offline Completed without error 00% 90 -
# 5 Short offline Self-test routine in progress 90% 102 -
# 6 Short offline Completed without error 00% 51 -
答案1
简短回答:按照建议Arch wiki 上,尝试更新你的 SSD 的固件。
现在为什么,(仅针对那些想了解我是如何得出这个结论的人,也许可以在这种类型的故障排除中学习到一些有用的技巧 - 或者更好的是,根据需要礼貌地纠正我):
我也遇到了同样的问题,我也有 Ubuntu 18.04。我的根分区安装在三星 SSD 860 EVO 500GB 上。你似乎有一个 ADATA SSD。
我看到很多帖子都提到了这个问题,没有解决方案,通常的答案警告 SSD 文件系统可能存在问题、设备损坏等。我不这么认为。
对于 SSD,Ubuntu 默认启用定期 TRIM。fstrim.service
每周通过 进行一次。
根据man fstrim
:
Running fstrim frequently, or even using mount -o discard,
might negatively affect the lifetime of poor-quality SSD devices.
For most desktop and server systems a sufficient trimming frequency is once a week.
Note that not all devices support a queued trim, so each trim command
incurs a performance penalty on whatever else might be trying to use the disk at the time.
...这让我想到了以下场景以及我自己的场景假设(下面我将通过我自己的研究来支持这一点):
当fstrim
运行时(在本例中为每周),它肯定需要锁定正在整理的文件系统。与此同时,journald 试图将一些日志写入/var/log/journal/
,但它发现无法写入(在我看来,因为无论如何fstrim
它都忙于或忙于 SSD)。因此,它的投诉是:。/
journald
Failed to write entry (...) Read-only file system
这时你可能会插话说:“但是:等等!这没有意义。”好吧,确实,这些服务不应该同时争夺写入文件系统或锁定文件系统。但最引人注目的线索来自上述man
页面的引用:请注意,并非所有设备都支持排队修剪,因此每个修剪命令都会对当时试图使用磁盘的其他任何设备造成性能损失。
...这与我们在启动当天看到的情况一致,我们fstrim.service
决定以非常粗鲁的方式执行其操作,完全无视异步服务应该遵循的预期“礼仪”。
事实上,如果你journalctl -u fstrim.service
像我一样看一下,你可能会看到与此类似的许多块的序列:
-- Reboot --
Jul 13 00:00:13 foo systemd[1]: Starting Discard unused blocks...
Jul 13 00:02:43 foo fstrim[19452]: /Some/MountPoint: 79,4 GiB (85273759744 bytes) trimmed
Jul 13 00:02:43 foo fstrim[19452]: /: 22,4 GiB (24017248256 bytes) trimmed
Jul 13 00:02:43 foo systemd[1]: Started Discard unused blocks.
这是我一周前遇到的,当时我又遇到了上述问题。今天又出现了同样的问题。我不得不重启电脑。
请注意,“正在启动”和“已启动”之间的时间大约为 150 秒(2 分 30 秒)。在我的日志中,这个时间总是非常相似;有时可能大约为 3 到 3.5 分钟,不会更多。并且没有任何信息表明(就我而言)修剪失败。要么服务没有记录成功或失败(我不知道),要么这些消息显示“完成”。
在我的假设中,这听起来可能仍然很奇怪,如果消息显示的间隔是几百秒,为什么这会在很长一段时间内干扰日志写入?(哦,确实如此:在这种情况下我已经等了很长时间,但错误还是不断出现!)。好吧,我只能猜测错误只会在重试几次后出现,或者系统有太多错误排队等待打印到终端,不知何故,这变得非常慢。这只是我的猜测:如果有人能以技术上准确的方式解释这一点,请务必帮助或纠正我。
但事实是,在启动时“几乎挂起”之后,日志就会损坏。就我而言,我在 dmesg 的输出中看到了这一点,就在“半挂起”之后的下一次成功启动时:
[ 10.986870] systemd-journald[434]: File /var/log/journal/414716237ed94301a0e84b4204143c5b/system.journal corrupted or uncleanly shut down, renaming and replacing.
这是有道理的,因为我进行了强制重启。
最后一点也是我假设的重点是,我的(可能还有你的)SSD 设备缺乏对排队修剪的支持。在我的假设中,好消息是,这意味着我们的 SSD 文件系统或硬件没有损坏。这意味着我们在处理服务尝试创建system.journal
的文件时遇到了麻烦。system-journald
和,简短回答:最重要的是,我们应该尝试更新 SSD 的固件。
答案2
尝试升级你的内核。
在最近更新 Ubuntu 20.04 后,我每天晚上都会遇到同样的“写入条目”崩溃。
我使用的是廉价的 SSD,没有 DRAM,也没有其他答案建议的更新固件的选项。最后,我在某处读到,如果内核无法正常工作,系统可能会锁定并错误地将区域标记为“只读”,因此我更新到了较新的内核 (5.7.1),从那以后就再也没有遇到过这个问题。
如果您怀疑问题出在内核上,并想先测试一下这个理论,您可以在重启后进入启动屏幕上的“高级选项”,然后选择一个较旧版本的内核来运行。如果该内核适合您,那么您可能希望将其设置为暂时使用的内核,因为最新的内核是未签名的,需要您自己签名或关闭安全启动。
答案3
我们网络上的某个人意外地将以太网电缆插入一个端口,然后又环回到同一 VLAN 上的另一个端口。显然,这造成了混乱,导致网络瘫痪……
这导致我们网络上的许多 Linux VM 进入此 systemd-journald 写入错误循环。对于大多数主机来说,只需重新启动即可解决问题,其他主机则有损坏的分区,我需要运行fsck
(请参阅这里) 解决。