Linux 内核启动时间严重增加;如何对此进行调查?

Linux 内核启动时间严重增加;如何对此进行调查?

从内核 4.5 开始,启动时间从 900 毫秒 (4.4.44) 增加到 2.1 秒 (4.9.5)。

我想修复,或者至少通过打开适当的错误报告来帮助开发人员,但我不知道提供哪些信息来填写有用的报告。

那么,如何调查这个内核启动时问题呢?

聚苯乙烯:我使用的是带有 Arch Linux x86_64 和 Gnome 的 Dell XPS 9343 (Broadwell)。
PS2:实际上我的系统中安装了 LTS 内核 (4.4.44) 和 -ck (4.9.5),我从 systemd-boot 菜单中选择它们,上面报告的时间是从命令中获取的systemd-analyze核心入口。
PS3:当我注意到(并测量)启动时间增加时,我注意到关机时也有同样的情况,但在这种情况下我不知道如何测量它。

编辑1:请求内核 4.9 的输出

[mattia@arch-xps ~]$ systemd-analyze blame
          2.356s dev-sda3.device
          1.648s systemd-fsck@dev-disk-by\x2duuid-88E7\x2d8ACB.service
          1.646s systemd-fsck@dev-disk-by\x2duuid-e2a87acb\x2d9e12\x2d4501\x2dbb
          1.346s tlp.service
          1.324s systemd-journald.service
          1.307s systemd-udev-trigger.service
          1.306s systemd-tmpfiles-setup-dev.service
          1.296s colord.service
          1.005s systemd-journal-flush.service
           947ms [email protected]
           944ms systemd-timesyncd.service
           854ms accounts-daemon.service
           564ms systemd-rfkill.service
           244ms org.cups.cupsd.service
           163ms packagekit.service
            89ms NetworkManager.service
            86ms bluetooth.service
            75ms systemd-logind.service
            53ms upower.service
            53ms [email protected]
            49ms polkit.service
            43ms systemd-udevd.service
            38ms wpa_supplicant.service
            36ms udisks2.service
            28ms systemd-sysctl.service
            25ms systemd-tmpfiles-clean.service
            22ms boot.mount
            20ms systemd-random-seed.service
            19ms gdm.service
            16ms geoclue.service
            16ms systemd-backlight@leds:dell::kbd_backlight.service
            14ms kmod-static-nodes.service
            13ms systemd-remount-fs.service
            11ms dev-sda2.swap
            11ms dev-mqueue.mount
            10ms systemd-tmpfiles-setup.service
            10ms sys-kernel-debug.mount
             8ms systemd-backlight@backlight:intel_backlight.service
             7ms home.mount
             6ms systemd-update-utmp.service
             6ms sys-kernel-config.mount
             6ms systemd-user-sessions.service
             5ms dev-hugepages.mount
             5ms rtkit-daemon.service
             3ms sys-fs-fuse-connections.mount
             3ms tmp.mount

[mattia@arch-xps ~]$ systemd-analyze critical-chain 
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @5.282s
└─gdm.service @5.258s +19ms
  └─systemd-user-sessions.service @5.244s +6ms
    └─nss-user-lookup.target @5.288s

编辑2:请求内核 4.4 的输出

[mattia@arch-xps ~]$ systemd-analyze blame
          1.356s systemd-fsck@dev-disk-by\x2duuid-e2a87acb\x2d9e12\x2d4501\x2dbb
          1.355s systemd-rfkill.service
           895ms [email protected]
           861ms tlp.service
           474ms dev-sda3.device
           379ms systemd-localed.service
           310ms systemd-hostnamed.service
           310ms systemd-timedated.service
           255ms systemd-timesyncd.service
           188ms org.cups.cupsd.service
           146ms systemd-journald.service
           112ms packagekit.service
            60ms bluetooth.service
            60ms NetworkManager.service
            59ms accounts-daemon.service
            58ms upower.service
            49ms systemd-udevd.service
            48ms systemd-fsck@dev-disk-by\x2duuid-88E7\x2d8ACB.service
            37ms [email protected]
            36ms polkit.service
            33ms systemd-udev-trigger.service
            25ms systemd-journal-flush.service
            24ms systemd-tmpfiles-setup-dev.service
            22ms udisks2.service
            17ms gdm.service
            16ms kmod-static-nodes.service
            16ms dev-sda2.swap
            16ms boot.mount
            15ms colord.service
            15ms sys-kernel-debug.mount
            13ms systemd-remount-fs.service
            13ms dev-hugepages.mount
            13ms geoclue.service
            13ms systemd-sysctl.service
            13ms home.mount
            10ms systemd-logind.service
             9ms sys-kernel-config.mount
             8ms wpa_supplicant.service
             8ms systemd-tmpfiles-setup.service
             7ms systemd-random-seed.service
             7ms systemd-backlight@leds:dell::kbd_backlight.service
             5ms systemd-update-utmp.service
             5ms rtkit-daemon.service
             4ms systemd-user-sessions.service
             4ms tmp.mount
             3ms systemd-backlight@backlight:intel_backlight.service
             3ms dev-mqueue.mount
             2ms sys-fs-fuse-connections.mount

[mattia@arch-xps ~]$ systemd-analyze critical-chain 
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @2.555s
└─gdm.service @2.536s +17ms
  └─systemd-user-sessions.service @2.525s +4ms
    └─nss-user-lookup.target @2.559s

编辑3:不,它们的尺寸大约相同。

[mattia@arch-xps ~]$ ls /boot/
total 62M
drwxr-xr-x  5 root root 4.0K Jan  1  1970 .
drwxr-xr-x 17 root root 4.0K Dec 10 17:31 ..
drwxr-xr-x  6 root root 4.0K Dec 14 17:49 EFI
drwxr-xr-x  2 root root 4.0K Jan 11 16:39 grub
drwxr-xr-x  3 root root 4.0K May 14  2016 loader
-rwxr-xr-x  1 root root  21M Jan 20 15:40 initramfs-linux-ck-fallback.img
-rwxr-xr-x  1 root root 5.7M Jan 20 15:40 initramfs-linux-ck.img
-rwxr-xr-x  1 root root  20M Jan 17 18:01 initramfs-linux-lts-fallback.img
-rwxr-xr-x  1 root root 5.6M Jan 17 18:01 initramfs-linux-lts.img
-rwxr-xr-x  1 root root 961K Nov 15 18:43 intel-ucode.img
-rwxr-xr-x  1 root root 4.6M Jan 20 15:38 vmlinuz-linux-ck
-rwxr-xr-x  1 root root 4.3M Jan 15 15:05 vmlinuz-linux-lts

编辑4:尝试使用官方存储库中的内核(请参阅第六条第七条评论),启动时间显着不同,为 1.3 秒,但仍然高于内核 4.4

[mattia@arch-xps ~]$ systemd-analyze blame
          1.979s dev-sda3.device
          1.369s systemd-journald.service
          1.347s colord.service
           871ms systemd-udev-trigger.service
           868ms [email protected]
           868ms systemd-tmpfiles-setup-dev.service
           793ms systemd-udevd.service
           782ms tlp.service
           508ms systemd-timesyncd.service
           503ms [email protected]
           473ms wpa_supplicant.service
           177ms org.cups.cupsd.service
           110ms packagekit.service
            85ms NetworkManager.service
            85ms systemd-journal-flush.service
            66ms systemd-fsck@dev-disk-by\x2duuid-e2a87acb\x2d9e12\x2d4501\x2dbb
            49ms upower.service
            47ms systemd-fsck@dev-disk-by\x2duuid-88E7\x2d8ACB.service
            44ms accounts-daemon.service
            28ms bluetooth.service
            27ms polkit.service
            24ms gdm.service
            22ms udisks2.service
            18ms systemd-rfkill.service
            16ms systemd-logind.service
            15ms geoclue.service
            13ms boot.mount
            13ms dev-hugepages.mount
            12ms dev-mqueue.mount
            11ms systemd-remount-fs.service
            11ms systemd-backlight@leds:dell::kbd_backlight.service
            11ms systemd-sysctl.service
            10ms sys-kernel-config.mount
             9ms dev-sda2.swap
             9ms kmod-static-nodes.service
             8ms systemd-user-sessions.service
             7ms home.mount
             7ms systemd-backlight@backlight:intel_backlight.service
             7ms systemd-tmpfiles-setup.service
             6ms systemd-update-utmp.service
             5ms tmp.mount
             5ms systemd-random-seed.service
             4ms rtkit-daemon.service
             4ms sys-fs-fuse-connections.mount
             2ms sys-kernel-debug.mount
[mattia@arch-xps ~]$ systemd-analyze critical-chain 
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @4.604s
└─gdm.service @4.397s +24ms
  └─systemd-user-sessions.service @4.379s +8ms
    └─nss-user-lookup.target @4.425s

相关内容