ThisCalculator

Everyday

Active Exited in systemctl? Meaning & Fix

Updated · Standard formula, shown below

Active Exited in systemctl? Meaning & Fix

When you run systemctl status on a service and see Active: active (exited), it means the service started successfully, ran its main process to completion, and then exited with a zero (success) status—this is normal and expected for services that perform a one-time task and do not need to keep running. The systemd init system intentionally marks such units as “active” because they completed their job without error, not because a process is currently alive. This article explains exactly what this state means, why it is not a problem, how to distinguish it from failures, and what to do if you suspect something is wrong.

What Does Active (Exited) Mean in systemd?

In systemd, every service unit has a state that describes whether it is started, running, or stopped. The active (exited) state appears when a service has been started successfully, its main process has run and terminated with a zero exit code, and the service is not expected to keep a process alive. This is common for services that perform a one-time action at boot, such as filesystem checks, network configuration, or systemd-tmpfiles setup.

Unlike a long-running daemon (like a web server) that stays in active (running), an exited service has finished its job. The key point is that active means the service completed its intended work successfully, not that a process is still running. The opposite—inactive (dead) or failed—would indicate a problem.

Why Do Some Services Exit Immediately?

Many systemd services are designed as oneshot or simple types. A oneshot service runs a single command and then exits; systemd records the exit status. If the command returns zero, the unit is marked active (exited). If the command fails (non-zero exit), the unit becomes failed.

For example, a service that mounts a filesystem, runs a cleanup script, or seeds random data is meant to exit. The Type=oneshot directive in the unit file tells systemd to expect the process to exit. Even with Type=simple, if the process exits quickly with success, systemd still reports active (exited).

How to Check If the Service Actually Succeeded

To verify that an active (exited) service is healthy, look at its full status and logs:

  • Run systemctl status and check the Active: line plus the Process: line, which shows the exit code (e.g., ExecStart=/usr/bin/foo with Main PID: 1234 (code=exited, status=0/SUCCESS)).
  • Use journalctl -u to view the service’s log output. A clean log with no error messages confirms success.
  • Check if the service has dependencies that require it to remain active; if not, exited is fine.

If the exit status is non-zero (e.g., status=1/FAILURE), the service has failed even though the state might show failed—not active (exited). So active (exited) inherently means success.

Common Misconceptions and Mistakes

A frequent misconception is that active (exited) means the service crashed or was killed. That is wrong—a crash would show as failed or inactive (dead) with a non-zero exit code. Another mistake is trying to restart an exited service expecting it to run continuously; for oneshot services, restarting simply runs the command again, which may be unnecessary or even harmful (e.g., re-running a setup script).

Also, users sometimes confuse active (exited) with active (dead)—the latter is not a real state; systemd uses inactive (dead) for stopped units. Always read the full state string, not just the word “active.”

When Should You Worry About Active (Exited)?

In almost all cases, you should not worry. However, there are two scenarios to investigate:

  • The service is supposed to be long-running (e.g., a database or web server) but shows active (exited). This indicates a misconfiguration—the service type is wrong or the process exited unexpectedly. Check the unit file’s Type= directive; it should be simple or forking for daemons, not oneshot.
  • The service is a dependency for other services, and those dependents fail to start because the exited service did not complete its job (even with exit code 0). In that case, check the logs for missing files or incomplete setup.

If the service is a oneshot that should run at boot and you see it exited, that is normal. You can test it by running systemctl start again—it will exit again, and that is fine.

How to Change a Service That Should Not Exit

If you have a service that exits but should stay running, you need to edit its unit file. For example, if you wrote a custom service that runs a script and the script returns immediately, set Type=simple (or Type=forking if the script daemonizes) and ensure the ExecStart command runs a process that stays in the foreground. For a script that backgrounds itself, use Type=forking and set PIDFile= appropriately.

To modify a unit file, run systemctl edit to create an override snippet, or edit the original file in /etc/systemd/system/ (for user-created units) and then run systemctl daemon-reload and systemctl restart .

Frequently Asked Questions

Q: Is “active (exited)” the same as “inactive (dead)”?
A: No. active (exited) means the service started and completed successfully, while inactive (dead) means the service is not currently active—it may have never been started or was stopped. active (exited) is a positive state; inactive (dead) is neutral.

Q: How do I make a service that exits not show as “active (exited)”?
A: You cannot change the state for a oneshot service—it will always exit. If you want it to stay running, you must change the service type to simple and have the command run a long-lived process. Otherwise, active (exited) is correct and should be left as is.

Q: Can I restart an “active (exited)” service?
A: Yes, you can run systemctl restart , which will run the ExecStart command again. For oneshot services, this is safe but may redo setup tasks. If the service is not idempotent, restarting could cause issues, so only do it when necessary.

Q: Why does my custom service show “active (exited)” even though I want it to run forever?
A: This usually happens because your ExecStart command runs a script that finishes quickly (e.g., a script that backgrounds a process and returns). Set Type=simple and ensure the command runs the process in the foreground, or use Type=forking if the process daemonizes itself. Then reload systemd and restart the service.

Q: Does “active (exited)” affect system boot time?
A: Only if the service is in the boot critical path. Most oneshot services are fast and do not slow boot noticeably. If a oneshot service takes a long time, it can delay boot, but the exited state itself is not a performance issue.

Q: What is the difference between “active (exited)” and “active (running)”?
A: active (running) means the service has one or more processes currently running. active (exited) means the service has completed successfully and no process is running. Both are healthy states; the difference is whether the service is expected to keep running.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.