systemd-analyze 输出的内核部分是什么意思,为什么每天第一次启动都要花 10 分钟以上?

systemd-analyze 输出的内核部分是什么意思,为什么每天第一次启动都要花 10 分钟以上?

提出的 dublicate 并没有回答我的问题,因为尽管 apt-daily.service 和 apt-daily-upgrade.service 很可能是罪魁祸首,但 systemd-analyze blame 的输出并不能解释为什么内核需要几分钟。

内核部分是否还包括系统等待我输入加密密码的时间?

bruni@PROX15:~$ systemd-analyze 
Startup finished in 5.832s (firmware) + 5.182s (loader) + 9min 6.295s (kernel) + 1min 18.571s    (userspace) = 10min 35.882s
graphical.target reached after 9.110s in userspace

systemd-analyze 指责没有任何个人会在几分钟内发生。

这是相当高规格的硬件。

bruni@PROX15:uname -a
Linux PROX15 5.3.0-51-generic #44~18.04.2-Ubuntu SMP Thu Apr 23 14:27:18 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

bruni@PROX15:~$ systemd-analyze blame
     45.155s apt-daily.service
     24.310s apt-daily-upgrade.service
      6.287s NetworkManager-wait-online.service
      1.668s dev-mapper-kubuntu\x2d\x2dvg\x2droot.device
      1.173s systemd-journal-flush.service
      1.045s snapd.service
       761ms dev-loop1.device
       721ms dev-loop4.device
       708ms dev-loop5.device
       680ms mariadb.service
       676ms dev-loop6.device
       669ms dev-loop2.device
       653ms dev-loop0.device
       643ms dev-loop3.device
       585ms dev-loop8.device
       570ms dev-loop7.device
       556ms vboxdrv.service
       540ms dev-loop9.device
       526ms mpd.service
       516ms networkd-dispatcher.service
       504ms snap-core18-1754.mount
       490ms snap-pdftk-9.mount
       471ms dev-loop11.device
       468ms snap-scrcpy-217.mount
       461ms systemd-logind.service
       459ms dev-loop10.device
       427ms gpu-manager.service
       411ms ModemManager.service
       334ms snap-snapd-7264.mount
       311ms NetworkManager.service
       310ms snap-scrcpy-211.mount
       310ms ufw.service
       308ms snap-core18-1705.mount
       305ms udisks2.service
       266ms snap-core-8935.mount
       257ms snap-gnome\x2d3\x2d28\x2d1804-116.mount
       256ms snap-gtk\x2dcommon\x2dthemes-1506.mount
       240ms snap-snapd-6953.mount
       234ms upower.service
       222ms snap-rambox-13.mount
       212ms snap-core-9066.mount
       206ms accounts-daemon.service
       165ms thermald.service
       160ms wpa_supplicant.service
       151ms systemd-tmpfiles-setup-dev.service
       134ms grub-common.service
       126ms keyboard-setup.service
       120ms nvidia-persistenced.service
       116ms systemd-modules-load.service
       115ms tlp.service
       109ms systemd-udevd.service
       105ms apparmor.service
       ....

PS1:请注意,我并不是一个狂热的启动时间优化者,但这对我来说似乎不太正确......

PS2:如果我在初始启动后重新启动:

bruni@PROX15:~$ systemd-analyze
Startup finished in 8.433s (firmware) + 4.958s (loader) + 12.884s (kernel) + 14.714s (userspace) = 40.991s
graphical.target reached after 14.627s in userspace

PS3:

Startup finished in 5.900s (firmware) + 5.046s (loader) + 18min 18.402s (kernel) + 40.122s (userspace) = 19min 9.472s

用户空间中,graphic.target 在 10.695 秒后达到

根据评论要求,输出 systemd-analyze critical-chain。

graphical.target @10.695s
└─multi-user.target @10.694s
  └─kerneloops.service @10.681s +13ms
    └─network-online.target @10.679s
      └─NetworkManager-wait-online.service @4.394s +6.284s
        └─NetworkManager.service @4.142s +246ms
          └─dbus.service @3.880s
            └─basic.target @3.868s
              └─sockets.target @3.868s
                └─snapd.socket @3.862s +4ms
                  └─sysinit.target @3.859s
                    └─apparmor.service @3.673s +185ms
                      └─local-fs.target @3.670s
                        └─run-user-1001-doc.mount @30.922s
                          └─run-user-1001.mount @29.096s
                            └─swap.target @3.100s
                              └─dev-mapper-kubuntu\x2d\x2dvg\x2dswap_1.swap @3.045s +54ms
                                └─dev-mapper-kubuntu\x2d\x2dvg\x2dswap_1.device @3.033s

相关内容