jdx/mise · error · eyre::Report

mise oci found apk packages in [bootstrap.packages], but the

Error message

mise oci found apk packages in [bootstrap.packages], but the base image does not contain an apk database. Use an Alpine/Wolfi base image or remove the apk entries.

What it means

prepare_apk_install requires both /etc/apk and the apk database directory /lib/apk/db inside the unpacked base image. apk entries were collected, but apk needs its installed-packages database to operate in the chroot; without it apk cannot resolve dependencies, so mise aborts rather than run apk against a rootfs it cannot manage.

Source

Thrown at src/oci/packages.rs:344

            return Err(e).wrap_err_with(|| format!("reading metadata for {}", path.display()));
        }
    }
    Ok(())
}

fn prepare_apt_install(rootfs: &Path) -> Result<()> {
    if !rootfs.join("etc/apt").is_dir() {
        bail!(
            "mise oci found apt packages in [bootstrap.packages], but the base image does not \
             contain /etc/apt. Use a Debian/Ubuntu base image or remove the apt entries."
        );
    }
    prepare_apt_rootfs(rootfs)
}

fn prepare_apk_install(rootfs: &Path) -> Result<()> {
    if !rootfs.join("etc/apk").is_dir() || !rootfs.join("lib/apk/db").is_dir() {
        bail!(
            "mise oci found apk packages in [bootstrap.packages], but the base image does not \
             contain an apk database. Use an Alpine/Wolfi base image or remove the apk entries."
        );
    }
    Ok(())
}

fn apk_install_into_rootfs(
    rootfs: &Path,
    requests: &[PackageRequest],
    architecture: &str,
) -> Result<()> {
    let mut args = vec![
        "--root".to_string(),
        rootfs.display().to_string(),
        "--arch".to_string(),
        apk_architecture(architecture)?.to_string(),
        "--no-cache".to_string(),

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Use a real Alpine base (alpine:3.20) or a Wolfi base that keeps the apk database (cgr.dev/chainguard/wolfi-base)
  2. Or convert the entries to `[bootstrap.packages.apt]` with a Debian/Ubuntu base
  3. Avoid bases that `rm -rf /lib/apk/db` — they cannot host further apk installs

Example fix

# before (mise.toml)
base_image = "debian:bookworm-slim"
[bootstrap.packages.apk]
curl = "any"

# after — base image matches apk
base_image = "alpine:3.20"
[bootstrap.packages.apk]
curl = "any"
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the base image keeps the apk database before configuring apk entries:
crane export alpine:3.20 - | tar -t 2>/dev/null | grep -q '^lib/apk/db/installed$' \
  && echo "apk db present" || echo "no apk db — pick another base or use apt"

Type guard

fn base_supports_apk(base_image: &str) -> bool {
    ["alpine:", "cgr.dev/chainguard/wolfi-base"]
        .iter()
        .any(|p| base_image.starts_with(p))
}

Prevention

When it happens

Trigger: `mise oci build` with `[bootstrap.packages.apk]` entries while the base image is Debian/Ubuntu, busybox (no apk db), `scratch`, or a stripped Wolfi image that ships no /lib/apk/db.

Common situations: Mirroring error 423: base image changed without converting the package table; choosing a super-minimal Alpine-derived base that deleted the apk database to save space.

Related errors


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