If you install Ubuntu 18.04 with LVM, slow boot problem happens. This article will describe a way to avoid this problem. If you install Ubuntu 18.04 without LVM, this problem does not happen.
Table of Contents
1 Slow boot problem when using LVM
systemd-analyze shows that kernel boot time takes a lot of time.
$ systemd-analyze Startup finished in 34.003s (kernel) + 1.843s (userspace) = 35.847s graphical.target reached after 1.822s in userspac
The wait-for-root in /usr/share/initramfs-tools/scripts/local times out after expiring 30 seconds (slumber value).
local_device_setup() { <snip> 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 is the UUID of LVM swap partition.
$ cat /etc/initramfs-tools/conf.d/resume RESUME=UUID=67b3fe6f-1ec4-413f-8c5a-1136bc7f3270
2 Avoid slow boot problem when using LVM
Assign device file path of LVM swap partition to RESUME and use wait_for_udev instead of wait-for-root. This is the same with /etc/initramfs-tools/conf.d/resume in Debian 9.
$ 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
Kernel boot time is faster and you can use hibernation.
$ systemd-analyze Startup finished in 1.920s (kernel) + 2.370s (userspace) = 4.291s graphical.target reached after 2.196s in userspace