Rebuilding a Linux System went well, but afterwards I realized that my new system was taking forever to boot. [SOLVED] Slow Boot w/errors suggested some ways to proceed. A first step was to edit /boot/grub/grub.cfg
, replacing GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
by GRUB_CMDLINE_LINUX_DEFAULT=""
, to show all the messages in the boot process, and also get a quick look at where it might be hung up. Fine with me, I like to see all those messages. Also, the command systemd-analyze blame
shows how much time each step was taking. The offender appeared to be on or just after mounting the root (/) partition.
There were more specifics in Upgraded Ubuntu 18.04 suddenly boots slowly? Read this. What can happen is the critical system file /etc/fstab
can have the wrong UUID for the /swap
partition, if you explicitly create one in your installation. 15+ years ago, when I was installing Slackware, that file was manually created, but the Ubuntu and similar modern installation programs create it automatically. Apparently they sometimes screw up. This is why the boot hangs for while. The boot process is trying to create a swap file using a partition that does not exist, according to the UUID in /etc/fstab
. Eventually it gives up and moves on, but “eventually” can mean minutes. That is what happened to me. I looked up the correct UUID using gparted
and carefully edited the swap
line in /etc/fstab
to use that value. Much better now.
Of course, if I had followed the default Ubuntu installation path there would have been no swap partition, but just a swap file in the root partition. But that is not what I wanted to do. A subsequent post will explain why. But from now on, when I tell the installer to create a swap partition, I will check /etc/fstab
afterward.
Pingback: Installing Debian Linux | From Hilbert Space to Dilbert Space, and beyond