How to diagnose and fix very slow boot on Ubuntu

How to diagnose and fix very slow boot on Ubuntu

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 noresume parameter.

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:

sudo update-grub

Reboot the computer

Linux does not need antivirus or firewall, myth or truth?

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

Find

TimeoutStartSec=5min

Change to

TimeoutStartSec=5s

and reboot

How to install OpenSnitch firewall on Linux Ubuntu, Fedora, openSUSE and derivatives

Method 3 : You can configure the timeout for Start Job and Stop Jobs.

Edit /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:

from:

#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s 

to:

DefaultTimeoutStartSec=5s
DefaultTimeoutStopSec=5s

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

Remove fsck.mode=skip from /etc/default/grub, and do sudo update-grub.

Let’s check your file system first…

  • boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
  • open a terminal window by pressing Ctrl+Alt+T
  • type sudo fdisk -l
  • identify the /dev/sdXX device name for your “Linux Filesystem”
  • type sudo fsck -f /dev/sdXX, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot

2 Comments

  1. I just followed Method 3 but now my Ubuntu 21.04 is stuck at the boot with the Ubuntu logo sign and the loading thing, it can’t show a login screen anymore, I followed exactly what’s written on Method 3, what do I do now please?

  2. Hey, can you help me to solve this;
    In both Method 1st and 3rd, when I edit the file and try to save it, it prompts out saying “You do not have the permissions necessary to save the file. Please check that you typed the location correctly and try again.”, please tell me if there is any way to save it. Also in method 2nd, when open in terminal blank space open and when searched that term it says that there isn’t anything like that, so please address it too.
    Thank you.

1 Trackback / Pingback

  1. Upgrade Zorin OS 15 to Zorin OS 16 - LinuxStoney

Leave a Reply

Your email address will not be published.


*