![Ubuntu 18.04 启动缓慢](https://linux22.com/image/1155963/Ubuntu%2018.04%20%E5%90%AF%E5%8A%A8%E7%BC%93%E6%85%A2.png)
在以最小安装方式安装 Ubuntu 18.04 后,我注意到它启动缓慢,以下是输出systemd-analyze blame
。
21.048s systemd-journal-flush.service
19.300s dev-sda7.device
14.310s plymouth-start.service
11.883s plymouth-quit-wait.service
10.579s dev-loop1.device
10.578s dev-loop0.device
10.566s dev-loop2.device
10.566s dev-loop7.device
10.486s dev-loop3.device
10.387s dev-loop5.device
10.352s dev-loop6.device
10.326s dev-loop8.device
10.316s dev-loop4.device
10.288s dev-loop9.device
10.247s dev-loop10.device
6.684s NetworkManager-wait-online.service
5.624s systemd-udevd.service
5.313s bolt.service
4.589s snap-gnome\x2d3\x2d26\x2d1604-62.mount
4.552s snap-gnome\x2dsystem\x2dmonitor-39.mount
4.536s snap-gnome\x2dsystem\x2dmonitor-36.mount
4.405s snap-gnome\x2d3\x2d26\x2d1604-59.mount
4.372s snap-gnome\x2dcalculator-167.mount
4.350s snap-gnome\x2dcalculator-154.mount
4.325s snap-gnome\x2dcharacters-86.mount
4.322s snap-gnome\x2dcharacters-69.mount
4.111s snapd.service
3.868s snap-core-4486.mount
3.452s udisks2.service
3.405s grub-common.service
3.163s apport.service
2.931s networkd-dispatcher.service
2.689s speech-dispatcher.service
2.573s networking.service
2.495s ModemManager.service
2.493s thermald.service
2.491s bluetooth.service
2.478s pppd-dns.service
2.476s gpu-manager.service
2.475s rsyslog.service
2.440s accounts-daemon.service
2.184s avahi-daemon.service
2.094s alsa-restore.service
2.079s systemd-logind.service
1.881s apparmor.service
1.786s keyboard-setup.service
1.740s NetworkManager.service
1.474s wpa_supplicant.service
1.110s fwupd.service
1.097s systemd-backlight@backlight:intel_backlight.service
917ms systemd-fsck@dev-disk-by\x2duuid-02BB\x2dC6E5.service
904ms systemd-random-seed.service
779ms systemd-remount-fs.service
756ms systemd-tmpfiles-setup-dev.service
717ms dev-hugepages.mount
714ms dev-mqueue.mount
710ms sys-kernel-debug.mount
616ms systemd-modules-load.service
573ms systemd-journald.service
449ms systemd-tmpfiles-setup.service
426ms systemd-tmpfiles-clean.service
416ms packagekit.service
366ms systemd-resolved.service
323ms snap-gnome\x2dlogs-25.mount
311ms dns-clean.service
308ms console-setup.service
294ms snap-gnome\x2dlogs-31.mount
275ms ufw.service
267ms swapfile.swap
267ms swapfile.swap
258ms upower.service
239ms polkit.service
222ms [email protected]
220ms gdm.service
202ms boot-efi.mount
186ms systemd-timesyncd.service
168ms systemd-udev-trigger.service
165ms [email protected]
141ms setvtrgb.service
103ms plymouth-read-write.service
103ms sys-fs-fuse-connections.mount
102ms sys-kernel-config.mount
84ms systemd-update-utmp.service
71ms colord.service
65ms systemd-sysctl.service
54ms kmod-static-nodes.service
30ms rtkit-daemon.service
21ms systemd-user-sessions.service
10ms kerneloops.service
8ms ureadahead-stop.service
7ms systemd-update-utmp-runlevel.service
3ms systemd-rfkill.service
1ms snapd.socket
答案1
您有循环设备,在启动期间需要很长时间才能安装。尝试在mount
启动后运行,查看作为环回设备安装的是什么。我敢打赌,这些都是 snap(您显然已经snapd
安装了),如果您不需要 snap,请通过卸载它们并卸载 来摆脱它们snapd
。对我来说,这缩短了启动时间。
dev-sda7.device 是您的根分区。19 秒意味着您的硬盘激活速度很慢,除非您购买新硬盘,否则我认为无法解决这个问题。
我知道大多数人做梦都不会想到这一点,更不用说尝试了,但您可能想禁用它plymouth
,看看启动时间是否会有所改善。这将删除图形启动屏幕并将其替换为滚动文本。
plymouth
通过编辑来禁用/etc/default/grub
。找到 GRUB_CMDLINE_LINUX_DEFAULT 行并删除“splash”,以便该行现在显示为:
GRUB_CMDLINE_LINUX_DEFAULT="quiet video=SVIDEO-1:d"
[修改 grub 文件之前记得备份它。你可能需要阅读以下内容:禁用普利茅斯以缩短启动时间。