Skip to content

Ubuntu 18.04 Boot Speedups

Checking startup speed and delays

> systemd-analyze 
Startup finished in 16.116s (firmware) + 22.465s (loader) + 4.241s (kernel) + 7.064s (userspace) = 39.888s
graphical.target reached after 7.056s in userspace
> systemd-analyze blame | head -10
         10.869s apt-daily.service
          4.166s NetworkManager-wait-online.service
          2.614s apt-daily-upgrade.service
          1.366s jenkins.service
          1.310s motd-news.service
          1.013s snap-pycharm_community-85.mount
           993ms snap-gtk_common_dthemes-701.mount
           982ms snap-polarr-8.mount
           954ms snap-core-5548.mount
           933ms snap-gimp-40.mount

Changing apt-daily.service to start later

Using information from this thread, apt-daily.service should not start in the boot sequence. These are the instructions.

# edit apt-daily timer
> sudo systemctl edit apt-daily.timer

Then paste the following into the editor and save.

# apt-daily timer configuration override
[Timer]
OnBootSec=15min
OnUnitActiveSec=1d
AccuracySec=1h
RandomizedDelaySec=30min

This changes the "timer" that triggers apt-daily.service to run at a random time between 15 min and 45 min after boot, and once a day thereafter

LLVM 30 Second delay at boot

When using LLVM, there is a error in a configuration file which points to the swap device, a script will fail and wait 30 seconds holding up boot. This information comes from this post.

The wait-for-root in /usr/share/initramfs-tools/scripts/local times out after expiring 30 seconds (slumber value).

# Timeout is max(30, rootdelay) seconds (approximately)
local slumber=30
case $DPKG_ARCH in
  powerpc|ppc64|ppc64el)
    slumber=180
    ;;
  *)
    slumber=30
    ;;
esac
if [ ${ROOTDELAY:-0} -gt $slumber ]; then
  slumber=$ROOTDELAY
fi

case "$dev_id" in
UUID=*|LABEL=*|/dev/*)
  FSTYPE=$( wait-for-root "$dev_id" $slumber )
  ;;
*)
  wait_for_udev 10
  ;;
esac

The dev_id variable is assigned the value of RESUME which is defined at /etc/initramfs-tools/conf.d/resume. This UUID which is assigned to RESUME

> cat /etc/initramfs-tools/conf.d/resume
RESUME=UUID=67b3fe6f-1ec4-413f-8c5a-1136bc7f3270

Fix LLVM

> sudo sed -e 's/^RESUME=/#RESUME=/g' -i /etc/initramfs-tools/conf.d/resume
> echo "RESUME=/dev/mapper/ubuntu--vg-swap_1" | sudo tee -a /etc/initramfs-tools/conf.d/resume

Recreate initrd and reboot system.

> sudo update-initramfs -u
> sudo reboot
Back to top