Ubuntu – Is it possible to make Ubuntu 20.04 boot faster

boot

I'm sorry if my question is rather newbie, because it is – but I've never bothered to tweak my Linux much. I've managed to get my Manjaro (not without some external help) cut boot time to 8-10s (by systemd-analyze) and I'd like to maybe try the same thing with Ubuntu but I am not sure what should I do and if it is possible. By all means it is not extremely slow but there is a major drawback on my nvme SSD since I've been using Manjaro which was up and ready in 10s and now it takes about 25s to get ready with Ubuntu. While the Manjaro was slow because of the grub timeout, Ubuntu has grub set to 0 by default – that one I've checked.

Here's my systemd-analyze and systemd-analyze blame – if anything else is needed I'll provide it:

systemd-analyze
Startup finished in 8.390s (firmware) + 4.976s (loader) + 2.131s (kernel) + 9.071s (userspace) = 24.570s 
graphical.target reached after 9.039s in userspace

systemd-analyze blame
7.076s NetworkManager-wait-online.service                   
5.821s plymouth-quit-wait.service                           
5.041s bolt.service                                         
1.753s grub-common.service                                  
1.727s apport.service                                       
1.159s snapd.service                                        
1.047s systemd-logind.service                               
1.032s networkd-dispatcher.service                          
 996ms accounts-daemon.service                              
 824ms udisks2.service                                      
 595ms polkit.service                                       
 590ms avahi-daemon.service                                 
 563ms bluetooth.service                                    
 539ms NetworkManager.service                               
 438ms switcheroo-control.service                           
 395ms dev-nvme0n1p2.device                                 
 365ms ModemManager.service                                 
 328ms thermald.service                                     
 314ms gdm.service                                          
 311ms wpa_supplicant.service                               
 300ms upower.service                                       
 253ms grub-initrd-fallback.service                         
 242ms e2scrub_reap.service                                 
 240ms gpu-manager.service                                  
 224ms rsyslog.service                                      
 224ms dev-loop1.device                                     
 223ms dev-loop0.device                                     
 184ms snap-snap\x2dstore-467.mount                         
 183ms snap-snapd-8542.mount                                
 182ms snap-gtk\x2dcommon\x2dthemes-1506.mount              
 173ms user@1000.service                                    
 170ms dev-loop2.device                                     
 154ms pppd-dns.service                                     
 128ms systemd-resolved.service                             
 127ms systemd-backlight@backlight:intel_backlight.service  
 119ms alsa-restore.service                                 
 118ms systemd-timesyncd.service                            
 106ms dev-loop4.device                                     
 104ms systemd-user-sessions.service                        
 103ms swapfile.swap                                        
 101ms snap-gnome\x2d3\x2d34\x2d1804-36.mount

(…)

And here's systemd-analyze critical-chain:

graphical.target @9.039s
└─multi-user.target @9.039s
  └─kerneloops.service @8.974s +63ms
    └─network-online.target @8.969s
      └─NetworkManager-wait-online.service @1.891s +7.076s
        └─NetworkManager.service @1.340s +539ms
          └─dbus.service @1.311s
            └─basic.target @1.232s
              └─sockets.target @1.232s
                └─snapd.socket @1.226s +5ms
                  └─sysinit.target @1.210s
                    └─systemd-backlight@backlight:intel_backlight.service @1.082s +127ms
                      └─system-systemd\x2dbacklight.slice @921ms
                        └─system.slice @433ms
                          └─-.slice @433ms


           

Best Answer

  • I am using a NVMe SSD to boot. And have 20.04 Kubuntu installed. I also change grub to 3 sec delay from default of 10 sec, just to have time to press a key if needed.

    fred@z170-focal-k:~$ systemd-analyze
    Startup finished in 2.667s (kernel) + 5.167s (userspace) = 7.834s 
    graphical.target reached after 5.155s in userspace
    

    Turned off NetworkManager-wait with systemctl:

    systemctl disable NetworkManager-wait-online.service
    

    https://forums.linuxmint.com/viewtopic.php?t=282437

    Changed from quiet splash to noplymouth, will see boot process rather than Ubuntu logo. Sometimes you then can see what process is hanging system, also. Even though not using raid nor encryption, installing drivers supposedly helps.

    sed -i '/GRUB_TIMEOUT=/ s/10/3/' /etc/default/grub
    sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/ s/"quiet splash"/"noplymouth"/' /etc/default/grub
    sudo update-grub
    sudo apt install libblockdev-crypto2 libblockdev-mdraid2, 
    

    turned off printer when rebooting,

    removed all snaps, prefer .debs for most apps

    sudo apt autoremove --purge snapd
    

    If UEFI firmware update not supported (yet) and no thunderbolt, one of my systems also does not have bluetooth, so I also uninstall that on that system only

    sudo apt-get purge fwupd
    systemctl status bolt
    boltctl list
    systemctl mask bolt.service
    sudo apt-get autoremove blueman bluez-utils bluez bluetooth 
    

    Many with slow boot issues have reinstalled an have a reference in fstab to a bad UUID. Best to confirm all UUIDs are correct.

    lsblk -o name,fstype,size,label,mountpoint,uuid | egrep -v "^loop"
    cat /etc/fstab
    

    Only if swap partition & reformatted this could be wrong UUID.

     cat /etc/initramfs-tools/conf.d/resume
    

    Be sure to mount partitions with noatime.

    UUID=54029c4f-0cbe-413e-80ce-78a4995b0551 /   ext4 noatime,errors=remount-ro  0  1
    

    More details:

    slow boot boot 19.10 (tried almost everything)

    What does NetworkManager-wait-online.service do?

    Ubuntu 16.04 slow boot (apt-daily.service)

    How to remove fwupd.service from boot?

    Do I really need apt-daily.service and apt-daily-upgrade.service?

    https://ubuntuforums.org/showthread.php?t=2436900&p=13932499#post13932499

    Ubuntu 15.04 network manager causing slow boot

  • Related Question