帮助我解决启动时间缓慢的问题(超过 2 分钟)

帮助我解决启动时间缓慢的问题(超过 2 分钟)

我在戴尔 Inspiron 3542 上使用 Ubuntu 22.04.1 LTS,使用 4GB RAM 和 NVD7。每次启动操作系统都需要 1 到 5 分钟以上(不使用任何双启动)。

以下是systemd-analyze

Startup finished in 4.336s (kernel) + 1min 24.904s (userspace) = 1min 29.241s 
graphical.target reached after 1min 24.704s in userspace

systemd-analyze critical-chain

graphical.target @1min 24.704s
└─multi-user.target @1min 24.704s
  └─plymouth-quit-wait.service @42.547s +42.156s
    └─systemd-user-sessions.service @42.497s +47ms
      └─network.target @42.484s
        └─NetworkManager.service @27.289s +15.192s
          └─dbus.service @27.284s
            └─basic.target @27.238s
              └─sockets.target @27.237s
                └─cups.socket @41.919s
                  └─sysinit.target @26.973s
                    └─snapd.apparmor.service @25.440s +1.532s
                      └─apparmor.service @23.525s +1.886s
                        └─local-fs.target @23.506s
                          └─run-snapd-ns-snapd\x2ddesktop\x2dintegration.mnt.mount @1min 7.735s
                            └─run-snapd-ns.mount @1min 412ms
                              └─local-fs-pre.target @6.342s
                                └─systemd-tmpfiles-setup-dev.service @5.768s +573ms
                                  └─systemd-sysusers.service @4.961s +777ms
                                    └─systemd-remount-fs.service @4.809s +147ms
                                      └─systemd-journald.socket @4.515s
                                        └─-.mount @4.482s
                                          └─-.slice @4.481s

我也面临笔记本电脑风扇问题不会关闭即使在系统完全关闭后(该问题也出现在所有 Linux 发行版中(尝试过 Fedora 并遇到同样的问题)但在 Windows 中它运行良好。

我是 Linux 新手,非常感激任何帮助。

编辑 :systemd-analyze blame

42.156s plymouth-quit-wait.service
31.779s snapd.service
26.206s udisks2.service
24.892s networkd-dispatcher.service
21.546s logrotate.service
20.895s containerd.service
19.196s accounts-daemon.service
17.187s power-profiles-daemon.service
16.689s polkit.service
16.256s dev-sda2.device
15.707s gpu-manager.service
15.192s NetworkManager.service
15.178s avahi-daemon.service
15.175s bluetooth.service
13.679s switcheroo-control.service
13.671s thermald.service
13.667s systemd-logind.service
13.580s wpa_supplicant.service
13.531s systemd-journal-flush.service
10.101s dev-loop16.device
 9.853s dev-loop6.device
 9.436s dev-loop13.device
 9.426s dev-loop2.device
lines 1-23...skipping...
42.156s plymouth-quit-wait.service
31.779s snapd.service
26.206s udisks2.service
24.892s networkd-dispatcher.service
21.546s logrotate.service
20.895s containerd.service
19.196s accounts-daemon.service
17.187s power-profiles-daemon.service
16.689s polkit.service
16.256s dev-sda2.device
15.707s gpu-manager.service
15.192s NetworkManager.service
15.178s avahi-daemon.service
15.175s bluetooth.service
13.679s switcheroo-control.service
13.671s thermald.service
13.667s systemd-logind.service
13.580s wpa_supplicant.service
13.531s systemd-journal-flush.service
10.101s dev-loop16.device
 9.853s dev-loop6.device
 9.436s dev-loop13.device
 9.426s dev-loop2.device
 9.236s secureboot-db.service
 8.913s dev-loop21.device
 8.775s dev-loop14.device
 8.639s dev-loop20.device
 8.585s dev-loop10.device
 8.567s dev-loop9.device
 8.565s dev-loop17.device
 8.559s dev-loop24.device
 8.036s dev-loop12.device
 7.984s dev-loop23.device
 7.978s dev-loop22.device
 7.910s dev-loop15.device
 7.812s dev-loop1.device
 7.777s dev-loop18.device
 7.680s systemd-modules-load.service
 7.675s ModemManager.service
 7.641s dev-loop19.device
lines 1-40






































42.156s plymouth-quit-wait.service
31.779s snapd.service
26.206s udisks2.service
24.892s networkd-dispatcher.service
21.546s logrotate.service
20.895s containerd.service
19.196s accounts-daemon.service
17.187s power-profiles-daemon.service
16.689s polkit.service
16.256s dev-sda2.device
15.707s gpu-manager.service
15.192s NetworkManager.service
15.178s avahi-daemon.service
15.175s bluetooth.service
13.679s switcheroo-control.service
13.671s thermald.service
13.667s systemd-logind.service
13.580s wpa_supplicant.service
13.531s systemd-journal-flush.service
10.101s dev-loop16.device
 9.853s dev-loop6.device
 9.436s dev-loop13.device
 9.426s dev-loop2.device
 9.236s secureboot-db.service
 8.913s dev-loop21.device
 8.775s dev-loop14.device
 8.639s dev-loop20.device
 8.585s dev-loop10.device
 8.567s dev-loop9.device
 8.565s dev-loop17.device
 8.559s dev-loop24.device
 8.036s dev-loop12.device
 7.984s dev-loop23.device
 7.978s dev-loop22.device
 7.910s dev-loop15.device
 7.812s dev-loop1.device
 7.777s dev-loop18.device

答案1

有几件事你可以做来减少这段时间:

  1. 停用普利茅斯启动屏幕
  • 打开终端,输入sudo gedit /etc/default/grub并按回车键。
  • 查找GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" (或类似这样的)行并将其更改为 GRUB_CMDLINE_LINUX_DEFAULT="fsck.mode=skip quiet"
  • 保存并关闭文件。然后输入sudo update-grub并按回车键。
  1. 显然,Snap 正在“杀死”你。除非你是它们的粉丝,否则我建议摆脱它们,改用 Flatpaks:
  • 要删除 snap,您可以打开终端并输入:sudo apt purge -y snapd && rm -rf ~/snap && sudo rm -rf /snap && sudo rm -rf /var/snap && sudo rm -rf /var/lib/snapd && sudo apt-mark hold snap。请注意,这将删除您的 Mozilla Firefox,因为它是一个 snap。

  • 为了在 ubuntu 上使用 flatpaks,只需在终端中输入sudo apt install -y flatpak && flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo,然后,您可以通过输入来安装 Firefox flatpak install -y flathub org.mozilla.firefox。 您可能需要重新启动才能使用它。

  • 此外,由于快照已消失,您需要通过键入来安装 gnome 软件和 flatplak 插件sudo apt install -y gnome-software gnome-software-plugin-flatpak

  1. 您还可以做另一个小改进,即避免在初始化时等待计算机上线。这可以通过sudo systemctl disable NetworkManager-wait-online.service在终端中输入并按回车键来实现。

与现在相比,这三项调整将大大减少您的启动时间。

希望对您有帮助:)

相关内容