我最近安装了 Ubuntu 20.04,它在我的 PC 上运行速度非常快。它不是双启动。我的 PC 规格如下:
CPU: Intel Pentium E5700@3GHz
Graphics: Intel G41(Onboard Graphics)
HDD: 250gb
Ram: 4GB + (4GB Swap)
但是启动时间非常慢。启动大约需要 1 分钟。起初大约需要 30 秒,但现在几乎需要 1 分钟。我用以下命令检查了启动时间,systemd-analyze time
结果如下:
systemd-analyze time
Startup finished in 5.929s (kernel) + 51.893s (userspace) = 57.822s
graphical.target reached after 51.826s in userspace
我确实检查过了systemd-analyze blame
,结果显示如下:
systemd-analyze blame
32.833s plymouth-quit-wait.service
24.428s apport-autoreport.service
11.315s dev-sda7.device
7.112s accounts-daemon.service
6.533s dev-loop8.device
6.489s dev-loop3.device
6.415s dev-loop4.device
6.050s dev-loop0.device
5.991s dev-loop2.device
5.534s dev-loop1.device
5.332s dev-loop5.device
5.055s dev-loop6.device
4.944s dev-loop7.device
3.806s avahi-daemon.service
3.625s switcheroo-control.service
3.613s thermald.service
3.515s systemd-logind.service
3.513s wpa_supplicant.service
3.079s ufw.service
2.880s gpu-manager.service
2.688s snapd.service
2.652s udisks2.service
2.367s rsyslog.service
2.327s grub-common.service
2.252s e2scrub_reap.service
2.237s preload.service
1.855s systemd-udevd.service
1.629s grub-initrd-fallback.service
1.615s apparmor.service
1.350s systemd-modules-load.service
1.348s gdm.service
1.260s fancontrol.service
1.097s systemd-tmpfiles-setup.service
1.069s systemd-resolved.service
1.019s lm-sensors.service
1.004s systemd-sysctl.service
987ms systemd-journal-flush.service
935ms systemd-tmpfiles-setup-dev.service
895ms systemd-journald.service
801ms systemd-random-seed.service
781ms fwupd.service
761ms systemd-timesyncd.service
686ms upower.service
537ms plymouth-read-write.service
515ms snap-core18-1705.mount
489ms keyboard-setup.service
456ms systemd-sysusers.service
412ms snap-core18-1880.mount
398ms systemd-udev-trigger.service
379ms kerneloops.service
372ms snap-gnome\x2d3\x2d28\x2d1804-128.mount
355ms snap-gnome\x2d3\x2d34\x2d1804-24.mount
341ms systemd-remount-fs.service
318ms snap-gnome\x2d3\x2d34\x2d1804-36.mount
315ms pppd-dns.service
305ms [email protected]
230ms snap-snap\x2dstore-415.mount
222ms [email protected]
220ms NetworkManager.service
219ms polkit.service
188ms console-setup.service
173ms systemd-rfkill.service
168ms snap-gtk\x2dcommon\x2dthemes-1506.mount
168ms snap-snapd-8542.mount
131ms dev-mqueue.mount
131ms systemd-update-utmp.service
130ms sys-kernel-debug.mount
129ms dev-hugepages.mount
129ms sys-kernel-tracing.mount
128ms snap-snapd-7264.mount
120ms kmod-static-nodes.service
93ms dev-disk-by\x2duuid-ee5aecd0\x2d8f8b\x2d461c\x2db8e0\x2d401f0dd6f584.s wap
86ms plymouth-start.service
80ms colord.service
78ms hddtemp.service
62ms setvtrgb.service
57ms systemd-user-sessions.service
31ms systemd-tmpfiles-clean.service
25ms [email protected]
16ms systemd-update-utmp-runlevel.service
14ms alsa-restore.service
10ms rtkit-daemon.service
9ms sys-fs-fuse-connections.mount
4ms sys-kernel-config.mount
4ms snapd.socket
这里的关键链结果如下:
systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.
graphical.target @51.826s
└─multi-user.target @51.826s
└─kerneloops.service @18.921s +379ms
└─network-online.target @18.847s
└─network.target @18.847s
└─wpa_supplicant.service @15.333s +3.513s
└─dbus.service @15.088s
└─basic.target @14.995s
└─sockets.target @14.994s
└─snapd.socket @14.990s +4ms
└─sysinit.target @14.898s
└─swap.target @14.898s
└─dev-disk-by\x2duuid-ee5aecd0\x2d8f8b\x2d461c\x2db8e\[email protected] +93ms
└─dev-disk-by\x2duuid-ee5aecd0\x2d8f8b\x2d461c\x2db8e0\x2d401f0dd6f584.device @14.801s
那么我怎样才能减少启动时间?
编辑: dmesg | grep -i 错误的输出
dmesg | grep -i error
[ 0.761799] ACPI BIOS Error (bug): AE_AML_PACKAGE_LIMIT, Index (0x0FFFFFFFF) is beyond end of object (length 0x4) (20190816/exoparg2-393)
[ 0.761843] ACPI Error: Aborting method \_SB.PCI0.IDE1.GTM due to previous error (AE_AML_PACKAGE_LIMIT) (20190816/psparse-529)
[ 0.761850] ACPI Error: Aborting method \_SB.PCI0.IDE1.CHN1._GTM due to previous error (AE_AML_PACKAGE_LIMIT) (20190816/psparse-529)
[ 0.798345] RAS: Correctable Errors collector initialized.
[ 9.912364] EXT4-fs (sda7): re-mounted. Opts: errors=remount-ro
[ 3014.858735] mt7601u 1-6:1.0: Error: MCU response pre-completed!
[ 3017.471090] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133)
[ 3017.471122] ACPI Error: Aborting method \_SB.PCI0.IDE1.RATA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
[ 3017.471131] ACPI Error: Aborting method \_SB.PCI0.IDE1.CHN1.DRV1._GTF due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
[ 3017.473543] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133)
[ 3017.473569] ACPI Error: Aborting method \_SB.PCI0.IDE1.RATA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
[ 3017.473577] ACPI Error: Aborting method \_SB.PCI0.IDE1.CHN1.DRV0._GTF due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
答案1
有几件事要提一下:
我最近安装了 Ubuntu 20.04,它在我的 PC 上运行速度非常快。
您的另一台计算机很可能配备了更好的硬件 - 特别是更快/更新的 CPU(奔腾 E5700 来自 2010 年)和更快的磁盘(可能是 SSD 而不是 HDD)。SSD 将带来巨大的差异,我们也不能指望 10 年前的奔腾也能有快速的启动时间。
一开始大约是30秒,但现在几乎是1分钟。
安装后启动时间增加是正常的。可能是安装了一些驱动程序和附加软件。
对于运行 Ubuntu 的 PC 来说,启动时间为 1 分钟是完全合理的。如果您想要更轻量级的选项,请查看鲁本图(字面上大号轻量级Ubuntu)。如果您想加快计算机速度,请购买 SSD。如果您想调整 Ubuntu 以使其启动速度更快,请检查 systemd-analyze 责备报告中正在运行的服务并禁用您不需要的服务。
笔记:普利茅斯服务是启动画面,它实际上不会占用您启动时间的 30 秒。据我了解,这只是服务等待显示启动画面的时间。