Boot

在 Pop!_OS 21.10 上診斷出異常長的啟動時間

  • April 29, 2022

最近將我的電腦從 Win10 切換到 Pop OS。注意到到達登錄螢幕需要更長的時間:之前感覺非常即時,現在需要超過 1 分鐘。它使用快速 NVME M.2 和 Ryzen 7-5800h 啟動,所以我知道它不受硬體限制。

在終端中進行了一些探勘,這就是我發現的:

jianzen@dragon-7:~$ systemd-analyze
Startup finished in 5.520s (firmware) + 388ms (loader) + 4.798s (kernel) + 1min 37.591s (userspace) = 1min 48.299s 
graphical.target reached after 1min 37.544s in userspace

jianzen@dragon-7:~$ systemd-analyze blame
6.388s NetworkManager-wait-online.service
5.102s plymouth-quit-wait.service
562ms docker.service
305ms accounts-daemon.service
274ms man-db.service
...

jianzen@dragon-7:~$ systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

graphical.target @1min 37.544s
└─multi-user.target @1min 37.544s
 └─docker.service @1min 36.981s +562ms
   └─network-online.target @1min 36.950s
     └─NetworkManager-wait-online.service @1min 30.560s +6.388s
       └─NetworkManager.service @1min 30.483s +64ms
         └─dbus.service @1min 30.481s
           └─basic.target @1min 30.477s
             └─sockets.target @1min 30.477s
               └─cups.socket @1min 30.589s
                 └─sysinit.target @1min 30.443s
                   └─systemd-backlight@backlight:acpi_video0.service @1.820s +3ms
                     └─system-systemd\x2dbacklight.slice @1.819s
                       └─system.slice @130ms
                         └─-.slice @130ms

沒有任何跡象表明這blame是一個罪魁禍首,並且在critical-chain它的瓶頸處sysinit.target,所以我真的不知道下一步該去哪裡找出導致如此緩慢的啟動的原因。

編輯:澄清文件系統的附加資訊。

jianzen@dragon-7:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme1n1     259:0    0 931.5G  0 disk 
├─nvme1n1p1 259:1    0 431.5G  0 part /mnt/SLibrary
└─nvme1n1p2 259:2    0   500G  0 part /mnt/Drive 2
nvme0n1     259:3    0 476.9G  0 disk 
├─nvme0n1p1 259:4    0     3G  0 part /boot/efi
├─nvme0n1p2 259:5    0    30G  0 part /home
├─nvme0n1p3 259:6    0    30G  0 part [SWAP]
└─nvme0n1p4 259:7    0 413.9G  0 part /

jianzen@dragon-7:~$ 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>
PARTUUID=1e9f9308-e092-4249-b178-4c1e61d9bd37  /boot/efi  vfat  umask=0077  0  0
UUID=375f4eac-da6d-4d87-a17a-aed548fe7961  /home  ext4  noatime,errors=remount-ro  0  0
/dev/mapper/cryptswap  none  swap  defaults  0  0
UUID=7f37168f-738f-475e-b593-237ccf58d0a5  /  ext4  noatime,errors=remount-ro  0  0
/dev/disk/by-uuid/FCC2A5FFC2A5BE70 /mnt/Drive\0402 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Drive%202 0 0
/dev/disk/by-uuid/6bee998f-b10b-4d1e-951a-a86b6d1b8b59 /mnt/SLibrary auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=SLibrary 0 0

編輯鉑。2 Runningdmesg會出現以下錯誤(以及其他所有錯誤):

[    0.240256] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.PB2], AE_NOT_FOUND (20210930/dswload2-162)
[    0.240269] ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20210930/psobject-220)
[    0.839449] integrity: Problem loading X.509 certificate -65

[    4.826083] ================================================================================
[    4.826138] UBSAN: invalid-load in /build/linux-RFp8Q8/linux-5.16.19/drivers/net/wireless/mediatek/mt76/dma.c:162:13
[    4.826199] load of value 103 is not a valid value for type '_Bool'

[   98.377451] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership

[  114.634906] ================================================================================
[  114.634914] UBSAN: invalid-load in /build/linux-RFp8Q8/linux-5.16.19/net/mac80211/status.c:1164:21
[  114.634921] load of value 255 is not a valid value for type '_Bool'
[  120.040061] [drm:nv_drm_master_set [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to grab modeset ownership

[  355.714107] TCP: wlp4s0: Driver has suspect GRO implementation, TCP performance may be compromised.

哦,我的,你有很多清單。

我會看看它:

$$ 0.240256 $$ACPI BIOS 錯誤(錯誤):無法解析符號 $$ _SB.PCI0.PB2 $$, AE_NOT_FOUND (20210930/dswload2-162)$$ 0.240269 $$ ACPI 錯誤:AE_NOT_FOUND,在名稱查找/目錄期間 (20210930/psobject-220)

這沒什麼大不了的,只是您的核心不支持某些 BIOS 功能。您可以使用它或在啟動時關閉 acpi acpi=off。沒有大礙。

$$ 0.839449 $$完整性:載入 X.509 證書時出現問題 -65

應該解決這個問題。看起來您正在通過 UEFI 啟動,請檢查含義。(您必須簽署引導過程和模組 - 請參閱簽署核心模組

$$ 4.826138 $$UBSAN:/build/linux-RFp8Q8/linux-5.16.19/drivers/net/wireless/mediatek/mt76/dma.c:162:13 中的無效載入 $$ 4.826199 $$值 103 的負載不是類型“_Bool”的有效值 114.634914] UBSAN:/build/linux-RFp8Q8/linux-5.16.19/net/mac80211/status.c:1164:21 中的無效負載$$ 114.634921 $$值 255 的負載不是類型“_Bool”的有效值

您的無線驅動程序有問題,可能存在一些錯誤,因為您看到值 103 或 255 不是_Bool。可能某些東西沒有正確辨識。您可以檢查來源。

$$ 98.377451 $$ $$ drm:nv_drm_master_set [nvidia_drm $$]錯誤 $$ nvidia-drm $$ $$ GPU ID 0x00000100 $$未能獲取模式集所有權

啊 nvidia 專有驅動程序的問題。好吧,您必須搜尋錯誤,這必須由Nvidia自己修復,因為您無法在此處查看原始碼。嘗試搜尋它。nvidia-drm可能是模組中的一些錯誤。

$$ 355.714107 $$TCP:wlp4s0:驅動程序有可疑的 GRO 實現,TCP 性能可能會受到影響。

這是嘗試設置 GRO(通用接收解除安裝)並且它不喜歡這些值。您可以檢查您的核心是否具有進入核心的 RH 修復程序。有關更多資訊,請參閱驅動程序已懷疑 GRO 實施…

**編輯:**在 Debian bookworm 上發布我的啟動速度(帶有 Intel(R) Core(TM) i5-8350U CPU 的 Intel 筆記本):

systemd-analyze
Startup finished in 18.763s (firmware) + 7.674s (loader) + 13.889s (kernel) + 6.821s (userspace) = 47.148s 
graphical.target reached after 6.795s in userspace

如果我不得不猜測是什麼佔用了您的啟動時間,那將是 Nvidia 驅動程序。您可以嘗試 Nouveau 驅動程序,看看啟動是否有所改善。

引用自:https://unix.stackexchange.com/questions/699557