zeroclaw-labs/zeroclaw · warning · DiagItem

systemd user lingering could not be checked with loginctl

Error message

systemd user lingering could not be checked with loginctl

What it means

A `zeroclaw doctor` warning from `systemd_linger_diag_item`: the linger check returned `SystemdUserLinger::Unknown`, meaning `loginctl` could not answer (binary missing, no user session bus, or a non-standard systemd setup). Doctor cannot decide whether the user service will survive logout, so it warns rather than guessing.

Source

Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:1768

        ));
    }
}

fn systemd_linger_diag_item(status: crate::service::SystemdUserLinger) -> DiagItem {
    let cat = "environment";
    match status {
        crate::service::SystemdUserLinger::Enabled => DiagItem::ok(
            cat,
            crate::i18n::get_required_cli_string("cli-doctor-systemd-linger-enabled"),
        ),
        crate::service::SystemdUserLinger::Disabled { user } => DiagItem::warn(
            cat,
            crate::i18n::get_required_cli_string_with_args(
                "cli-doctor-systemd-linger-disabled",
                &[("user", user.as_str())],
            ),
        ),
        crate::service::SystemdUserLinger::Unknown => DiagItem::warn(
            cat,
            crate::i18n::get_required_cli_string("cli-doctor-systemd-linger-unknown"),
        ),
    }
}

fn check_cli_tools(items: &mut Vec<DiagItem>) {
    let cat = "cli-tools";

    let discovered = crate::tools::discover_cli_tools(&[], &[]);

    if discovered.is_empty() {
        items.push(DiagItem::warn(cat, "No CLI tools found in PATH"));
    } else {
        for cli in &discovered {
            let version_info = cli
                .version
                .as_deref()

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Verify `loginctl` is installed and on PATH (`command -v loginctl`).
  2. If running in a container or non-systemd environment, treat this warning as expected and rely on the container supervisor for lifecycle.
  3. On real systemd hosts, check the user session bus (`systemctl --user status`) and dbus-user-session package, then re-run `zeroclaw doctor`.
Defensive patterns

Strategy: fallback

Try / catch

match zeroclaw_runtime::service::systemd_user_linger_status() {
    zeroclaw_runtime::service::SystemdUserLinger::Unknown => {
        // no loginctl answer: treat lifecycle as container/supervisor-managed, not an error
    }
    other => { /* handle Enabled/Disabled as usual */ }
}

Prevention

When it happens

Trigger: Running `zeroclaw doctor` on a host where `systemd_user_linger_status()` cannot complete: `loginctl` absent from PATH, D-Bus user session not available, containers, WSL1, or init systems that are not systemd despite `/run/systemd` hints.

Common situations: Docker/Podman containers with a partial systemd userland; chroot or minimal VMs; broken polkit/dbus setups; SSH sessions without a user session bus.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/3f94a1805124dae4. Report an issue: GitHub.