Linux systemd Dependency Failed — Service Cannot Start
About Linux systemd Dependency Failed
A systemd service failing due to dependency means a required service it depends on has not started or has failed. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: systemd services can declare dependencies with Requires=, Wants=, After=. If a Required dependency fails, the dependent service also fails. Wants= dependencies are softer — the service starts even if they fail. Circular dependencies can prevent entire dependency chains from starting. systemd orders startup based on Before= and After= directives. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Required dependency service failed to start. Circular dependency between two or more services. Network-dependent service started before network was ready. Mount point dependency not available at service start time. Custom service missing After=network-online.target directive. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Check which dependency failed: systemctl status service-name — look for 'dependency failed'. List dependencies: systemctl list-dependencies service-name. Fix the failed dependency first, then restart the dependent service. For network services, add After=network-online.target and Wants=network-online.target. Check for circular deps: systemd-analyze verify /etc/systemd/system/service-name.service. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What is the difference between Requires and Wants?
Requires= makes the service fail if the dependency fails. Wants= tries to start the dependency but continues even if it fails.
Overview
A systemd service failing due to dependency means a required service it depends on has not started or has failed.
Key Details
- systemd services can declare dependencies with Requires=, Wants=, After=
- If a Required dependency fails, the dependent service also fails
- Wants= dependencies are softer — the service starts even if they fail
- Circular dependencies can prevent entire dependency chains from starting
- systemd orders startup based on Before= and After= directives
Common Causes
- Required dependency service failed to start
- Circular dependency between two or more services
- Network-dependent service started before network was ready
- Mount point dependency not available at service start time
- Custom service missing After=network-online.target directive
Steps
- 1Check which dependency failed: systemctl status service-name — look for 'dependency failed'
- 2List dependencies: systemctl list-dependencies service-name
- 3Fix the failed dependency first, then restart the dependent service
- 4For network services, add After=network-online.target and Wants=network-online.target
- 5Check for circular deps: systemd-analyze verify /etc/systemd/system/service-name.service