{"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":null,"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/533346cc374382b41ec5ff70536252b2e96e725c/src/oci/packages.rs#L130-L166","documentation":"apt package installation into images uses the host's `apt-get` (with dpkg) against the image root. mise validates required binaries up front; if `apt-get` is absent from PATH the build fails with this error before any packages are attempted.","triggerScenarios":"Running `mise oci build` with `[bootstrap.packages] apt = [...]` on a host where `apt-get` is not installed — e.g. Alpine, macOS, or a slim container without apt tooling.","commonSituations":"Building a Debian-based image on an Alpine or Fedora host; slim CI images without apt; PATH not including /usr/bin due to environment sanitization.","solutions":["Install apt on the host (switch to a Debian/Ubuntu host or container)","Fix PATH so `/usr/bin/apt-get` is reachable","Run the build inside a Debian/Ubuntu container that ships apt-get","Switch the bootstrap.packages entries to apk on an Alpine-capable host"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"command -v apt-get >/dev/null || echo \"apt-get missing; use a Debian/Ubuntu host or container\"","typeGuard":null,"tryCatchPattern":"match build() {\n    Err(e) if e.to_string().contains(\"needs `apt-get` on PATH\") => {\n        eprintln!(\"run the build in a Debian/Ubuntu environment\");\n    }\n    r => r,\n}","preventionTips":["Match host distro to the package manager in bootstrap.packages","Verify binaries with command -v in build wrappers","Use Debian-based CI images for apt-based builds","Keep PATH checks in preflight scripts"],"tags":["oci","apt","missing-binary"],"backgroundTag":"command-not-found","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"}