Trim Unneeded Systemd Services to Speed Up Linux Boot
This guide explains how to identify and disable unnecessary Systemd services on typical Linux distributions, using commands like systemctl, journalctl, and systemd-analyze, to streamline the boot process while avoiding side‑effects from static services.
Most Linux distributions start a variety of services at boot, many of which you may never use (e.g., Bluetooth, Avahi, ModemManager, pppd‑dns). Systemd provides tools to view and control these services, allowing you to clean up the startup sequence on Systemd‑based systems.
Viewing Active Services
Instead of the traditional /etc/init.d approach, Systemd uses its own representation. The following commands list services that start during boot:
systemctl list-unit-files --type=service systemctl list-units --type=service --state=runningThese commands reveal entries such as the Bluetooth service, which you may want to disable.
Disabling a Service
To stop and prevent a service like Bluetooth from starting automatically, run:
sudo systemctl stop bluetooth.service
sudo systemctl disable bluetooth.serviceAfter executing, verify the change with:
systemctl status bluetooth.serviceNote that disabling may not be absolute because other services can reactivate it. Instead of uninstalling the package, you can mask the service to fully block it:
sudo systemctl mask bluetooth.serviceConsider uninstalling only after confirming no adverse effects over a period of use.
Listing All Services
Use the following command to obtain a comprehensive list of services and their enabled/disabled state:
systemctl list-unit-files --type=serviceBe aware that static services cannot be disabled because they are required by other units.
Analyzing Boot Performance
Systemd includes diagnostic tools to investigate boot issues. The command below reproduces all messages from the most recent boot:
journalctl -b -1Replace -1 with -2, -3, etc., to view earlier boots. Since the output can be extensive, apply filters to focus on specific processes, e.g., filtering for PID 1.
Another useful tool is systemd-analyze blame, which lists services ordered by the time they took to start, helping you spot bottlenecks.
Key Takeaways
Identify unnecessary services based on your personal needs and disable or mask them.
Use systemctl commands to manage services safely.
Leverage journalctl and systemd-analyze to debug and optimize boot performance.
Static services cannot be disabled; they are required by other units.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
