Ubuntu 20.04 启动时间过长

Ubuntu 20.04 启动时间过长

我最近将我的 ubuntu 更新到 20.04。现在启动需要很长时间。我有 I5 CPU 和 8G RAM。

这里是 cmd systemd-analyze blame 输出:

1min 30.094s nmbd.service                                                             
     47.725s plymouth-quit-wait.service                                               
     22.834s udisks2.service                                                          
     22.771s networkd-dispatcher.service                                              
     19.079s snapd.service                                                            
     16.775s dev-sda6.device                                                          
     16.618s accounts-daemon.service                                                  
     15.567s NetworkManager-wait-online.service                                       
     11.738s polkit.service                                                           
     11.591s avahi-daemon.service                                                     
     11.590s bluetooth.service                                                        
     11.498s NetworkManager.service                                                   
     10.792s switcheroo-control.service                                               
     10.786s thermald.service                                                         
     10.782s systemd-logind.service                                                   
     10.780s wpa_supplicant.service                                                   
      9.671s ModemManager.service                                                     
      7.797s dev-loop0.device                                                         
      7.371s dev-loop1.device                                                         
      6.890s dev-loop2.device                                                         
      6.884s fwupd.service                                                            
      6.669s dev-loop4.device                                                         
      5.474s systemd-journal-flush.service                                            
      5.311s dev-loop3.device                                                         
      5.240s bolt.service                                                             
      4.621s systemd-resolved.service                                                 
      4.481s ufw.service                                                              
      3.997s rsyslog.service                                                          
      3.761s apport.service                                                           
      3.673s gpu-manager.service                                                      
      3.362s systemd-udevd.service                                                    
      3.018s grub-common.service                                                      
      2.985s e2scrub_reap.service                                                     
      2.829s systemd-tmpfiles-setup.service                                           
      2.615s gdm.service                                                              
      2.605s grub-initrd-fallback.service                                             
      2.412s networking.service                                                       
      2.334s apparmor.service                                                         
      1.970s secureboot-db.service                                                    
      1.919s lm-sensors.service                                                       
      1.549s snapd.seeded.service                                                     
      1.427s virtualbox.service                                                       
      1.419s dictd.service                                                            
      1.388s systemd-sysusers.service                                                 
      1.360s keyboard-setup.service                                                   
      1.333s systemd-modules-load.service                                             
      1.328s systemd-fsck@dev-disk-by\x2duuid-CEF1\x2d926B.service                    
      1.314s colord.service                                                           
      1.221s ccpd.service                                                             
      1.004s systemd-tmpfiles-setup-dev.service                                       
       997ms systemd-random-seed.service                                              
       888ms systemd-sysctl.service                                                   
       794ms [email protected]                                                     
       789ms smbd.service                                                             
       770ms snapd.apparmor.service                                                   
       755ms binfmt-support.service                                                   
       646ms upower.service                                                           
       639ms systemd-backlight@backlight:intel_backlight.service                      
       633ms systemd-rfkill.service                                                   
       580ms winbind.service                                                          
       542ms snap-core18-1932.mount                                                   
       516ms pppd-dns.service                                                         
       412ms systemd-udev-trigger.service                                             
       407ms systemd-timedated.service                                                
       384ms snap-snap\x2dstore-481.mount                                             
       351ms kerneloops.service                                                       
       335ms ifupdown-pre.service                                                     
       275ms systemd-timesyncd.service                                                
       274ms rc-local.service                                                         
       231ms kmod-static-nodes.service                                                
       218ms console-setup.service                                                    
       217ms [email protected]                                                        
       213ms snap-gnome\x2d3\x2d34\x2d1804-60.mount                                   
       200ms snap-gtk\x2dcommon\x2dthemes-1506.mount                                  
       200ms systemd-remount-fs.service                                               
       200ms systemd-journald.service                                                 
       195ms openvpn.service                                                          
       182ms dev-hugepages.mount                                                      
       182ms dev-mqueue.mount                                                         
       180ms sys-kernel-debug.mount                                                   
       180ms sys-kernel-tracing.mount                                                 
       156ms dev-disk-by\x2duuid-0dddf165\x2d43ec\x2d452e\x2d9e15\x2da64e2699cdfa.swap
       153ms snap-snapd-9721.mount                                                    
       141ms proc-sys-fs-binfmt_misc.mount                                            
       139ms plymouth-start.service                                                   
       133ms systemd-user-sessions.service                                            
       126ms setvtrgb.service                                                         
       117ms dns-clean.service                                                        
       116ms systemd-update-utmp.service                                              
       110ms boot-efi.mount                                                           
       106ms rtkit-daemon.service                                                     
        69ms hddtemp.service                                                          
        67ms systemd-tmpfiles-clean.service                                           
        55ms plymouth-read-write.service                                              
        49ms [email protected]                                            
        45ms resolvconf-pull-resolved.service                                         
        41ms systemd-update-utmp-runlevel.service                                     
        16ms alsa-restore.service                                                     
         4ms sys-fs-fuse-connections.mount                                            
         3ms sys-kernel-config.mount                                                  
         1ms snapd.socket 

和 systemd-analyze critical-chain 输出

    graphical.target @2min 25.659s
    └─multi-user.target @2min 25.658s
      └─smbd.service @2min 24.867s +789ms
        └─winbind.service @2min 24.280s +580ms
          └─network.target @38.518s
            └─NetworkManager.service @27.019s +11.498s
              └─dbus.service @27.013s
                └─basic.target @26.670s
                  └─sockets.target @26.670s
                    └─snapd.socket @26.668s +1ms
                      └─sysinit.target @26.291s
                        └─systemd-timesyncd.service @26.015s +275ms
                          └─systemd-tmpfiles-setup.service @23.107s +2.829s
                            └─local-fs.target @22.985s
                              └─boot-efi.mount @22.875s +110ms
                                └─systemd-fsck@dev-disk-by\x2duuid-CEF1\x2d926B.service @21.528s +1.328s
                                  └─dev-disk-by\x2duuid-CEF1\x2d926B.device @21.526s

这里systemd-analyze 图结果。

这个问题有解决办法吗?

答案1

  • 评估是否可以移除 sda 驱动器,如果不能,评估从 sda6 加载的内容并将其迁移到更快的存储器上。
  • 评估您是否可以卸载/删除您的 snap 包。
  • 评估你是否真的需要 virtualbox 在启动时启动
  • 检查您的 nmdb 设置,如果机器没有托管 smb 共享,连接到 smb 共享,不是 Microsoft Active Directory 的一部分,请考虑卸载 nmdb 并清除其配置,以防您将来重新安装它。
  • 检查您的 WiFi 驱动程序和 WiFi 配置
  • 启动时检查您的网络连接,因为您的机器正在等待它。

答案2

看起来有两个特定事件正在减慢它的速度:

  1. 正在等待网络连接可用

  2. 它正在等待 winbind/nmbd 执行某些操作,可能获取网络上所有主机名的列表

删除 winbind/nmbd 或禁用这些服务应该可以显著加快速度。

网络等待时间似乎是您巨大延迟中的 11 秒,但只要您没有自动挂载 smb 或 nfs,或者使用 LDAP 进行登录,您就可以跳过它,并节省 11 秒

相关内容