jdx/mise · error

mise oci needs `dpkg` on PATH to install apt system…

Error message

mise oci needs `dpkg` on PATH to install apt system packages into the image

What it means

apt installs also require `dpkg`, which `apt-get` shells out to at the package-unpacking stage. mise validates both binaries in `validate_host_requirements` and throws this error when `dpkg` specifically is missing even though `apt-get` was found.

Solutions

  1. Reinstall dpkg on the host (`apt-get install --reinstall dpkg` on a working Debian system, or the distro equivalent)
  2. Fix PATH so `/usr/bin/dpkg` is visible
  3. Run the build inside a standard Debian/Ubuntu container where both tools exist
Defensive patterns

Strategy: validation

Validate before calling

command -v apt-get >/dev/null && command -v dpkg >/dev/null || echo "apt toolchain incomplete; dpkg missing"

Try / catch

match build() {
    Err(e) if e.to_string().contains("needs `dpkg` on PATH") => {
        eprintln!("reinstall dpkg or use a standard Debian/Ubuntu container");
    }
    r => r,
}

Prevention

When it happens

Trigger: Running `mise oci build` with `[bootstrap.packages] apt = [...]` on a host where apt-get exists but dpkg is missing or not on PATH (unusual, e.g. partially stripped images or broken PATH).

Common situations: Hosts with apt frontends removed but dpkg uninstalled; container images that ship apt-get from another source without dpkg; PATH anomalies hiding /usr/bin/dpkg.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/7b845edeb9276c43. Report an issue: GitHub.

Appendix: source

Thrown at src/oci/packages.rs:153

            }
            if file::which("apk").is_none() {
                bail!("mise oci needs `apk` on PATH to install apk system packages into the image");
            }
            if !crate::system::sudo::is_root() {
                bail!(
                    "mise oci needs to run as root to install apk system packages because apk \
                     executes package scripts in a chroot"
                );
            }
        }
        OciPackageManager::Apt => {
            if file::which("apt-get").is_none() {
                bail!(
                    "mise oci needs `apt-get` on PATH to install apt system packages into the image"
                );
            }
            if file::which("dpkg").is_none() {
                bail!(
                    "mise oci needs `dpkg` on PATH to install apt system packages into the image"
                );
            }
        }
    }
    Ok(())
}

fn prepare_and_snapshot(
    manager: OciPackageManager,
    rootfs: &Path,
) -> Result<BTreeMap<PathBuf, FsEntry>> {
    match manager {
        OciPackageManager::Apk => prepare_apk_install(rootfs)?,
        OciPackageManager::Apt => prepare_apt_install(rootfs)?,
    }
    snapshot(rootfs)
}

View on GitHub (pinned to 533346cc37)