Ubuntu is taking too long to boot!!! - Fix Problem

If your Ubuntu laptop/desktop computer taking too long to start, this post is for you to fix this problem. The main problem is often the address of the swap is mis-configured or falsely identified.

First we need to measure the boot up time (start time) accurately. So we will use the systemd analyzer as you see in this command.
systemd-analyze time
systemd-analyze time

After knowing the startup time, we should determine if it is normal or slow?! .. in brief, if the total startup time is less than 25 seconds then it's normal. But if the startup time is more than 25 seconds it's slow.

Identify the UUID of used SWAP partition

To identify swap partition run this command, and type your password.
sudo blkid | grep swap
identify the currently used swap partition

After that, remove any other swap file mentioned on /etc/fstab except the above identified swap.

edit fstab file to remove false swap files

Use any editor as you like to edit the /etc/fstab but make sure to edit it as root (using sudo). I am using VIM, but you can use NANO or GEDIT or EMACS.

And edit /etc/initramfs-tools/conf.d/resume file using favorite editor to replace the UUID with the swap partition one if it is not the same. Don't forget to edit it as root.

change the UUID of swap partition to the correct one

Then run this command to update initramfs.
sudo update-initramfs -u

Now.. reboot (restart) Ubuntu so you can see the best performance and speed are come again!

If you want to get new posts, make sure to subscribe to Value In Brief by Email.