{"record":{"id":"64816ae6a0689aad","repo":"jdx/mise","slug":"mise-oci-found-apk-packages-in-bootstrap-packages","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":344,"sourceCode":"            return Err(e).wrap_err_with(|| format!(\"reading metadata for {}\", path.display()));\n        }\n    }\n    Ok(())\n}\n\nfn prepare_apt_install(rootfs: &Path) -> Result<()> {\n    if !rootfs.join(\"etc/apt\").is_dir() {\n        bail!(\n            \"mise oci found apt packages in [bootstrap.packages], but the base image does not \\\n             contain /etc/apt. Use a Debian/Ubuntu base image or remove the apt entries.\"\n        );\n    }\n    prepare_apt_rootfs(rootfs)\n}\n\nfn prepare_apk_install(rootfs: &Path) -> Result<()> {\n    if !rootfs.join(\"etc/apk\").is_dir() || !rootfs.join(\"lib/apk/db\").is_dir() {\n        bail!(\n            \"mise oci found apk packages in [bootstrap.packages], but the base image does not \\\n             contain an apk database. Use an Alpine/Wolfi base image or remove the apk entries.\"\n        );\n    }\n    Ok(())\n}\n\nfn apk_install_into_rootfs(\n    rootfs: &Path,\n    requests: &[PackageRequest],\n    architecture: &str,\n) -> Result<()> {\n    let mut args = vec![\n        \"--root\".to_string(),\n        rootfs.display().to_string(),\n        \"--arch\".to_string(),\n        apk_architecture(architecture)?.to_string(),\n        \"--no-cache\".to_string(),","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/oci/packages.rs#L326-L362","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Use a real Alpine base (alpine:3.20) or a Wolfi base that keeps the apk database (cgr.dev/chainguard/wolfi-base)","Or convert the entries to `[bootstrap.packages.apt]` with a Debian/Ubuntu base","Avoid bases that `rm -rf /lib/apk/db` — they cannot host further apk installs"],"exampleFix":"# before (mise.toml)\nbase_image = \"debian:bookworm-slim\"\n[bootstrap.packages.apk]\ncurl = \"any\"\n\n# after — base image matches apk\nbase_image = \"alpine:3.20\"\n[bootstrap.packages.apk]\ncurl = \"any\"","handlingStrategy":"validation","validationCode":"# Confirm the base image keeps the apk database before configuring apk entries:\ncrane export alpine:3.20 - | tar -t 2>/dev/null | grep -q '^lib/apk/db/installed$' \\\n  && echo \"apk db present\" || echo \"no apk db — pick another base or use apt\"","typeGuard":"fn base_supports_apk(base_image: &str) -> bool {\n    [\"alpine:\", \"cgr.dev/chainguard/wolfi-base\"]\n        .iter()\n        .any(|p| base_image.starts_with(p))\n}","tryCatchPattern":null,"preventionTips":["Avoid bases that strip /lib/apk/db to save space — they cannot take further apk installs","Verify minimal/derived Alpine bases ship the apk database before adding [bootstrap.packages.apk]"],"tags":["mise","oci","apk","base-image","bootstrap-packages"],"backgroundTag":"package-manager-not-found","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}