jdx/mise · error
systemctl failed
Error message
systemctl {} failed: {} What it means
A `systemctl` invocation spawned by mise (enable, start, daemon-reload, etc.) exited with a non-zero status. mise surfaces the full argument list plus systemctl's own stderr/stdout (via `output_error`) so the underlying systemd reason is visible.
Solutions
- Read the captured systemctl stderr in the error message for the systemd-level cause
- Run the same `systemctl <args>` command by hand to reproduce and inspect
- Validate the unit file with `systemd-analyze verify <unit>`
- Confirm systemd is PID 1 and reachable (`systemctl is-system-running`)
Example fix
// before: invalid unit dependency [Unit] After=nonexistent.target // after [Unit] After=network.target
Defensive patterns
Strategy: try-catch
Validate before calling
systemd-analyze verify /etc/systemd/system/<unit> && systemctl is-system-running
Try / catch
if let Err(e) = apply_plan() { if e.contains("systemctl") { log_systemctl_hint(&e); } } Prevention
- Validate unit files with systemd-analyze before applying
- Confirm systemd runs as PID 1 in your environment
- Test systemctl commands manually first
When it happens
Trigger: Any privileged bootstrap-service plan step routed through `run_systemctl` where systemctl returns failure — e.g. enabling a non-existent unit, daemon-reload without a running systemd, or starting a unit with a broken unit file.
Common situations: Typo in a service name in mise.toml; unit file has a syntax error; systemd not running (containers, WSL1 without systemd); insufficient privileges reaching systemctl despite elevation.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- refusing unsafe change to bootstrap service
- apk info failed
- apt-cache policy failed
- bootstrap service ' ' sets , which only applies to `scope =…
- bootstrap system services are only supported on Linux
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/a85bd77d6de33fd5.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/services.rs:573
active_state: properties
.get("ActiveState")
.copied()
.unwrap_or("unknown")
.to_string(),
unit_file_state: properties
.get("UnitFileState")
.copied()
.unwrap_or("unknown")
.to_string(),
need_daemon_reload: properties.get("NeedDaemonReload") == Some(&"yes"),
}
}
fn run_systemctl(systemctl: &std::path::Path, args: &[String]) -> Result<()> {
info!("$ {} {}", systemctl.display(), shell_words::join(args));
let output = systemctl_output(systemctl, args)?;
if !output.status.success() {
bail!(
"systemctl {} failed: {}",
shell_words::join(args),
output_error(&output)
);
}
Ok(())
}
fn systemctl_output(systemctl: &std::path::Path, args: &[String]) -> Result<Output> {
Ok(Command::new(systemctl)
.args(args)
.env("LC_ALL", "C")
.env("SYSTEMD_PAGER", "")
.output()?)
}
fn output_error(output: &Output) -> String {
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();View on GitHub (pinned to 533346cc37)