Unable to build a qemu image with cloud-init

Using https://github.com/vyos/vyos-vm-images
Command : ansible-playbook qemu.yml -e iso_local=./vyos.iso -e guest_agent=qemu -e cloud_init=true
Error:

TASK [install-cloud-init : Install cloud-init] ********************************* fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["chroot", "/mnt/inst_root", "apt-get", "-t", "current", "install", "-y", "--force-yes", "cloud-init", "cloud-utils", "ifupdown"], "delta": "0:00:01.332906", "end": "2023-07-09 21:31:53.910488", "msg": "non-zero return code", "rc": 100, "start": "2023-07-09 21:31:52.577582", "stderr": "W: --force-yes is deprecated, use one of the options starting with --allow instead.\nE: Unable to correct problems, you have held broken packages.", "stderr_lines": ["W: --force-yes is deprecated, use one of the options starting with --allow instead.", "E: Unable to correct problems, you have held broken packages."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nSome packages could not be installed. This may mean that you have\nrequested an impossible situation or if you are using the unstable\ndistribution that some required packages have not yet been created\nor been moved out of Incoming.\nThe following information may help to resolve the situation:\n\nThe following packages have unmet dependencies:\n cloud-init : Depends: python3-yaml but it is not going to be installed", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "Some packages could not be installed. This may mean that you have", "requested an impossible situation or if you are using the unstable", "distribution that some required packages have not yet been created", "or been moved out of Incoming.", "The following information may help to resolve the situation:", "", "The following packages have unmet dependencies:", " cloud-init : Depends: python3-yaml but it is not going to be installed"]}```

I have the same issue a few days ago and no hint whats wrong

Looks like broken dependencies or held back packages in your installation. Could also be that you first need to chroot to be inside the build environment before running below commands.

Personally I would do something like this in a console to find out whats broken (if you use Debian or Ubuntu or variant of these):

sudo apt-get update
sudo apt-get dist-upgrade

Optional:

sudo apt-get autoremove --purge
sudo apt-get autoclean
sudo apt-get clean

Hi @terrysan and @tomcat667
Please share this information:

  • OS release cat /etc/os-release
  • Ansible version ansible --version
  • Python version

Also please carefully read README.md

Check the requirements

You need a machine with at least 20 GB free space with Debian 10 (bare-metal, virtual, Docker container with --privileged flag)