{"record":{"id":"aa4aac56e90bd8f0","repo":"jdx/mise","slug":"mise-oci-needs-apt-get-on-path-to-install-apt-sy","errorCode":null,"errorMessage":"mise oci needs `apt-get` on PATH to install apt system packages into the image","messagePattern":"mise oci needs `apt-get` on PATH to install apt system packages into the image","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":148,"sourceCode":"fn validate_host_requirements(manager: OciPackageManager) -> Result<()> {\n    match manager {\n        OciPackageManager::Apk => {\n            if std::env::consts::OS != \"linux\" {\n                bail!(\"mise oci needs a Linux host to install apk system packages into an image\");\n            }\n            if file::which(\"apk\").is_none() {\n                bail!(\"mise oci needs `apk` on PATH to install apk system packages into the image\");\n            }\n            if !crate::system::sudo::is_root() {\n                bail!(\n                    \"mise oci needs to run as root to install apk system packages because apk \\\n                     executes package scripts in a chroot\"\n                );\n            }\n        }\n        OciPackageManager::Apt => {\n            if file::which(\"apt-get\").is_none() {\n                bail!(\n                    \"mise oci needs `apt-get` on PATH to install apt system packages into the image\"\n                );\n            }\n            if file::which(\"dpkg\").is_none() {\n                bail!(\n                    \"mise oci needs `dpkg` on PATH to install apt system packages into the image\"\n                );\n            }\n        }\n    }\n    Ok(())\n}\n\nfn prepare_and_snapshot(\n    manager: OciPackageManager,\n    rootfs: &Path,\n) -> Result<BTreeMap<PathBuf, FsEntry>> {\n    match manager {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/oci/packages.rs#L130-L166","documentation":"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.","triggerScenarios":"mise oci build with apt/[bootstrap.packages] entries (or a debian/ubuntu base) on a host where file::which(\"apt-get\") is None.","commonSituations":"Building debian-based images from an alpine or macOS workstation; minimal debian-based dev containers that stripped apt; CI images without apt-get.","solutions":["Run the build on a debian/ubuntu host or container (ubuntu-latest runner works).","If the host is alpine, switch packages/base to apk instead.","Verify with `command -v apt-get` before invoking mise oci build."],"exampleFix":"# before (alpine host, debian base)\n[bootstrap]\nbase = \"debian:bookworm-slim\"\n\n# after\n# either build from a debian host, or:\n[bootstrap]\nbase = \"alpine:3.20\"","handlingStrategy":"validation","validationCode":"import shutil, sys\nif apt_entries(config) and shutil.which(\"apt-get\") is None:\n    sys.exit(\"host has no apt-get; build from a debian/ubuntu host or switch base to alpine\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use debian/ubuntu CI runners when [bootstrap.packages] resolves to apt.","Add `command -v apt-get && command -v dpkg` as a build preflight.","Do not rely on conda/nix shims masquerading as apt tooling; use the system packages."],"tags":["oci","packages","apt","missing-binary"],"backgroundTag":"missing-system-tool","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}