{"record":{"id":"7b845edeb9276c43","repo":"jdx/mise","slug":"mise-oci-needs-dpkg-on-path-to-install-apt-syste","errorCode":null,"errorMessage":"mise oci needs `dpkg` on PATH to install apt system packages into the image","messagePattern":"mise oci needs `dpkg` on PATH to install apt system packages into the image","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":153,"sourceCode":"            }\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 {\n        OciPackageManager::Apk => prepare_apk_install(rootfs)?,\n        OciPackageManager::Apt => prepare_apt_install(rootfs)?,\n    }\n    snapshot(rootfs)\n}","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/oci/packages.rs#L135-L171","documentation":"apt installs also require `dpkg`, which `apt-get` shells out to at the package-unpacking stage. mise validates both binaries in `validate_host_requirements` and throws this error when `dpkg` specifically is missing even though `apt-get` was found.","triggerScenarios":"Running `mise oci build` with `[bootstrap.packages] apt = [...]` on a host where apt-get exists but dpkg is missing or not on PATH (unusual, e.g. partially stripped images or broken PATH).","commonSituations":"Hosts with apt frontends removed but dpkg uninstalled; container images that ship apt-get from another source without dpkg; PATH anomalies hiding /usr/bin/dpkg.","solutions":["Reinstall dpkg on the host (`apt-get install --reinstall dpkg` on a working Debian system, or the distro equivalent)","Fix PATH so `/usr/bin/dpkg` is visible","Run the build inside a standard Debian/Ubuntu container where both tools exist"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"command -v apt-get >/dev/null && command -v dpkg >/dev/null || echo \"apt toolchain incomplete; dpkg missing\"","typeGuard":null,"tryCatchPattern":"match build() {\n    Err(e) if e.to_string().contains(\"needs `dpkg` on PATH\") => {\n        eprintln!(\"reinstall dpkg or use a standard Debian/Ubuntu container\");\n    }\n    r => r,\n}","preventionTips":["Check for both apt-get and dpkg, not just apt-get","Avoid hosts with partially stripped apt toolchains","Validate the build environment in setup scripts","Prefer official distro containers for apt-based image builds"],"tags":["oci","apt","dpkg","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"}