我正在运行 Ubuntu 18.04.4,由于某种原因,我的启动时间非常慢,这是由我的内核引起的。以下是systemd-analyze time
~ ᐅ systemd-analyze time
Startup finished in 1min 17.224s (kernel) + 13.352s (userspace) = 1min 30.576s
graphical.target reached after 13.347s in userspace
所以我不太清楚为什么会出现这种情况。
我正在运行这个内核版本
~ ᐅ uname -r
4.15.0-91-generic
另外,我的操作系统安装在 SSD 驱动器上,因此应该很快,以前速度很快,但不久前的某个时候它就变慢了。
任何帮助都将不胜感激。如果我需要运行其他命令,请告诉我,我会在这里发布结果。
编辑:
输出systemd-analyze critical-chain
:
~ ᐅ 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 @15.969s
└─multi-user.target @15.969s
└─docker.service @11.929s +4.040s
└─network-online.target @11.928s
└─NetworkManager-wait-online.service @4.093s +7.834s
└─NetworkManager.service @3.272s +817ms
└─dbus.service @3.068s
└─basic.target @3.067s
└─sockets.target @3.067s
└─docker.socket @3.066s +753us
└─sysinit.target @3.063s
└─swap.target @3.063s
└─dev-mapper-cryptswap1.swap @3.058s +5ms
└─dev-mapper-cryptswap1.device @3.057s
输出systemd-analyze blame
:
~ ᐅ systemd-analyze blame
11.199s apt-daily.service
7.834s NetworkManager-wait-online.service
4.040s docker.service
2.772s dev-sdc1.device
1.606s snapd.service
1.539s apparmor.service
1.260s motd-news.service
989ms plymouth-quit-wait.service
871ms mysql.service
865ms phpsessionclean.service
841ms dev-loop11.device
841ms dev-loop9.device
835ms dev-loop10.device
829ms dev-loop8.device
817ms NetworkManager.service
743ms dev-loop0.device
741ms dev-loop1.device
741ms systemd-journal-flush.service
732ms dev-loop2.device
723ms dev-loop3.device
691ms ModemManager.service
676ms networkd-dispatcher.service
641ms systemd-timesyncd.service
638ms udisks2.service
612ms apache2.service
575ms timidity.service
570ms dev-loop6.device
559ms dev-loop7.device
556ms dev-loop4.device
542ms dev-loop5.device
462ms apt-daily-upgrade.service
412ms networking.service
410ms snap-slack-22.mount
409ms snap-gnome\x2d3\x2d28\x2d1804-116.mount
406ms snap-core18-1668.mount
405ms snap-gtk\x2dcommon\x2dthemes-1474.mount
405ms snap-core-8689.mount
404ms snap-gtk\x2dcommon\x2dthemes-1440.mount
403ms snap-slack-21.mount
403ms fwupd.service
402ms accounts-daemon.service
402ms snap-insomnia-62.mount
397ms grub-common.service
391ms systemd-resolved.service
355ms systemd-logind.service
247ms nvidia-persistenced.service
246ms sysstat.service
244ms keyboard-setup.service
230ms snap-insomnia-61.mount
229ms snap-core-8592.mount
225ms snap-core18-1705.mount
222ms polkit.service
219ms snap-gnome\x2d3\x2d28\x2d1804-110.mount
217ms systemd-rfkill.service
212ms binfmt-support.service
200ms systemd-sysctl.service
193ms systemd-modules-load.service
192ms systemd-udevd.service
183ms rsyslog.service
180ms speech-dispatcher.service
180ms apport.service
179ms pppd-dns.service
179ms avahi-daemon.service
176ms thermald.service
174ms wpa_supplicant.service
167ms gpu-manager.service
167ms lm-sensors.service
160ms postgresql.service
144ms dns-clean.service
141ms console-setup.service
140ms systemd-tmpfiles-setup-dev.service
136ms gdm.service
131ms upower.service
125ms systemd-udev-trigger.service
118ms systemd-journald.service
98ms apport-autoreport.service
98ms sys-kernel-debug.mount
96ms dev-hugepages.mount
95ms systemd-remount-fs.service
93ms dev-mqueue.mount
93ms [email protected]
91ms colord.service
76ms proc-sys-fs-binfmt_misc.mount
69ms resolvconf.service
61ms ufw.service
60ms kmod-static-nodes.service
50ms bolt.service
35ms systemd-random-seed.service
33ms [email protected]
32ms systemd-update-utmp.service
31ms packagekit.service
27ms [email protected]
24ms systemd-tmpfiles-setup.service
16ms snapd.seeded.service
14ms resolvconf-pull-resolved.service
13ms alsa-restore.service
13ms plymouth-start.service
11ms plymouth-read-write.service
10ms kerneloops.service
5ms dev-mapper-cryptswap1.swap
5ms ureadahead-stop.service
4ms systemd-update-utmp-runlevel.service
4ms systemd-user-sessions.service
2ms rtkit-daemon.service
2ms snapd.socket
2ms setvtrgb.service
1ms sys-fs-fuse-connections.mount
1ms sys-kernel-config.mount
753us docker.socket
答案1
实际上我刚刚意识到这不再是问题。
~ ᐅ systemd-analyze time
Startup finished in 3.010s (kernel) + 12.969s (userspace) = 15.979s
graphical.target reached after 12.964s in userspace
目前我使用的是这个内核版本:
~ ᐅ uname -r
4.15.0-99-generic