ubuntu 从 16.04 升级到 18.04 启动非常慢

ubuntu 从 16.04 升级到 18.04 启动非常慢

我已经尝试了以下操作,并且我是 ubuntu 新手,所以担心对固件或启动顺序进行一些更改可能会出现问题,请帮助我。

$ systemd-analyze
   Startup finished in 3.752s (firmware) + 4.733s (loader) + 37.788s (kernel) + 1min 27.819s (userspace) = 2min 14.094s
    graphical.target reached after 1min 25.853s in userspace

systemd-analyze 责备

$ systemd-analyze blame
   26.570s dev-mapper-ubuntu\x2d\x2dvg\x2droot.device
         23.755s systemd-journal-flush.服务
         16.831s teamviewerd.service
         15.501s NetworkManager-等待在线.服务
         14.206s dev-loop33.device
         14.160s dev-loop34.device
         14.043s dev-loop30.device
         14.013s dev-loop31.device
         13.862s dev-loop27.device
         13.759s dev-loop26.device
         13.757s dev-loop29.device
         13.270s dev-loop28.device
         13.149s networkd-dispatcher.service
         12.880s dev-loop24.device
         12.876s dev-loop32.device
         12.753s dev-loop25.device
         12.504s dev-loop22.device
         12.455s snapd.服务
         12.439s dev-loop21.device
         12.308s dev-loop23.device
         12.197s dev-loop20.device
         11.757s udisks2.service
         10.796s dev-loop18.device
         10.750s dev-loop19.device
         10.524s dev-loop16.device
         10.103s dev-loop17.device
         10.086s 调制解调器管理器.服务
          9.614s dev-loop15.device
          9.418s dev-loop14.device
          9.196s dev-loop13.device
          8.938s dev-loop12.device
          8.744s 账户守护进程.服务
          8.738s 网络管理器.服务
          8.324s dev-loop7.device
          8.251s dev-loop11.设备
          8.145s dev-loop9.device
          7.849s dev-loop10.device
          7.010s dev-loop8.device
          6.960s apport.服务
          6.803s dev-loop5.device
          6.209s gpu-manager.service
          5.929s dev-loop6.device
          5.867s dev-loop2.device
          5.866s dev-loop4.device
          5.660s dev-loop3.device
          5.591s 螺栓服务
          5.515s apparmor.service
          5.339s 语音调度服务
          5.322s 网络.服务
          5.262s 蓝牙.服务
          5.212s systemd-udevd.service
          5.125s avahi-守护进程.服务
          5.124s thermald.service
          5.054s rsyslog.服务
          4.583s dev-loop1.device
          4.306s snap-canonical\x2dlivepatch-81.mount
          4.248s wpa_supplicant.service
          4.246s dev-loop0.device
          3.938s snap-gnome\x2d3\x2d26\x2d1604-86.mount
          3.880s snap-gnome\x2dcalculator-352.mount
          3.762s snap-docker-372.mount
          3.724s systemd-logind.service
          3.665s snap-gnome\x2dcharacters-288.mount
          3.599s snap-docker-381.mount
          3.518s snap-gnome\x2dlogs-45.mount
          3.380s polkit.service

          2.873s snap-krita-44.mount
          2.812s snap-gnome\x2d3\x2d28\x2d1804-59.mount
          2.660s upower.service
          2.625s snap-obs\x2dstudio-519.mount
          2.624s systemd-rfkill.service
          2.602s lvm2-pvscan@8:3.service
          2.585s snap-canonical\x2dlivepatch-77.mount
          2.553s snap-gtk\x2dcommon\x2dthemes-1198.mount
          2.505s snap-docker-384.mount
          2.447s snap-highlighterpdf-5.mount
          2.363s snap-gnome\x2dlogs-57.mount
          2.305s snap-gnome\x2dcalculator-260.mount
          2.302s lvm2-monitor.service
          2.194s systemd-tmpfiles-setup-dev.service
          2.158s snap-microk8s-652.mount
          2.102s snap-krita-48.mount
          2.094s grub-common.service
          2.075s snap-core-6818.mount
          2.054s snap-gnome\x2d3\x2d26\x2d1604-88.mount
          2.011s 软件包套件.service
          1.751s fwupd.服务
          1.742s 键盘设置服务
          1.731s snap-gtk\x2dcommon\x2dthemes-1122.mount
          1.705s snap-gnome\x2dcharacters-284.mount
          1.680s snap-microk8s-608.mount
          1.514s snap-gnome\x2dsystem\x2dmonitor-87.mount
          1.479s snap-core-6673.mount
          1.464s binfmt-support.service

           1.342s systemd-sysctl.service
          1.225s lightdm.service
          1.222s plymouth-退出-等待.服务
          1.162s colord.service
           955ms snap-core-6964.mount
           936ms systemd-timesyncd.服务
           875ms 启动.挂载
           867ms systemd-tmpfiles-setup.service
           830ms snap-obs\x2dstudio-525.mount
           819ms systemd-remount-fs.service
           786ms snap-core18-970.mount
           735ms dev-mqueue.mount
           721ms 系统内核调试.mount
           720ms dev-hugepages.mount
           718ms systemd-journald.service
           713ms systemd-fsck@dev-disk-by\x2duuid-F7B0\x2d0B8F.service
           696ms snap-gnome\x2d3\x2d28\x2d1804-55.mount
           690ms plymouth-read-write.service
           651ms proc-sys-fs-binfmt_misc.mount
           643ms rtkit-daemon.service
           642ms systemd-tmpfiles-clean.service
           629ms resolvconf.服务
           579ms snap-gnome\x2dsystem\x2dmonitor-91.mount
           551ms snap-core18-941.mount
           519ms systemd-udev-trigger.service
           517ms pppd-dns.服务
           504ms kmod-静态节点.service
           500ms systemd-resolved.service

           488ms plymouth-start.service
           457ms systemd-backlight@backlight:intel_backlight.service
           428ms 控制台设置服务
           399ms dns-clean.service
           392ms 启动-efi.mount
           319ms alsa-恢复.服务
           314ms snap-gnome\x2dcalculator-406.mount
           272ms snap-gtk\x2dcommon\x2dthemes-818.mount
           269ms snap-gnome\x2dlogs-61.mount
           267ms snap-core18-782.mount
           233ms systemd-random-seed.service
           232ms setvtrgb.服务
           228ms kerneloops.service
           224ms hddtemp.service
           204ms snapd.seed.service
           202ms blk-availability.service
           188ms systemd-fsck@dev-disk-by\x2duuid-e2648b12\x2df71d\x2d461a\x2dac
           179ms ufw.服务
           155ms systemd-用户会话.服务
           153ms systemd-update-utmp.service
           114ms dev-mapper-ubuntu\x2d\x2dvg\x2dswap_1.swap
           112ms systemd-update-utmp-runlevel.service
            92毫秒[电子邮件保护]
            54ms snapd.socket
            41ms resolvconf-pull-resolved.service
            20ms ureadahead-stop.service
             8ms 系统文件系统保险丝连接.mount
             6ms 系统内核配置.mount
             3ms systemd-modules-load.service

sudo systemd-analyze 关键链

graphic.target @56.382s
└─multi-user.target @56.382秒
  └─hddtemp.service @56.353s +28ms
    └─network-online.target @56.339s
      └─NetworkManager-wait-online.service @48.111s +8.227s
        └─NetworkManager.service @41.370s +6.692s
          └─dbus.service @40.624s
            └─basic.target @40.316秒
              └─sockets.target @40.316s
                └─snapd.socket @40.313秒+2毫秒
                  └─sysinit.target @40.268s
                    └─apparmor.service @39.016秒+1.251秒
                      └─local-fs.target @39.015s
                        └─run-snapd-ns-canonical\x2dlivepatch.mnt.mount @51.091s
                          └─run-snapd-ns.mount @49.006s
                            └─swap.target @39.435秒
                              └─dev-mapper-ubuntu\x2d\x2dvg\x2dswap_1.swap @39.009s +425ms
                                └─dev-mapper-ubuntu\x2d\x2dvg\x2dswap_1.device @39.008s
~

答案1

看起来 TeamViewer 占用了您大量的启动时间。我建议禁用它在启动时启动或直接使用sudo apt remove它的功能。Snap 会大大降低系统性能,如果您不使用 Snap,我建议将其删除(虽然如果您运行 GNOME,这很危险,但我只建议在您运行 xfce、lde 或 kde 时使用它)

编辑:我和几个技术朋友聊过,你似乎有很多 snap。开始养成安装 .deb 文件或一直使用 .deb 的习惯,而apt不是 snap。Snap 卷加载在 dev-loop 文件中,你有很多这样的文件,这会占用很多时间。尝试删除一些 snap,改用 repos 或 .deb

相关内容