jdx/mise · error · eyre::Report

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

Error message

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

What it means

The apt branch of validate_host_requirements requires the apt-get binary because mise drives apt-get directly against the unpacked debian rootfs (no container engine). Hosts without apt-get — alpine, fedora, arch, macOS — cannot produce apt layers and fail this check before any work.

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 9dcfcaa0dc)

Solutions

  1. Run the build on a debian/ubuntu host or container (ubuntu-latest runner works).
  2. If the host is alpine, switch packages/base to apk instead.
  3. Verify with `command -v apt-get` before invoking mise oci build.

Example fix

# before (alpine host, debian base)
[bootstrap]
base = "debian:bookworm-slim"

# after
# either build from a debian host, or:
[bootstrap]
base = "alpine:3.20"
Defensive patterns

Strategy: validation

Validate before calling

import shutil, sys
if apt_entries(config) and shutil.which("apt-get") is None:
    sys.exit("host has no apt-get; build from a debian/ubuntu host or switch base to alpine")

Prevention

When it happens

Trigger: mise oci build with apt/[bootstrap.packages] entries (or a debian/ubuntu base) on a host where file::which("apt-get") is None.

Common situations: Building debian-based images from an alpine or macOS workstation; minimal debian-based dev containers that stripped apt; CI images without apt-get.

Related errors


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