Ubuntu – How to decrease the boot time

19.04bootfwupdnetwork-managerthunderbolt

I have been checking some systemd-analyze outputs and I actually don't have a crucial problem with my boot time but just wondering whether I can decrease it further. I'd like to mention that I'm using an SSD and Ubuntu is my only OS.

systemd-analyze
Startup finished in 5.450s (firmware) + 565ms (loader) + 2.632s (kernel) + 10.086s (userspace) = 18.734s 
graphical.target reached after 10.071s in userspace
systemd-analyze blame
          6.607s NetworkManager-wait-online.service
          5.660s fwupd.service
          5.042s bolt.service
          4.134s plymouth-quit-wait.service
          1.579s dev-sda2.device
          1.552s systemd-backlight@backlight:intel_backlight.service
          1.367s plymouth-read-write.service
          1.211s snapd.service
           903ms systemd-logind.service
           572ms systemd-journald.service
           555ms dev-loop9.device
           523ms dev-loop6.device
           515ms man-db.service
           499ms dev-loop8.device
           478ms dev-loop5.device
           472ms dev-loop13.device
           448ms dev-loop7.device
           441ms dev-loop11.device
           438ms dev-loop10.device
           432ms dev-loop12.device
           415ms udisks2.service
           406ms dev-loop14.device
           319ms snap-gnome\x2d3\x2d28\x2d1804-71.mount
graphical.target @10.071s
└─multi-user.target @10.071s
  └─kerneloops.service @10.042s +27ms
    └─network-online.target @10.032s
      └─NetworkManager-wait-online.service @3.422s +6.607s
        └─NetworkManager.service @3.224s +186ms
          └─dbus.service @3.218s
            └─basic.target @3.211s
              └─sockets.target @3.211s
                └─snapd.socket @3.208s +2ms
                  └─sysinit.target @3.205s
                    └─systemd-backlight@backlight:intel_backlight.service @1.468s +1.552s
                      └─system-systemd\x2dbacklight.slice @1.467s
                        └─system.slice @212ms
                          └─-.slice @212ms

Best Answer

If this system is not a server in a network, you can start by cutting down on time used by NetworkManager-wait-online.service, to do this please disable the service like so:

sudo systemctl disable NetworkManager-wait-online.service

If it shows up again after reboot, you can follow the above command with this:

sudo systemctl mask NetworkManager-wait-online.service

Pleas, try this first and check if your boot time improves before carrying on with any further steps. This alone, sometimes, reduces your boot time by a great deal.


To roll back the above changes anytime, please run:

sudo systemctl unmask NetworkManager-wait-online.service

Then follow it by:

sudo systemctl enable NetworkManager-wait-online.service

What is systemd-networkd-wait-online.service?

NAME systemd-networkd-wait-online.service, systemd-networkd-wait-online - Wait for network to come online

SYNOPSIS systemd-networkd-wait-online.service

   /lib/systemd/systemd-networkd-wait-online

DESCRIPTION systemd-networkd-wait-online is a oneshot system service (see systemd.service(5)), that waits for the network to be configured. By default, it will wait for all links it is aware of and which are managed by systemd- networkd.service(8) to be fully configured or failed, and for at least one link to be online. Here, online means that the link's operational state is equal or higher than "degraded". The threshold can be configured by --operational-state= option.

The purpose of the NetworkManager-wait-online.service is to wait for the network to come online before proceeding with the boot process.

This is needed in case of for example servers that rely on network resources as part of the boot process ( eg. mounting remote drives ) or in the case of workstations that rely on the network to boot correctly ( eg. Thin Clients ).

Otherwise, desktop users can disable NetworkManager-wait-online.service and network will connect normally after boot has finished minus the unneeded wait time.

It is safe to disable in this case.

Related Question