Ubuntu 20.04 启动时间过长

Ubuntu 20.04 启动时间过长

我最近安装了Ubuntu 20.04在我的 HP 笔记本(英特尔酷睿 i-5、8GB RAM、AMD Radeon 2GB)上。需要 2 分钟以上才能到达登录屏幕。

我使用该命令dmesg来分析哪个进程花费了太多时间,只看到以下输出:

如果你转到时间戳[ 67.555730] rfkill: input handler disabled],这个过程只是在那之后audit被叫了很多次,几乎50 秒启动过程。

[   67.460851] [drm] ib test on ring 1 succeeded in 0 usecs
[   67.460874] [drm] ib test on ring 2 succeeded in 0 usecs
[   67.460899] [drm] ib test on ring 3 succeeded in 0 usecs
[   67.460924] [drm] ib test on ring 4 succeeded in 0 usecs
**[   67.555730] rfkill: input handler disabled**
[  111.331719] audit: type=1400 audit(1591675362.633:47): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/snapd/7777/usr/lib/snapd/snap-confine" pid=1687 comm="apparmor_parser"
[  111.332012] audit: type=1400 audit(1591675362.633:48): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/snapd/7777/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=1687 comm="apparmor_parser"
[  112.182135] audit: type=1400 audit(1591675363.485:49): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.snap-store" pid=1689 comm="apparmor_parser"
[  112.188690] audit: type=1400 audit(1591675363.493:50): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.canonical-livepatch" pid=1691 comm="apparmor_parser"
[  112.190389] audit: type=1400 audit(1591675363.493:51): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.canonical-livepatch.hook.configure" pid=1694 comm="apparmor_parser"
[  112.192167] audit: type=1400 audit(1591675363.497:52): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.canonical-livepatch.canonical-livepatch" pid=1692 comm="apparmor_parser"
[  112.192408] audit: type=1400 audit(1591675363.497:53): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.canonical-livepatch.canonical-livepatchd" pid=1693 comm="apparmor_parser"
[  112.195750] audit: type=1400 audit(1591675363.497:54): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.vlc" pid=1698 comm="apparmor_parser"
[  112.196569] audit: type=1400 audit(1591675363.501:55): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.snap-store.snap-store" pid=1695 comm="apparmor_parser"
[  112.197056] audit: type=1400 audit(1591675363.501:56): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.snap-store.ubuntu-software" pid=1696 comm="apparmor_parser"
[  118.265070] kauditd_printk_skb: 2 callbacks suppressed
[  118.265076] audit: type=1400 audit(1591675369.569:59): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/core/9289/usr/lib/snapd/snap-confine" pid=1796 comm="apparmor_parser"
[  118.265095] audit: type=1400 audit(1591675369.569:60): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/core/9289/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=1796 comm="apparmor_parser"
[  118.797549] audit: type=1400 audit(1591675370.101:61): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/snap/snapd/7777/usr/lib/snapd/snap-confine" pid=1798 comm="apparmor_parser"
[  118.836034] audit: type=1400 audit(1591675370.141:62): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/snap/snapd/7777/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=1798 comm="apparmor_parser"
[  119.433628] audit: type=1400 audit(1591675370.737:63): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.core" pid=1800 comm="apparmor_parser"
[  119.529999] audit: type=1400 audit(1591675370.833:64): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.core.hook.configure" pid=1801 comm="apparmor_parser"
[  120.144506] audit: type=1400 audit(1591675371.449:65): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.snap-store" pid=1803 comm="apparmor_parser"
[  120.175883] audit: type=1400 audit(1591675371.481:66): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.vlc" pid=1806 comm="apparmor_parser"
[  120.190680] audit: type=1400 audit(1591675371.493:67): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.ubuntu-software" pid=1804 comm="apparmor_parser"
[  120.211819] audit: type=1400 audit(1591675371.517:68): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.canonical-livepatch" pid=1808 comm="apparmor_parser"
[  147.119565] kauditd_printk_skb: 6 callbacks suppressed
[  147.119569] audit: type=1400 audit(1591675398.426:75): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/snapd/7777/usr/lib/snapd/snap-confine" pid=1934 comm="apparmor_parser"
[  147.119577] audit: type=1400 audit(1591675398.426:76): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/snapd/7777/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=1934 comm="apparmor_parser"
[  147.918540] audit: type=1400 audit(1591675399.222:77): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.ubuntu-software" pid=1938 comm="apparmor_parser"
[  147.948852] audit: type=1400 audit(1591675399.254:78): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.ubuntu-software-local-file" pid=1939 comm="apparmor_parser"
[  148.020594] audit: type=1400 audit(1591675399.326:79): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.snap-store" pid=1937 comm="apparmor_parser"
[  148.216393] audit: type=1400 audit(1591675399.522:80): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.snap-store" pid=1936 comm="apparmor_parser"
[  210.116607] [drm] PCIE gen 3 link speeds already enabled
[  210.133629] [drm] PCIE GART of 2048M enabled (table at 0x0000000000040000).
[  210.133736] radeon 0000:01:00.0: WB enabled
[  210.133739] radeon 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000080000c00 and cpu addr 0x0000000002c29bac
[  210.133740] radeon 0000:01:00.0: fence driver on ring 1 use gpu addr 0x0000000080000c04 and cpu addr 0x00000000f44304ae
[  210.133742] radeon 0000:01:00.0: fence driver on ring 2 use gpu addr 0x0000000080000c08 and cpu addr 0x0000000031bde5cd
[  210.133743] radeon 0000:01:00.0: fence driver on ring 3 use gpu addr 0x0000000080000c0c and cpu addr 0x00000000d7e92f5c
[  210.133744] radeon 0000:01:00.0: fence driver on ring 4 use gpu addr 0x0000000080000c10 and cpu addr 0x000000001f77e5bc
[  210.326579] [drm] ring test on 0 succeeded in 1 usecs
[  210.326584] [drm] ring test on 1 succeeded in 1 usecs
[  210.326588] [drm] ring test on 2 succeeded in 1 usecs
[  210.326596] [drm] ring test on 3 succeeded in 4 usecs
[  210.326603] [drm] ring test on 4 succeeded in 4 usecs
[  210.326671] [drm] ib test on ring 0 succeeded in 0 usecs
[  210.326732] [drm] ib test on ring 1 succeeded in 0 usecs
[  210.326820] [drm] ib test on ring 2 succeeded in 0 usecs
[  210.326833] [drm] ib test on ring 3 succeeded in 0 usecs
[  210.326844] [drm] ib test on ring 4 succeeded in 0 usecs
[  210.334790] rfkill: input handler enabled
[  210.715243] Bluetooth: RFCOMM TTY layer initialized
[  210.715258] Bluetooth: RFCOMM socket layer initialized
[  210.715273] Bluetooth: RFCOMM ver 1.11
[  224.498251] audit: type=1400 audit(1591675475.797:81): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.ubuntu-software-local-file" pid=2256 comm="apparmor_parser"
[  224.529105] audit: type=1400 audit(1591675475.829:82): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.snap-store" pid=2254 comm="apparmor_parser"
[  224.546528] audit: type=1400 audit(1591675475.845:83): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.snap-store.ubuntu-software" pid=2255 comm="apparmor_parser"
[  224.820589] audit: type=1400 audit(1591675476.121:84): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.snap-store" pid=2253 comm="apparmor_parser"
[  233.396341] rfkill: input handler disabled
[  236.218843] [drm] PCIE gen 3 link speeds already enabled
[  236.230351] [drm] PCIE GART of 2048M enabled (table at 0x0000000000040000).
[  236.230455] radeon 0000:01:00.0: WB enabled
[  236.230458] radeon 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000080000c00 and cpu addr 0x0000000002c29bac
[  236.230459] radeon 0000:01:00.0: fence driver on ring 1 use gpu addr 0x0000000080000c04 and cpu addr 0x00000000f44304ae
[  236.230460] radeon 0000:01:00.0: fence driver on ring 2 use gpu addr 0x0000000080000c08 and cpu addr 0x0000000031bde5cd
[  236.230461] radeon 0000:01:00.0: fence driver on ring 3 use gpu addr 0x0000000080000c0c and cpu addr 0x00000000d7e92f5c
[  236.230462] radeon 0000:01:00.0: fence driver on ring 4 use gpu addr 0x0000000080000c10 and cpu addr 0x000000001f77e5bc
[  236.422306] [drm] ring test on 0 succeeded in 1 usecs
[  236.422311] [drm] ring test on 1 succeeded in 1 usecs
[  236.422315] [drm] ring test on 2 succeeded in 1 usecs
[  236.422323] [drm] ring test on 3 succeeded in 4 usecs
[  236.422329] [drm] ring test on 4 succeeded in 4 usecs
[  236.422393] [drm] ib test on ring 0 succeeded in 0 usecs
[  236.422422] [drm] ib test on ring 1 succeeded in 0 usecs
[  236.422554] [drm] ib test on ring 2 succeeded in 0 usecs
[  236.422583] [drm] ib test on ring 3 succeeded in 0 usecs
[  236.422597] [drm] ib test on ring 4 succeeded in 0 usecs

此外,从登录屏幕加载桌面和图标大约需要 10 秒。

以下是head$ 的输出system-analyze blame

41.797s plymouth-quit-wait.service                           
25.586s man-db.service                                       
21.755s NetworkManager-wait-online.service                   
19.547s networkd-dispatcher.service                          
12.294s apt-daily.service                                    
10.432s dev-sda2.device                                      
10.193s udisks2.service                                      
 9.942s accounts-daemon.service                              
 7.864s NetworkManager.service                               
 7.050s snapd.service                                        

[编辑]

这是 $ 的输出systemd-analyze critical-chain (重启后,因为终端无法打开,我不知道为什么,希望这有用)

graphical.target @1min 2.530s
└─multi-user.target @1min 2.530s
  └─snapd.seeded.service @39.326s +1.291s
    └─snapd.service @19.102s +20.218s
      └─basic.target @18.263s
        └─sockets.target @18.263s
          └─snapd.socket @18.262s +830us
            └─sysinit.target @18.192s
              └─systemd-timesyncd.service @17.564s +627ms
                └─systemd-tmpfiles-setup.service @16.191s +1.303s
                  └─local-fs.target @16.185s
                    └─run-snapd-ns-canonical\x2dlivepatch.mnt.mount @32.782s
                      └─run-snapd-ns.mount @30.685s
                        └─local-fs-pre.target @5.125s
                          └─systemd-tmpfiles-setup-dev.service @4.541s +584ms
                            └─systemd-sysusers.service @4.025s +514ms
                              └─systemd-remount-fs.service @3.661s +199ms
                                └─systemd-journald.socket @3.403s
                                  └─-.mount @3.355s
                                    └─system.slice @3.355s
                                      └─-.slice @3.355s

相关内容