网络启动时耗时较长

网络启动时耗时较长

我的电脑启动大约需要 40 秒(Kubuntu 18.04,没有 SSD)。

这是输出systemd-analyze critical-chain

~$ 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 @38.283s
└─multi-user.target @38.283s
  └─postfix.service @38.278s +4ms
    └─[email protected] @35.039s +3.236s
      └─network-online.target @35.033s
        └─NetworkManager-wait-online.service @26.666s +8.366s
          └─NetworkManager.service @20.984s +5.678s
            └─dbus.service @18.457s
              └─basic.target @18.330s
                └─sockets.target @18.330s
                  └─uuidd.socket @18.330s
                    └─sysinit.target @18.286s
                      └─haveged.service @18.286s
                        └─systemd-tmpfiles-setup.service @16.903s +448ms
                          └─local-fs.target @16.900s
                            └─boot-efi.mount @16.757s +142ms
                              └─systemd-fsck@dev-disk-by\x2duuid-DAA7\x2d28F1.service @14.156s +2.550s
                                └─local-fs-pre.target @13.638s
                                  └─lvm2-monitor.service @4.199s +9.438s
                                    └─lvm2-lvmetad.service @5.365s
                                      └─systemd-journald.socket @4.141s
                                        └─system.slice @4.140s
                                          └─-.slice @4.096s

看起来NetworkManager-wait-online.serviceNetworkManager.service加载时间很长。有什么方法可以减少它们的加载时间吗?可以禁用它们吗?启动后会禁用 wifi 吗?我并不总是需要在启动后打开 wifi,如果需要,我可以手动打开它。

禁用NetworkManager-wait-online.service并没有多大帮助

graphical.target @38.841s
└─multi-user.target @38.839s
  └─postfix.service @38.831s +7ms
    └─[email protected] @35.445s +3.382s
      └─network-online.target @35.441s
        └─network.target @35.386s
          └─NetworkManager.service @25.834s +9.551s
            └─dbus.service @20.408s
              └─basic.target @20.152s
                └─sockets.target @20.152s
                  └─acpid.socket @20.152s
                    └─sysinit.target @20.109s
                      └─haveged.service @20.108s
                        └─apparmor.service @18.601s +1.486s
                          └─local-fs.target @18.600s
                            └─boot-efi.mount @18.446s +154ms
                              └─systemd-fsck@dev-disk-by\x2duuid-DAA7\x2d28F1.se
                                └─local-fs-pre.target @16.471s
                                  └─lvm2-monitor.service @4.046s +12.424s
                                    └─lvm2-lvmetad.service @4.876s
                                      └─systemd-journald.socket @4.018s
                                        └─system.slice @4.017s
                                          └─-.slice @3.974s

答案1

NetworkManager-wait-online.service只需等待系统连接到网络(最多 30 秒)。您可以安全地禁用它。

NetworkManager.service另一方面不会造成延迟,您应该保持它处于开启状态(除非您想在连接时手动启动该服务)。

答案2

禁用NetworkManager.service不会减少启动时间。它只会等待系统连接到网络。可能是硬件减慢了启动速度,就像我的情况一样。

相关内容