如何减少“networking.service”服务的时间?

如何减少“networking.service”服务的时间?

我已经使用linux有一段时间了,我已经学会了适应这个新的操作系统,所以我想改进我的配置的一些细节。

目前系统加载速度很快,但我发现它在七个部分中停止了。通过ob命令分析systemd-analyze blame,得到以下信息:

diego@computer:~$ systemd-analyze blame
    1min 13.120s networking.service
         11.960s [email protected]
          9.792s mariadb.service
          7.845s NetworkManager-wait-online.service
          7.706s ifupdown-pre.service
          6.190s udisks2.service
          5.742s apache2.service
          5.220s ModemManager.service
          4.989s NetworkManager.service
          4.746s dev-sda6.device
          4.457s accounts-daemon.service
          3.785s bluetooth.service
          3.715s avahi-daemon.service
          3.710s wpa_supplicant.service
          3.709s sysstat.service
          3.702s alsa-restore.service
          3.700s rsyslog.service
          3.697s systemd-logind.service
          3.694s pppd-dns.service
          3.168s teamviewerd.service
          2.685s systemd-fsck@dev-disk-by\x2duuid-7add5e56\x2dd7d9\x2d4870\x2d9edf\x2d653b241363d3.service
          2.208s systemd-fsck@dev-disk-by\x2duuid-653a5644\x2d63e1\x2d4258\x2dbbb5\x2de1f1c1d2cd2f.service
          2.131s systemd-fsck@dev-disk-by\x2duuid-AAF1\x2dAC6F.service
          1.142s systemd-fsck@dev-disk-by\x2duuid-3f7a45e2\x2d6e0b\x2d4d72\x2d9e97\x2df87224e624ba.service
           861ms boot-efi.mount
           744ms systemd-tmpfiles-setup.service
           738ms systemd-udevd.service
           717ms systemd-backlight@backlight:intel_backlight.service
           712ms apparmor.service
           678ms polkit.service
           644ms systemd-backlight@leds:dell::kbd_backlight.service
           613ms upower.service
           573ms systemd-rfkill.service
           497ms keyboard-setup.service
           444ms systemd-tmpfiles-clean.service
           432ms systemd-random-seed.service
           334ms home.mount
           295ms systemd-udev-trigger.service
           294ms systemd-timesyncd.service
           287ms systemd-sysctl.service
           282ms sddm.service
           264ms systemd-journald.service
           249ms systemd-journal-flush.service
           208ms dev-disk-by\x2duuid-8c3c1e52\x2de46b\x2d496e\x2d9432\x2dc939674ae532.swap
           195ms [email protected]
           192ms systemd-tmpfiles-setup-dev.service
           187ms phpsessionclean.service
           184ms systemd-sysusers.service
           181ms var.mount
           155ms systemd-update-utmp.service
           139ms plymouth-read-write.service
           112ms console-setup.service
            95ms systemd-remount-fs.service
            94ms plymouth-quit-wait.service
            90ms plymouth-quit.service
            72ms tmp.mount
            66ms kmod-static-nodes.service
            57ms packagekit.service
            57ms rtkit-daemon.service
            55ms systemd-user-sessions.service
            55ms systemd-modules-load.service
            44ms dev-mqueue.mount
            41ms sys-kernel-debug.mount
            33ms dev-hugepages.mount
            28ms plymouth-start.service
            23ms [email protected]
            21ms systemd-update-utmp-runlevel.service
            17ms postgresql.service
            95ms systemd-remount-fs.service
            94ms plymouth-quit-wait.service
            90ms plymouth-quit.service
            72ms tmp.mount
            66ms kmod-static-nodes.service
            57ms packagekit.service
            57ms rtkit-daemon.service
            55ms systemd-user-sessions.service
            55ms systemd-modules-load.service
            44ms dev-mqueue.mount
            41ms sys-kernel-debug.mount
            33ms dev-hugepages.mount
            28ms plymouth-start.service
            23ms [email protected]
            21ms systemd-update-utmp-runlevel.service

据我所知,“networking.service”服务是消耗最多时间的服务,并且根据此中的指示关联,与我的笔记本电脑的“lo”接口相关联。

我的问题是如何改进这项服务的配置,因为据我了解,接口“lo”是与我自己的笔记本电脑内部关联的接口。

OBS:我的笔记本电脑使用“Debian GNU/Linux 10 (buster)”

更新 - “cat /etc/network/interfaces”的详细信息

diego@computer:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto enp2s0
iface enp2s0 inet dhcp

答案1

您可能会在 enp2s0 上看到 DHCP 超时。既然您无论如何都使用 NetworkManager,我建议您只需从 中删除 enp2s0 接口定义/etc/network/interfaces,将 enp2s0 信任给 NetworkManager。

相关内容