Chapter 5. Optimizing systemd to shorten the boot time
You can optimize system performance by managing services associated with systemd. Review services that systemd starts during boot time and evaluate them according to your requirements. Disabling certain services that start at boot can shorten the boot time.
5.1. Examining system boot performance Copy linkLink copied to clipboard!
You can tune the systemd service by using the systemd-analyze command to shorten boot time and examine boot performance.
Procedure
List all enabled services to determine
systemdto tune the boot time:systemctl list-unit-files --state=enabled
$ systemctl list-unit-files --state=enabledCopy to Clipboard Copied! Toggle word wrap Toggle overflow Analyze the information about the time that the last successful boot took:
systemd-analyze
$ systemd-analyzeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Analyze the unit initialization time of each
systemdunit:systemd-analyze blame
$ systemd-analyze blameCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output lists the units in descending order according to the time they took to initialize during the last successful boot.
Identify critical units that took the longest time to initialize at the last successful boot:
systemd-analyze critical-chain
$ systemd-analyze critical-chainCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
The output with red color text indicates the units that can critically slow down the boot.
For details, see
systemd(1),systemctl(1), andsystemd-analyze (1)man pages on your system.
5.2. A guide to disable selective services Copy linkLink copied to clipboard!
To reduce boot time of your system, you need to selectively disable only the non-essential services that start automatically at boot time.
List enabled services:
systemctl list-unit-files --state=enabled
$ systemctl list-unit-files --state=enabledCopy to Clipboard Copied! Toggle word wrap Toggle overflow Disable a service:
systemctl disable <service_name>
# systemctl disable <service_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Some services are not critical yet required for normal functioning of Red Hat Enterprise Linux (RHEL). Except these services, you can disable other services that are enabled by default with a minimal installation of RHEL.
| Service name | Details |
|---|---|
|
|
Disable |
|
|
Be aware that no items from |
|
|
A symlink to |
|
|
A symlink to |
|
|
A symlink to |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
This service is not started unless the |
|
|
Disable |
|
|
Disable |
|
|
Disable After enabling this service, the system does not finish the boot before the network connection is working. This setting prolongs the boot time significantly. |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
An alias for |
|
|
Disable |
|
|
Disable |
|
|
Disable |
|
|
Disable |
To find details about a service, use one of the following commands:
systemctl cat <service_name>
$ systemctl cat <service_name>
systemctl help <service_name>
$ systemctl help <service_name>
The systemctl cat command displays the contents of a service’s main unit file, typically located at /usr/lib/systemd/system/<service>, along with any override files. Overrides include custom unit files in /etc/systemd/system/<service> or drop-in configuration files in corresponding unit.type.d directories. For details, see the systemd.unit(5) man page or use systemctl help <service> to view the manual for a specific service.