What the message looks like
myapp.service: Start request repeated too quickly.
myapp.service: Failed with result 'start-limit-hit'.
Failed to start myapp.service - My application.Common causes
- The program exits right after start: wrong config, missing file, permission problem or a port that is already in use.
Restart=alwayswith a very shortRestartSecrestarts a broken service too often.- A dependency (database, mount, network) is not ready yet.
- More than 5 starts within 10 seconds, the defaults of
StartLimitBurstandStartLimitIntervalSec. - A bad update changed a binary or a configuration.
Check
- State and last lines of the unit
systemctl status myapp --no-pager - Why did it crash? Read the journal of the unit
- The limits that apply to this unit
systemctl show myapp -p Restart -p RestartUSec -p StartLimitBurst -p StartLimitIntervalUSec
Fix
- Find and fix the real error in the journal first (config, permission, port, dependency).
- Clear the failed state:
systemctl reset-failed myapp, thensystemctl start myapp. - Give the service breathing room:
RestartSec=5in[Service]and, if needed,StartLimitIntervalSec=60andStartLimitBurst=5in[Unit]. - Add
After=andRequires=for dependencies that must be ready first. - Run
systemctl daemon-reloadafter editing the unit file.
FAQ
Can I just raise the start limit?
You can, but it only hides a crash loop. First find out why the process exits. Raise the limit only for a service that is meant to restart often.
How do I see all failed units?
Run systemctl --failed.