How to speed up boot time on Linux if it boots slowly

My Linux computer was very slow to start up. It took approximately 4 minutes to get to the login prompt.

Before performing any of the steps below, take a backup of the data on the computer. Also, you follow the steps below at your own risk. No one is responsible for whatever you do with your system.

Below are the steps to fix the problem:
1. Find out which services or processes take a long time at boot.
2. Disable unwanted services.
3. Reduce the journal size if systemd-journal-flush.service is takes long to startup.
4. Remove any unwanted service packages, if needed.

Firstly, find out which processes or services take the longest time in milliseconds to start. To analyze what is the duration of start up services on a Linux computer, open a terminal window and enter below command:
$ sudo systemd-analyze blame <enter>

The output is similar to this:
250.753s systemd-journal-flush.service
7.407s ubuntu-system-adjustments.service
5.740s NetworkManager.service
4.922s preload.service
4.816s dev-mapper-mint\x2droot.device
4.303s networking.service
4.210s accounts-daemon.service
3.903s thermald.service
3.118s udisks2.service
2.428s rsyslog.service
2.348s grub-common.service
2.344s apport.service
2.238s lvm2-monitor.service
1.937s lightdm.service
1.936s plymouth-quit-wait.service
1.923s systemd-fsck@dev-disk-by\x2duuid-E042\x2d13DB.service
1.741s systemd-tmpfiles-clean.service
1.681s bluetooth.service
1.667s systemd-udevd.service

Secondly, some steps can be taken to reduce the start up time by disabling unwanted services. In a terminal window and enter the following commands:

$ sudo systemctl disable ureadahead <enter>
$ sudo systemctl disable ModemManager <enter>
$ sudo systemctl disable plymouth <enter>
$ sudo systemctl disable systemd.networkd.service <enter>

Thirdly, to reduce the journal startup time and reduce journal size, in the terminal window, do the following steps:
Check if the journal is enabled:
$ sudo journalctl -b --unit systemd-journald <enter>

Next to optimize the journal, do the following:
$ sudo journalctl --vacuum-size=1G --vacuum-time=5d --vacuum-files=5 <enter>

The below content is displayed:
— Logs begin at Sat 2019-11-16 10:00:35 IST, end at Mon 2019-11-18 21:48:28 IST
Nov 18 19:31:07 rm01 systemd-journald[483]: Journal started
Nov 18 19:31:07 rm01 systemd-journald[483]: Runtime journal (/run/log/journal/82
Nov 18 19:31:08 rm01 systemd-journald[483]: Time spent on flushing to /var is 99
Nov 18 19:31:08 rm01 systemd-journald[483]: System journal (/var/log/journal/829

Check the size of the journal now:
$ sudo journalctl --disk-usage <enter>

The below message is displayed.
Archived and active journals take up 48.0M in the file system.

Right now it shows that the journal size has been reduced to 48.0M after optimization.

Fourthly, if needed, remove the unwanted service packages.
$ sudo apt-get remove networkd-dispatcher <enter>
$ sudo systemctl disable systemd-networkd.service <enter>

Restart the computer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s