Debugging systemd Unit Start Timeouts with cgroup and Journal Evidence
Bottom line: A start operation timed out message tells you almost nothing on its own — the unit could be stuck in ExecStartPre, in a forking parent that never exits, or blocked on a cgroup-level resource, and the default TimeoutStartSec collapses all three into the same error. You separate them by correlating journal timestamps with cgroup accounting, not by staring at the unit file.
The failure mode is consistent: an operator sees the timeout, raises TimeoutStartSec to 600, and the service starts. Nothing was fixed. The unit was always going to take that long because something upstream — a mount, a memory limit, a forking parent — was the real blocker, and the timeout was just the first thing loud enough to notice. What follows is the procedure I use to find the actual blocking phase before touching the timeout.
Know which phase the clock is actually measuring
TimeoutStartSec= bounds the whole start operation, not any single Exec*= line. That means the timer starts when systemd begins activating the unit and stops when the unit reaches its started state — which depends entirely on Type=.
For Type=simple, systemd considers the unit started immediately after fork(), before execve() has even run. The start timeout is therefore nearly meaningless for simple units; a hung binary will sit there forever without tripping it. Type=exec is the better default: the manager waits for the execve() to succeed, so a missing binary or a bad interpreter fails fast instead of hanging.
For Type=forking, systemd waits for the parent process to exit and the child to be reparented. If the parent daemonizes but never exits — a common bug in hand-rolled init scripts wrapped in ExecStart= — you get a start timeout that looks like a slow service and is actually a forking contract violation.
For Type=oneshot, the timeout covers every ExecStart= line in sequence plus any ExecStartPre= and ExecStartPost=. A oneshot with three preparatory commands has one shared budget across all of them, and the error message will not tell you which one consumed it.
The practical consequence: before you read a single log line, check Type=. It determines what the timeout is even measuring.
1 | systemctl show -p Type -p TimeoutStartUSec -p ExecMainStartTimestamp \ |
SubState is the useful field here. start-pre, start, start-post, and running map directly onto the phase the unit is in when the timer fires.
Read the journal with timestamps, not with grep
The default journal output truncates to the second and interleaves boot messages, which is exactly wrong for this. Use --since anchored to the activation attempt and -o short-precise so you can see sub-second gaps.
1 | # Anchor to the last activation attempt for the unit |
The gap pattern is the evidence. If the journal shows Starting myapp.service... and then nothing for the full timeout window, the unit never reached ExecStart= — it is blocked in dependency resolution or in ExecStartPre=. If you see the ExecStartPre= command’s own output and then silence, the block is inside that command. If you see the main binary’s first log line and then silence, the binary is running but not signalling readiness, which points at Type=notify without a sd_notify() call or Type=forking with a parent that will not exit.
One detail the man pages bury: units whose stdout or stderr is connected to the journal automatically acquire an After= dependency on systemd-journald.socket. If journald is slow to come up or is itself restarting, your unit’s start is ordered behind it, and the delay shows up as a start timeout with no application log lines at all. Check systemctl status systemd-journald before blaming the service.
Use cgroup accounting to see what the process is waiting on
The journal tells you when the process last said something. The cgroup tells you what it was doing in between. On cgroup v2, every unit lives under /sys/fs/cgroup/<slice>/<unit>/, and the kernel’s accounting files update continuously.
1 | # Locate the unit's cgroup and read live accounting |
cpu.stat gives you usage_usec and, more usefully, nr_throttled and throttled_usec. If nr_throttled is climbing while the unit sits in start, the process is not blocked on I/O or a lock — it is being starved by a CPUQuota= or a parent slice limit, and the start timeout is a symptom of scheduling starvation. memory.current climbing toward MemoryMax= with memory.events showing oom or high increments means the process is thrashing against a memory limit during startup, which is common for JVM and database units that allocate aggressively before serving.
cgroup.events contains populated 1 while processes exist and flips to 0 when the cgroup empties. If it flips to 0 mid-start and the unit is Type=forking, the parent exited and the child died — that is a crash, not a timeout, and the timeout message is a red herring.
1 | # Confirm whether the start is CPU-throttled or memory-pressured |
systemd-analyze critical-chain is the fastest way to see whether the unit is waiting on a mount, a socket, or a target. Units with WorkingDirectory=, StateDirectory=, RuntimeDirectory=, or PrivateTmp=yes automatically gain Requires= and After= dependencies on the relevant mount units. A slow NFS mount backing StateDirectory= will hold the unit in dependency resolution for the entire timeout window, and the journal will show nothing from your service because it has not run yet.
The comparison that matters
| Symptom in journal | SubState at timeout |
cgroup evidence | Actual cause |
|---|---|---|---|
Starting... then silence |
start-pre |
pids.current = 1, low usage_usec |
ExecStartPre= command blocked (network, lock, slow disk) |
Starting... then silence |
start |
pids.current = 0 or flapping |
Dependency or mount not satisfied; unit never exec’d |
ExecStartPre output, then silence |
start |
pids.current = 1, nr_throttled rising |
CPU quota starvation during init |
| Main binary logs once, then silence | start |
memory.current near MemoryMax, memory.events high |
Memory pressure or OOM-kill loop |
Starting..., parent exits, child gone |
start |
cgroup.events populated 0 |
Type=forking contract violated; child crashed |
| No unit logs at all | start |
cgroup exists, pids.current = 0 |
Ordered behind systemd-journald.socket or a mount |
The table is the whole method in one place: SubState narrows the phase, cgroup counters distinguish starvation from blocking from crashing, and the journal gap tells you whether the process ever ran.
Pitfalls and how to diagnose each
Raising TimeoutStartSec as the first move. It converts a fast failure into a slow one and hides the phase. Diagnose by reverting the timeout and reading SubState at the moment of failure with systemctl show -p SubState.
Assuming Type=simple gives you a start timeout. It does not, in any useful sense — the unit is marked started before execve(). Diagnose by checking Type= and switching to exec if the binary should be validated.
Missing the implicit After=systemd-journald.socket. Any unit logging to the journal is ordered behind journald. Diagnose with systemd-analyze critical-chain and look for journald in the chain.
Ignoring implicit mount dependencies. StateDirectory=, CacheDirectory=, LogsDirectory=, RuntimeDirectory=, WorkingDirectory=, and PrivateTmp=yes all add Requires=/After= on mount units. A hung mount blocks the start with zero application logs. Diagnose with systemctl list-dependencies --after myapp.service and findmnt.
Misreading Type=forking timeouts as slow startup. The parent not exiting is a bug in the daemon, not a tuning problem. Diagnose by watching pids.current and cgroup.events during the attempt — if populated drops to 0, the child died.
Forgetting that oneshot shares one budget across all Exec*= lines. Diagnose by timing each command manually outside systemd, or by splitting the unit.
Overlooking slice-level limits. A CPUQuota= or MemoryMax= on the parent slice throttles every unit inside it. Diagnose with systemd-cgls and by reading cpu.stat at the slice level, not just the unit level.
FAQ
Why does my unit time out with no log output from the service at all?
The service never ran. Either it is blocked in dependency resolution — most often a mount required by StateDirectory=, WorkingDirectory=, or PrivateTmp=yes — or it is ordered behind systemd-journald.socket and journald is slow or restarting. Check SubState and systemd-analyze critical-chain before reading application logs, because there will not be any.
Does TimeoutStartSec= cover ExecStartPre= and ExecStartPost=?
Yes. The timeout bounds the entire start operation from activation to the started state, and for Type=oneshot that includes every ExecStartPre=, ExecStart=, and ExecStartPost= line sharing a single budget. The error message does not identify which line consumed it, so time the commands individually.
Why does Type=simple never hit the start timeout even when the binary is hung?
Because systemd marks a simple unit started immediately after fork(), before execve() runs. A hung binary is already “started” from the manager’s perspective. Switch to Type=exec if you want the manager to wait for execve() to succeed, or Type=notify if the service can signal readiness itself.
How do I tell CPU throttling apart from an I/O block during startup?
Read cpu.stat in the unit’s cgroup. If nr_throttled and throttled_usec are climbing while the unit sits in start, the process is being starved by a CPUQuota= or a parent slice limit. If those counters are flat and usage_usec is barely moving, the process is blocked on something outside the CPU — a lock, a socket, or a mount.
What does cgroup.events showing populated 0 during a start attempt mean?
The cgroup emptied, which means every process in it exited. For a Type=forking unit this usually means the parent exited and the child crashed before systemd could track it, so the timeout message is masking a crash. Check the journal for the child’s exit and systemctl status for the exit code.
Can a memory limit cause a start timeout rather than an OOM kill?
Yes, when MemoryHigh= is set without MemoryMax=. The kernel throttles the cgroup and reclaims aggressively instead of killing, so the process makes slow progress and the start exceeds its budget. Watch memory.current against MemoryHigh and check memory.events for high increments during the attempt.







