Ubuntu – Ubuntu 18.04 Slow Boot Time


Why is it taking so long for Ubuntu budgie 18.10 to boot on my netbook ASUS X201EP with a HDD.
No dual boot, only Ubuntu is installed on the netbook.
Ubuntu upgraded from 18.04, no fresh install.
Boot time is longer than Ubuntu 18.04.

$ systemd-analyze
Startup finished in 3.327s (firmware) + 4.594s (loader) + 4.539s (kernel) + 
1min 18.844s (userspace) = 1min 31.306s
graphical.target reached after 1min 14.162s in userspace

$ systemd-analyze blame | head -20
 23.886s nmbd.service
 18.962s dev-sda2.device
 15.733s systemd-journal-flush.service
 13.936s udisks2.service
 12.884s networkd-dispatcher.service
 10.675s snapd.service
 10.005s ModemManager.service
 9.179s dev-loop7.device
 9.168s plymouth-quit-wait.service
 9.153s lightdm.service
 9.086s NetworkManager-wait-online.service
 9.030s ufw.service
 8.736s accounts-daemon.service
 8.647s dev-loop4.device
 8.535s dev-loop3.device
 8.434s dev-loop6.device
 8.290s dev-loop5.device
 7.993s NetworkManager.service
 7.964s dev-loop0.device
 7.544s dev-loop1.device

$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @1min 14.162s
└─multi-user.target @1min 14.160s
  └─smbd.service @1min 10.516s +3.643s
    └─nmbd.service @46.627s +23.886s
      └─network-online.target @46.625s
        └─NetworkManager-wait-online.service @37.538s +9.086s
          └─NetworkManager.service @29.536s +7.993s
            └─dbus.service @29.523s
              └─basic.target @28.866s
                └─sockets.target @28.866s
                  └─snapd.socket @28.846s +19ms
                    └─sysinit.target @28.740s
                      └─apparmor.service @24.626s +4.113s
                        └─local-fs.target @24.611s
                          └─run-user-1000.mount @1min 7.287s
                            └─local-fs-pre.target @7.454s
                              └─systemd-tmpfiles-setup-dev.service @6.190s +1.26
                                └─systemd-sysusers.service @4.776s +1.411s
                                  └─systemd-remount-fs.service @4.522s +250ms
                                    └─systemd-journald.socket @4.423s

$ journalctl -b --unit smbd
-- Logs begin at Sat 2018-07-07 19:57:48 CEST, end at Wed 2018-10-24 21:45:47 CE
oct. 24 20:31:38 fred-X201EP systemd[1]: Starting Samba SMB Daemon...
oct. 24 20:31:42 fred-X201EP systemd[1]: Started Samba SMB Daemon.

$ journalctl -b --unit nmbd
-- Logs begin at Sat 2018-07-07 19:57:48 CEST, end at Wed 2018-10-24 21:51:09 CE
oct. 24 20:31:15 fred-X201EP systemd[1]: Starting Samba NMB Daemon...
oct. 24 20:31:38 fred-X201EP systemd[1]: Started Samba NMB Daemon.


sudo systemctl stop smbd 
sudo systemctl disable smbd 
sudo systemctl disable NetworkManager-wait-online.service 


$ systemd-analyze critical-chain

graphical.target @1min 13.716s
└─multi-user.target @1min 13.716s
  └─nmbd.service @36.178s +37.536s
    └─network-online.target @36.176s
      └─network.target @36.174s
        └─NetworkManager.service @28.766s +7.405s
          └─dbus.service @28.714s
            └─basic.target @28.706s
              └─sockets.target @28.706s
                └─snapd.socket @28.680s +26ms
                  └─sysinit.target @28.630s
                    └─apparmor.service @24.894s +3.735s
                      └─local-fs.target @24.892s
                        └─run-user-1000.mount @1min 6.484s
                          └─local-fs-pre.target @6.986s
                            └─keyboard-setup.service @4.537s +2.449s
                              └─systemd-journald.socket @4.535s
                                └─-.mount @4.506s
                                  └─system.slice @4.506s
                                    └─-.slice @4.506s


shows that samba and NetworkManager-wait-online.service now don't start during boot so that's 1min 10.516s +3.643s and 37.538s +9.086s faster. but I still get this :

$ systemd-analyze 
Startup finished in 3.312s (firmware) + 4.447s (loader) + 4.513s (kernel) + 1min 16.469s (userspace) = 1min 28.743s 
graphical.target reached after 1min 13.716s in userspace 

Boot time is still closed to 3 min according to
but with a clock I measured 2mn for the boot time, why such a difference ? because as samba and NetworkManager-wait-online.service disabled, systemd-analyzeshould show a faster boot time ?

systemd-analyze blame | head -20

     `23.031s systemd-journal-flush.service
     19.634s dev-sda2.device
     14.908s udisks2.service
     13.562s ufw.service
     11.586s networkd-dispatcher.service
     11.428s ModemManager.service
     10.517s lightdm.service
     10.486s plymouth-quit-wait.service
      9.811s snapd.service
      8.519s accounts-daemon.service
      8.076s dev-loop6.device
      7.916s dev-loop3.device
      7.779s dev-loop7.device
      7.572s dev-loop0.device
      7.093s avahi-daemon.service
      6.804s dev-loop4.device
      6.743s dev-loop1.device
      6.692s apparmor.service
      6.641s systemd-logind.service
      6.641s thermald.service`

Best Answer

    • Try to disable samba:

      sudo systemctl stop smbd
      sudo systemctl disable smbd

      If you have further problems:

      sudo systemctl mask smbd 
    • According the NetworkManager-wait-online.service @37.538s +9.086s, try to disable this service:

      sudo systemctl disable NetworkManager-wait-online.service

      More info on this issue on: https://askubuntu.com/a/1018731/790920

  • Related Question