Today we are going to learn How to diagnose and fix very slow boot on Ubuntu 20.04 LTS and Ubuntu 21.04, investigating why Ubuntu booting slowly can be difficult. There are a lot of things that can go wrong: a lingering service, a bad config file, a wrong disk uuid in fstab and others. I upgraded to 20.04 LTS and encountered the slow booting issue. I was able to fix it by booting the kernel with the
I have no swap space. At some point during the upgrade, the initramfs config was modified, adding a line pointing to a nonexistent swap partition. The slow boot was because it was looking for this partition and then timing out after 30 seconds.
Method 1 : Fix very slow boot on Ubuntu to update GRUB so that it passes this option to the kernel automatically on boot:
Edit the file
/etc/default/grub file so that the string
noresume is included in the
GRUB_CMDLINE_LINUX_DEFAULT line, for example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noresume"
Run this command to update GRUB:
Reboot the computer
Method 2 : Try from “No splash screen to Kernel” to find which processes are taking the most time for booting.
A start job is running for Raise network interfaces (1min 26s / 5min 24s)
So, we need to reduce time for this process to save boot time. To do so,
You have to edit,
sudo nano /etc/systemd/system/network-online.target.wants/networking.service
Method 3 : You can configure the timeout for Start Job and Stop Jobs.
/etc/systemd/system.conf with elevated privileges and change/add two lines that are commented by default from 90 seconds to 5 (or whatever you prefer) and uncomment it:
After that, apply the changes by rebuilding your initramfs with the command:
sudo update-initramfs -u
Method 4 : Diagnose and fix very slow boot on Ubuntu Using fsck Disk Check
fsck.mode=skip from /etc/default/grub, and do
Let’s check your file system first…
- boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
- open a
terminalwindow by pressing Ctrl+Alt+T
sudo fdisk -l
- identify the /dev/sdXX device name for your “Linux Filesystem”
sudo fsck -f /dev/sdXX, replacing
sdXXwith the number you found earlier
- repeat the
fsckcommand if there were errors