I have had Ubuntu 18.04 LTS installed on my laptop for nearly 2 years and noted that startup has been getting slower over time. Here is what I have done so far to improve startup time:
- Cleared out the following locations (files only not directories):
'/var/log'
'/var/cache/apt/archives' - At startup my screen started going blank for approx 40 secs,approx the same time as plymouth-quit-wait.service (splash) over time and incidentally for several months apport was reporting a _sbin_plymouthd.0.crash which appeared to eventually be fixed after a number of scheduled kernel updates, but after it was fixed the screen started going blank for approx 40 secs and kept occurring. I had never modified the grub bootloader and so it has always been set to the defaults on startup.
[Edited] I removed the part about the grub bootloader settings since I found none of the grub options made any difference and in any case, I forgot to run update-grub afterwards so I was never changing anything and it was nothing to do with any grub options.
After some further testing the blank screen in (2) above is something I found I introduced myself while disabling and enabling specific services while trying to speed up my system, I had disabled the avahi service, but forgot to re-enable when I was done testing and if this is disabled at startup this appears to cause the screen to go blank for around 40 seconds.
As a result. of (1) above I have improved my startup time significantly and it is now:
~$ systemd-analyze time
Startup finished in 3.912s (kernel) + 1min 25.875s (userspace) = 1min 29.788s
graphical.target reached after 1min 23.660s in userspace
~$ systemd-analyze critical-chain
graphical.target @1min 23.660s
└─multi-user.target @1min 23.660s
└─kerneloops.service @51.738s +127ms
└─network-online.target @51.722s
└─NetworkManager-wait-online.service @43.696s +8.024s
└─NetworkManager.service @36.659s +7.032s
└─dbus.service @32.763s
└─basic.target @32.644s
└─sockets.target @32.644s
└─snapd.socket @32.642s +768us
└─sysinit.target @32.527s
└─apparmor.service @27.457s +5.007s
└─local-fs.target @27.457s
└─run-user-121.mount @49.661s
└─local-fs-pre.target @6.087s
└─systemd-tmpfiles-setup-dev.service @4.597s +1.489s
└─kmod-static-nodes.service @4.466s +129ms
└─systemd-journald.socket @4.465s
└─system.slice @4.465s
└─-.slice @4.436s
~$ systemd-analyze blame |head -10
39.898s plymouth-quit-wait.service
21.404s dev-sda2.device
17.689s systemd-journal-flush.service
13.880s snapd.service
10.733s networkd-dispatcher.service
9.775s ModemManager.service
8.560s dev-loop10.device
8.426s dev-loop18.device
8.101s dev-loop15.device
8.064s udisks2.service
Having migrated from Windows which doesn't automatically clean up temp files and app cache and therefore the following slow Windows down with the size increase over time:
- Temporary/archived files
- App Cache.
- Profile size.