jdx/mise · error

mise oci needs `apt-get` on PATH to install apt system…

Error message

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

What it means

apt package installation into images uses the host's `apt-get` (with dpkg) against the image root. mise validates required binaries up front; if `apt-get` is absent from PATH the build fails with this error before any packages are attempted.

Solutions

  1. Install apt on the host (switch to a Debian/Ubuntu host or container)
  2. Fix PATH so `/usr/bin/apt-get` is reachable
  3. Run the build inside a Debian/Ubuntu container that ships apt-get
  4. Switch the bootstrap.packages entries to apk on an Alpine-capable host
Defensive patterns

Strategy: validation

Validate before calling

command -v apt-get >/dev/null || echo "apt-get missing; use a Debian/Ubuntu host or container"

Try / catch

match build() {
    Err(e) if e.to_string().contains("needs `apt-get` on PATH") => {
        eprintln!("run the build in a Debian/Ubuntu environment");
    }
    r => r,
}

Prevention

When it happens

Trigger: Running `mise oci build` with `[bootstrap.packages] apt = [...]` on a host where `apt-get` is not installed — e.g. Alpine, macOS, or a slim container without apt tooling.

Common situations: Building a Debian-based image on an Alpine or Fedora host; slim CI images without apt; PATH not including /usr/bin due to environment sanitization.

Related errors


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

Appendix: source

Thrown at src/oci/packages.rs:148

fn validate_host_requirements(manager: OciPackageManager) -> Result<()> {
    match manager {
        OciPackageManager::Apk => {
            if std::env::consts::OS != "linux" {
                bail!("mise oci needs a Linux host to install apk system packages into an image");
            }
            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 {

View on GitHub (pinned to 533346cc37)