canonical / canonical/cloud-init

apt.py will not attempt to install i386 packages on an amd64 system

Open
#7,077 1 comment 0 reactions 0 assignees View on GitHub
bug good first issue hacktoberfest
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug report
On an amd64 systems with i386 architecture enabled, cloud-init will not install packages only available in i386

## Steps to reproduce the problem
Enable i386 arch in early boot before apt update:

bootcmd\:
\- [ cloud-init-per, once, dpkgi386, dpkg, --add-architecture, i386]

Add package available to apt in i386

packages:
\- steamcmd

cloud-init will not find the package to install. Package will install successfully from command line:

`apt install steamcmd`

Cause: cloud-init searches for packages using `apt-cache pkgnames` before attempting to install, which only lists packages for the primary architecture. Adding the `--all-names` flag to the call in `apt.py` does include packages for i386, but also includes virtual packages unavailable for installation.

## Environment details
- Cloud-init version: 25.1.4
- Operating System Distribution: Debian 13 Trixie
- Cloud provider, platform or installer type: vultr

## cloud-init logs
2026-09-07 17:24:37,859 - apt.py[DEBUG]: The following packages were not found by APT so APT will not attempt to install them: ['steamcmd']
2026-09-07 17:24:37,859 - distros[INFO]: Failed to install the following packages: ['steamcmd']. See associated package manager logs for more details.
2026-09-07 17:24:37,859 - log_util.py[WARNING]: Failure when attempting to install packages: ['steamcmd']
2026-09-07 17:24:37,860 - log_util.py[DEBUG]: Failure when attempting to install packages: ['steamcmd']
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 95, in handle
cloud.distro.install_packages(pkglist)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 286, in install_packages
raise PackageInstallerError(error_message % total_failed)
cloudinit.distros.PackageInstallerError: Failed to install the following packages: {'steamcmd'}. See associated package manager logs for more details.
2026-09-07 17:24:37,863 - cc_package_update_upgrade_install.py[WARNING]: 1 failed with exceptions, re-raising the last one
2026-09-07 17:24:37,863 - handlers.py[DEBUG]: finish: modules-final/config-package-update-upgrade-install: FAIL: running config-package-update-upgrade-install with frequency once-per-instance
2026-09-07 17:24:37,863 - log_util.py[WARNING]: Running module package-update-upgrade-install () failed
2026-09-07 17:24:37,864 - log_util.py[DEBUG]: Running module package-update-upgrade-install () failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/modules.py", line 297, in _run_modules
ran, _r = cc.run(
~~~~~~^
run_name, mod.handle, func_args, freq=freq
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 71, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 156, in run
results = functor(**args)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 127, in handle
raise errors[-1]
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 95, in handle
cloud.distro.install_packages(pkglist)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 286, in install_packages
raise PackageInstallerError(error_message % total_failed)
cloudinit.distros.PackageInstallerError: Failed to install the following packages: {'steamcmd'}. See associated package manager logs for more details.

Contributor guide

Open the contributing guide

Research direction

Start in apt.py, focusing on the apt-cache pkgnames lookup used before package installation, and reproduce the report on Debian with i386 enabled before apt update. Verify that an i386-only package such as steamcmd is discovered and installed while virtual packages are not treated as installable.

Written by the indexing model from the issue text.

Assessment

Tech stack
debian, python
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.