{"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":"eyre::Report","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/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/oci/packages.rs#L135-L171","documentation":"The apt path needs dpkg in addition to apt-get: mise uses dpkg tooling (database/deb handling) to record and diff what apt-get installed into the temp rootfs. A host with apt-get but without dpkg is unusual (deliberately stripped images), and the guard fails fast rather than erroring mid-install.","triggerScenarios":"mise oci build with apt packages where file::which(\"dpkg\") is None — e.g. a debian-slim derivative that removed dpkg, a nix/conda-provided apt-get shim without dpkg, or PATH breakage hiding /usr/bin/dpkg.","commonSituations":"Minimal custom CI images; PATH pollution from conda/nix shims; containers where dpkg was uninstalled to save space.","solutions":["Install dpkg on the build host (apt-get install dpkg, or use a standard debian/ubuntu image).","Fix PATH so /usr/bin is present and `command -v dpkg` resolves.","If dpkg genuinely cannot exist on the host, build the debian image from a debian-based CI container instead."],"exampleFix":"# before\nmise oci build   # dpkg missing\n\n# after\napt-get install -y dpkg && mise oci build","handlingStrategy":"validation","validationCode":"import shutil, sys\nif apt_entries(config) and shutil.which(\"dpkg\") is None:\n    sys.exit(\"apt layer builds need dpkg on PATH; install it or use a standard debian host\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install dpkg on stripped debian-based build images rather than removing it for size.","Ensure PATH includes /usr/bin so dpkg resolves in CI shells.","Preflight both apt-get and dpkg — mise requires the pair for apt layers."],"tags":["oci","packages","apt","dpkg","missing-binary"],"backgroundTag":"missing-system-tool","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}