jdx/mise · error · eyre::Report

not running as root and system_packages.sudo is disabled. Ru

Error message

not running as root and system_packages.sudo is disabled. Run manually:
  {manual_cmd}

What it means

Raised by ensure_elevation_available when an operation requires root privileges, mise is not running as root, and the user has explicitly disabled sudo elevation via the system_packages.sudo setting. Instead of attempting elevation, mise refuses and embeds the exact manual command (manual_cmd) the user can copy-paste to perform the step themselves.

Source

Thrown at src/system/sudo.rs:256

        .spawn()?;
    child
        .stdin
        .take()
        .expect("piped stdin is available")
        .write_all(input)?;
    let output = child.wait_with_output()?;
    if !output.status.success() {
        bail!("elevated bootstrap helper failed with {}", output.status);
    }
    Ok(output.stdout)
}

fn ensure_elevation_available(manual_cmd: &str) -> Result<()> {
    if is_root() {
        return Ok(());
    }
    if !Settings::get().system_packages.sudo {
        bail!(
            "not running as root and system_packages.sudo is disabled. Run manually:\n  {manual_cmd}"
        );
    }
    if crate::file::which("sudo").is_none() {
        bail!(
            "sudo not found. Run as root:\n  {}",
            manual_cmd.trim_start_matches("sudo ")
        );
    }
    if !console::user_attended_stderr() {
        let ok = Command::new("sudo")
            .args(["-n", "true"])
            .stdin(Stdio::null())
            .stdout(Stdio::null())
            .stderr(Stdio::null())
            .status()
            .map(|status| status.success())
            .unwrap_or(false);

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Run the manual command printed in the error message verbatim - it is the exact command mise would have executed via sudo
  2. Re-enable elevation with `system_packages.sudo = true` in settings.toml (or the corresponding env var) and retry
  3. Run mise itself as root (container/CI image) so the is_root() short-circuit passes

Example fix

# ~/.config/mise/settings.toml (before)
[system_packages]
sudo = false

# after - allow mise to elevate via sudo
[system_packages]
sudo = true
Defensive patterns

Strategy: validation

Validate before calling

# shell: gate the privileged step explicitly
if [ "$(id -u)" -ne 0 ] && ! grep -q '^sudo = true' ~/.config/mise/settings.toml 2>/dev/null; then
  echo "run as root, enable system_packages.sudo, or execute the manual command mise prints"
fi

Prevention

When it happens

Trigger: A system-packages/bootstrap operation that needs privilege while Settings::get().system_packages.sudo is false and euid != 0; the code path is reached from any privileged install/ensure step.

Common situations: Hardened setups where users opted out of mise ever invoking sudo, then run a bootstrap that installs system packages; shared machines where sudo is policy-restricted.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/544b7cf4081ad613. Report an issue: GitHub.