我使用 Ubuntu 18.04 LTS,与 Win10 双启动。每次启动系统都需要大约 3 分钟。此外,在登录屏幕之前,会出现这个东西,我附上了一张截图。
这个标志代表什么,如果这是启动时间过长的原因,如何摆脱它?
这是输出systemd-analyze blame
3min 28.455s apport-autoreport.service
3min 20.522s fstrim.service
51.936s dev-sda5.device
48.922s systemd-journal-flush.service
40.451s apparmor.service
38.857s binfmt-support.service
38.828s snap-vlc-770.mount
38.827s console-setup.service
38.806s dns-clean.service
38.802s qemu-kvm.service
36.102s snap-core18-1066.mount
31.498s snap-sublime\x2dtext-58.mount
29.766s snap-gtk2\x2dcommon\x2dthemes-5.mount
29.665s snap-gimp-165.mount
29.496s snap-gtk\x2dcommon\x2dthemes-1198.mount
29.382s snap-sublime\x2dtext-67.mount
29.351s snap-audacity-408.mount
10.796s mysql.service
9.811s mpd.service
9.269s networking.service
6.924s NetworkManager-wait-online.service
5.682s systemd-tmpfiles-setup-dev.service
5.257s bolt.service
输出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 @1min 10.971s
└─multi-user.target @1min 10.971s
└─mysql.service @1min 173ms +10.796s
└─network.target @1min 171ms
└─wpa_supplicant.service @55.935s +2.813s
└─dbus.service @55.884s
└─basic.target @55.878s
└─sockets.target @55.878s
└─snapd.socket @55.876s +815us
└─sysinit.target @55.735s
└─swap.target @55.735s
└─dev-disk-by\x2duuid-62ba7a95\x2d7374\x2d4862\x2daeb1\x2dc5
└─dev-disk-by\x2duuid-62ba7a95\x2d7374\x2d4862\x2daeb1\x2d
我退房了如何启用或禁用 Apport? 并且已经实现了sudo systemctl disable apport.service
,但现在apport-autoreport.service
还没有。但fstrim
仍然需要花费大量时间。我经历了https://ubuntuforums.org/showthread.php?t=2410364但未能得到满意的答案。
答案1
要禁用 fstrim 使用:
rm /var/lib/systemd/timers/stamp-fstrim.timer
systemctl stop fstrim.service fstrim.timer
systemctl disable fstrim.service fstrim.timer
systemctl mask fstrim.service fstrim.timer
这将从您的启动中删除 3m,但不会解决问题。您仍然需要找出原因。例如:您有交换分区吗?如果有,请将其删除并将交换文件添加到 /etc/fstab,看看是否是这个问题。交换分区与交换文件
journalctl -u fstrim
将显示有关 fstrim 的报告。
请注意,如果您这样做,您应该手动启动 fstrim,您可以使用
sudo fstrim -v /