{"record":{"id":"f21ca1a574efe9f5","repo":"jdx/mise","slug":"mise-oci-found-apt-packages-in-bootstrap-packages","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":334,"sourceCode":"    Ok(true)\n}\n\nfn remove_path(path: &Path) -> Result<()> {\n    match fs::symlink_metadata(path).map(|m| m.file_type()) {\n        Ok(ft) if ft.is_dir() && !ft.is_symlink() => fs::remove_dir_all(path)\n            .wrap_err_with(|| format!(\"removing directory {}\", path.display()))?,\n        Ok(_) => fs::remove_file(path).wrap_err_with(|| format!(\"removing {}\", path.display()))?,\n        Err(e) if e.kind() == std::io::ErrorKind::NotFound => {}\n        Err(e) => {\n            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(","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/oci/packages.rs#L316-L352","documentation":"prepare_apt_install checks that the unpacked base image rootfs contains /etc/apt before running apt-get against it. `[bootstrap.packages]` collected apt entries, but the base image is not Debian-based, so apt-get could not operate on that rootfs — mise aborts with explicit guidance instead of producing a broken layer.","triggerScenarios":"`mise oci build` with `[bootstrap.packages.apt]` entries while the base image is `alpine:*`, `busybox`, `scratch`, or a non-Debian distroless/wolfi image — i.e. anything whose rootfs lacks /etc/apt.","commonSituations":"Switching the base image in config (e.g. for size) without converting the package table; starting from `scratch` or a minimal base and expecting apt bootstrap to work.","solutions":["Change the base image to a Debian/Ubuntu one (debian:bookworm-slim, ubuntu:24.04) so /etc/apt exists","Or convert the entries to `[bootstrap.packages.apk]` if the Alpine/minimal base must stay","Remember `scratch` bases are rejected for any [bootstrap.packages] — a distro base with the matching package metadata is mandatory"],"exampleFix":"# before (mise.toml)\nbase_image = \"alpine:3.20\"\n[bootstrap.packages.apt]\nripgrep = \"any\"\n\n# after — base image matches apt\nbase_image = \"debian:bookworm-slim\"\n[bootstrap.packages.apt]\nripgrep = \"any\"","handlingStrategy":"validation","validationCode":"# Confirm the base image is Debian-based before configuring apt entries:\ncrane export debian:bookworm-slim - | tar -x etc/os-release -O 2>/dev/null \\\n  | grep -E 'ID=(debian|ubuntu)'\n# If the grep fails, the base lacks /etc/apt — use apk entries or a Debian base.","typeGuard":"fn base_supports_apt(base_image: &str) -> bool {\n    // Conservative allow-list of Debian-family bases\n    [\"debian:\", \"ubuntu:\", \"linuxserver/\"]\n        .iter()\n        .any(|p| base_image.starts_with(p))\n}","tryCatchPattern":null,"preventionTips":["Pair base image and package manager in one decision: Debian/Ubuntu ↔ apt, Alpine/Wolfi ↔ apk","Encode the pairing in a config template or CI check so base-image swaps cannot leave stale entries"],"tags":["mise","oci","apt","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"}