{"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":"validation","errorClass":null,"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/533346cc374382b41ec5ff70536252b2e96e725c/src/oci/packages.rs#L316-L352","documentation":"`prepare_apt_install` verifies that the unpacked base image rootfs actually contains `/etc/apt` before running apt-get inside it. If apt packages are requested in `[bootstrap.packages]` but the base image is not Debian-based, mise bails instead of running apt-get against a foreign rootfs.","triggerScenarios":"Calling `mise oci build` with apt entries in `[bootstrap.packages]` while the selected base image lacks `/etc/apt` (e.g. Alpine or Wolfi), detected in `prepare_and_snapshot` -> `prepare_apt_install`.","commonSituations":"Selecting an Alpine base image but keeping apt-formatted package entries; switching the base image from Debian to distroless/Alpine without updating `[bootstrap.packages]`.","solutions":["Switch the base image to a Debian/Ubuntu variant in the oci config.","Remove the apt entries from `[bootstrap.packages]` and switch them to apk for an Alpine/Wolfi base.","Drop the system packages entirely if the base image already provides them."],"exampleFix":"# before (mise.toml, Alpine base)\n[bootstrap.packages]\napt = [\"curl\"]\n\n# after\n[bootstrap.packages]\napk = [\"curl\"]","handlingStrategy":"validation","validationCode":"if ((cfg.bootstrap?.packages?.apt ?? []).length > 0 && !/^(debian|ubuntu)/.test(baseImage)) console.warn('apt packages declared but base image is not Debian/Ubuntu');","typeGuard":null,"tryCatchPattern":"try { await miseOciBuild(cfg) } catch (e) { if (String(e).includes('/etc/apt')) { console.error('Switch base image to Debian/Ubuntu or use apk entries.'); process.exit(1); } throw e; }","preventionTips":["Match package-manager keys in `[bootstrap.packages]` to the base image distro.","When changing base images, audit `[bootstrap.packages]` in the same PR.","Add a CI check that asserts distro and manager key agree."],"tags":["oci","apt","base-image","config"],"backgroundTag":"incompatible-source-type","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}