我全新安装的 18.04 需要 1 到 1.5 分钟才能启动,而重新安装则只需不到 10 秒。
~$ systemd-analyze time
Startup finished in 7.942s (firmware) + 11.813s (loader) + 5.323s (kernel) + 41.406s (userspace) = 1min 6.486s
graphical.target reached after 41.308s in userspace
~$ systemd-analyze blame
33.987s systemd-timesyncd.service
33.979s systemd-resolved.service
5.507s NetworkManager-wait-online.service
1.099s dev-sdb2.device
...
但是当查看日志时,我没有发现任何可疑的东西,只是它花了 30 秒......
~$ journalctl -u systemd-timesyncd.service
-- Reboot --
Jan 15 12:27:18 ubuntu systemd[1]: Starting Network Time Synchronization...
Jan 15 12:27:52 ubuntu systemd[1]: Started Network Time Synchronization.
Jan 15 12:28:22 ubuntu systemd-timesyncd[719]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
~$ journalctl -u systemd-resolved.service
-- Reboot --
Jan 15 12:27:18 ubuntu systemd[1]: Starting Network Name Resolution...
Jan 15 12:27:52 ubuntu systemd-resolved[721]: Positive Trust Anchors:
Jan 15 12:27:52 ubuntu systemd-resolved[721]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb4
Jan 15 12:27:52 ubuntu systemd-resolved[721]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104227c7f8ec8d
Jan 15 12:27:52 ubuntu systemd-resolved[721]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa
Jan 15 12:27:52 ubuntu systemd-resolved[721]: Using system hostname 'ubuntu'.
Jan 15 12:27:52 ubuntu systemd[1]: Started Network Name Resolution.
有时apparmor.service
也需要约 30 秒,但这次并非如此。
我怎样才能加快这些速度?
编辑:将我的 DNS 更改为 8.8.8.8,现在 Blame 说的是这个
34.420s console-setup.service
34.416s snap-vscode-74.mount
34.381s snap-core-6130.mount
33.962s apparmor.service
33.927s systemd-tmpfiles-setup.service
5.400s NetworkManager-wait-online.service
1.543s dev-sdb2.device
1.092s keyboard-setup.service
...
然而,再次重启后timesyncd
问题resolved
仍然存在,看来问题不是由标题所暗示的服务引起的。