我在 Ubuntu 18.04.1 上遇到了启动速度非常慢的问题。运行以下命令后
systemd-analyze blame
在终端中,我有一个很长的列表,其中包含重复的子列表
me@wht:/boot$ systemd-analyze blame
2.436s plymouth-quit-wait.service
2.005s [email protected]
1.788s NetworkManager-wait-online.service
1.136s snapd.service
1.127s mysql.service
793ms dev-sda2.device
775ms fwupd.service
707ms NetworkManager.service
569ms networkd-dispatcher.service
512ms udisks2.service
503ms plymouth-start.service
503ms systemd-journal-flush.service
388ms accounts-daemon.service
378ms grub-common.service
377ms ModemManager.service
357ms thermald.service
317ms polkit.service
308ms virtualbox-guest-utils.service
295ms snap-gnome\x2dlogs-61.mount
284ms avahi-daemon.service
277ms dev-loop9.device
249ms dev-loop10.device
248ms snap-core18-941.mount
247ms snap-gnome\x2d3\x2d26\x2d1604-86.mount
238ms dev-loop8.device
234ms snap-core-6964.mount
234ms dev-loop0.device
234ms dev-loop1.device
227ms dev-loop12.device
222ms snap-gnome\x2dcalculator-260.mount
221ms dev-loop2.device
215ms dev-loop11.device
215ms snap-core-6818.mount
214ms snap-gnome\x2dcalculator-352.mount
212ms dev-loop3.device
200ms snap-core-6673.mount
199ms dev-loop14.device
197ms snap-gnome\x2dlogs-45.mount
192ms dev-loop7.device
187ms dev-loop5.device
186ms dev-loop13.device
180ms dev-loop16.device
178ms dev-loop19.device
178ms dev-loop6.device
176ms dev-loop4.device
175ms systemd-tmpfiles-clean.service
lines 1-46...skipping...
2.436s plymouth-quit-wait.service
2.005s [email protected]
1.788s NetworkManager-wait-online.service
1.136s snapd.service
1.127s mysql.service
793ms dev-sda2.device
775ms fwupd.service
707ms NetworkManager.service
569ms networkd-dispatcher.service
512ms udisks2.service
503ms plymouth-start.service
我已经检查了以下目录 /boot
abi-4.15.0-36-generic memtest86+.elf
abi-4.4.0-137-generic memtest86+_multiboot.bin
config-4.15.0-36-generic retpoline-4.15.0-36-generic
config-4.4.0-137-generic retpoline-4.4.0-137-generic
grub System.map-4.15.0-36-generic
initrd.img-4.15.0-36-generic System.map-4.4.0-137-generic
initrd.img-4.4.0-137-generic vmlinuz-4.15.0-36-generic
lost+found vmlinuz-4.4.0-137-generic
memtest86+.bin vmlinuz-4.4.0-137-generic.efi.signed
有属于 Bionic Beaver 的新文件和旧文件。这些旧文件是导致启动速度慢的原因吗?我应该删除旧文件吗?
Startup finished in 33.342s (kernel) + 6.901s (userspace) = 40.243s
graphical.target reached after 6.897s in userspace
根据
systemd-analyze critical-chain
我得到以下内容:
graphical.target @6.897s
└─multi-user.target @6.897s
└─mysql.service @4.891s +1.127s
└─network-online.target @4.889s
└─NetworkManager-wait-online.service @3.101s +1.788s
└─NetworkManager.service @2.390s +707ms
└─dbus.service @2.377s
└─basic.target @2.372s
└─sockets.target @2.372s
└─snapd.socket @2.371s +951us
└─sysinit.target @2.363s
└─systemd-timesyncd.service @2.226s +137ms
└─systemd-tmpfiles-setup.service @2.216s +6ms
└─local-fs.target @2.213s
└─run-user-118.mount @4.953s
└─local-fs-pre.target @1.396s
└─keyboard-setup.service @1.329s +67ms
└─systemd-journald.socket @1.329s
└─system.slice @1.328s
└─-.slice @1.327s
输出sudo systemctl status snapd
为这里。
输出pgrep snap
是 1020。