Quick answer: Run systemd-analyze blame to see which service takes the longest. Then either disable it with systemctl disable servicename or fix it by adjusting its unit file timeout.
Why your boot is slow
You probably already ran systemd-analyze and saw something like "30 seconds boot time." The real problem is usually one or two services that take forever. A network manager waiting for a DHCP lease. A Docker service stuck on a dead container. A swap service that can't find the partition. It happens. The boot isn't slow because your kernel is bad. It's slow because a service fails or waits too long.
I've seen this on Ubuntu 22.04 with a bad network interface. And on Fedora 38 after a kernel update where the NVIDIA driver service timed out. The systemd default timeout for services is 90 seconds. That means one service can waste 90 seconds of your life every boot.
Step 1: Find the slow service
Open a terminal. Run this:
systemd-analyze blame
After you press Enter, you'll see a list. Each line shows a service name and how long it took. The slowest one is at the top. Look for something like networkd-dispatcher.service taking 45 seconds. Or docker.service taking 30 seconds. Write down the exact service name.
If you want more detail, run this too:
systemd-analyze critical-chain
That shows you which service is the bottleneck in the boot sequence. The @ timestamps tell you when each service started. The slow one will have a big gap.
Step 2: Decide what to do with it
Now you have a name. Say it's docker.service. Ask yourself: do I need this service at boot? If you always start Docker manually, you can disable it. If you need it but it's slow because of a bad config, fix the config. If you need it but it's just slow by nature (like a network wait), you can increase its timeout or mask it.
Here's what each option means:
- Disable — The service won't start at boot. You can start it manually later. This is safe for things like Docker or Bluetooth services.
- Mask — The service can't start at all. Even if something tries to start it, it fails silently. This is for services that are broken and keep restarting.
- Fix the unit file — You change the timeout so systemd waits less time. This is for services that always fail quickly but systemd waits 90 seconds.
Step 3: Disable the service
If you want to disable it, run:
sudo systemctl disable servicename.service
Replace servicename.service with the actual name, like docker.service. After that, run:
systemd-analyze blame
You should see that service no longer appears. Boot time should drop. But wait — if the service is already running, you might want to stop it now too:
sudo systemctl stop servicename.service
Step 4: Mask the service (if disabling isn't enough)
Some services get re-enabled by updates or dependencies. Masking is stronger. To mask:
sudo systemctl mask servicename.service
After this, running systemctl start servicename.service will fail with "Unit servicename.service is masked." I only mask services I'm 100% sure I never need. For example, on a laptop that never uses Bluetooth, I mask bluetooth.service.
Step 5: Fix the timeout (if you need the service)
If you need the service but it's slow because of a wait, edit its unit file. Run:
sudo systemctl edit servicename.service
That opens a blank file in your default editor. Add these lines:
[Service]
TimeoutStartSec=10
Save and exit. This tells systemd to wait only 10 seconds for the service to start. If it doesn't start in 10 seconds, systemd marks it as failed and continues booting. The service might still start later if it's set to restart. But the boot won't wait.
After saving, reload systemd:
sudo systemctl daemon-reload
Then reboot and check systemd-analyze blame again. The slow service should either be gone or show a much shorter time.
Alternative fix 1: Check for failed services
Sometimes a service is slow because it's failing and retrying. Run:
systemctl --failed
If you see failed services, check their logs with journalctl -u servicename.service. Fix whatever is wrong. Often it's a missing config file or a network interface that doesn't exist.
Alternative fix 2: Disable watchdog timers
Some service unit files have WatchdogSec set. If a service is slow to respond, the watchdog kills it and restarts it. That can add time. To check if a service has a watchdog:
systemctl show servicename.service | grep Watchdog
If you see a value like 30 seconds and the service keeps restarting, you can override it in the same systemctl edit file:
[Service]
WatchdogSec=0
This disables the watchdog. The service can now run as slow as it wants without being killed and restarted. Use this for services that are intentionally slow (like a server waiting for a database).
Prevention tip: Check after every kernel update
After a kernel update on Ubuntu 22.04 or Fedora 38, run systemd-analyze blame once. Drivers can change. A graphics driver service might get slower. A network driver might now cause a timeout. Catching it early saves you from a 2-minute boot for a month. Also, if you ever install Docker or a new service, check if it adds itself to boot. Some services are greedy. You don't need everything at startup.
That's it. You don't need to tweak kernel parameters or recompile anything. Just find the lazy service and kick it out of the boot line.