Cannot generate a vyos.qcow2 cloud-init on proxmox image

Hi, I tried to generate a vyos.qcow2 cloud-init on proxmox image using

https://docs.vyos.io/en/latest/automation/cloud-init.html#

As pve root I executed the command:

ansible-playbook qemu.yml -e disk_size=10 -e iso_local=/tmp/vyos.iso -e grub_console=serial -e vyos_version=1.5.0 -e cloud_init=true -e cloud_init_ds=NoCloud

and got a long ansible error message:

TASK [install-packages : Install required packages] **********************************************************************************************************
fatal: [localhost]: FAILED! => {“cache_update_time”: 1708881435, “cache_updated”: false, “changed”: false, “msg”: “‘/usr/bin/apt-get -y -o "Dpkg::Options::=–force-confdef" -o "Dpkg::Options::=–force-confold" install ‘kpartx=0.9.4-5~bpo11+1’ ‘qemu-utils=1:7.2+dfsg-7+deb12u5’ ‘python3-lxml=4.9.2-1+b1’ ‘isolinux=3:6.04~git20190206.bf6db5b4+dfsg1-3’ ‘squashfs-tools=1:4.5.1-1’ ‘xorriso=1.5.4-4’’ failed: E: Sub-process /usr/share/proxmox-ve/pve-apt-hook returned an error code (1)\nE: Failure running script /usr/share/proxmox-ve/pve-apt-hook\n”, “rc”: 100, “stderr”: “E: Sub-process /usr/share/proxmox-ve/pve-apt-hook returned an error code (1)\nE: Failure running script /usr/share/proxmox-ve/pve-apt-hook\n”, “stderr_lines”: [“E: Sub-process /usr/share/proxmox-ve/pve-apt-hook returned an error code (1)”, “E: Failure running script /usr/share/proxmox-ve/pve-apt-hook”], “stdout”: “Reading package lists…\nBuilding dependency tree…\nReading state information…\nThe following additional packages will be installed:\n libburn4 libisoburn1 libisofs6 libjte2 libnfs13 libssh-4 python3-bs4\n python3-html5lib python3-soupsieve python3-webencodings qemu-block-extra\n syslinux-common\nSuggested packages:\n python3-genshi python-lxml-doc xorriso-tcltk jigit cdck\nThe following packages will be REMOVED:\n proxmox-ve pve-container pve-ha-manager pve-manager pve-qemu-kvm qemu-server\n spiceterm\nThe following NEW packages will be installed:\n isolinux kpartx libburn4 libisoburn1 libisofs6 libjte2 libnfs13 libssh-4\n python3-bs4 python3-html5lib python3-lxml python3-soupsieve\n python3-webencodings qemu-block-extra qemu-utils squashfs-tools\n syslinux-common xorriso\nW: (pve-apt-hook) !! WARNING !!\nW: (pve-apt-hook) You are attempting to remove the meta-package ‘proxmox-ve’!\nW: (pve-apt-hook) \nW: (pve-apt-hook) If you really want to permanently remove ‘proxmox-ve’ from your system, run the following command\nW: (pve-apt-hook) \ttouch ‘/please-remove-proxmox-ve’\nW: (pve-apt-hook) run apt purge proxmox-ve to remove the meta-package\nW: (pve-apt-hook) and repeat your apt invocation.\nW: (pve-apt-hook) \nW: (pve-apt-hook) If you are unsure why ‘proxmox-ve’ would be removed, please verify\nW: (pve-apt-hook) \t- your APT repository settings\nW: (pve-apt-hook) \t- that you are using ‘apt full-upgrade’ to upgrade your system\n0 upgraded, 18 newly installed, 7 to remove and 0 not upgraded.\nNeed to get 0 B/5813 kB of archives.\nAfter this operation, 284 MB disk space will be freed.\n”, “stdout_lines”: [“Reading package lists…”, “Building dependency tree…”, “Reading state information…”, “The following additional packages will be installed:”, " libburn4 libisoburn1 libisofs6 libjte2 libnfs13 libssh-4 python3-bs4", " python3-html5lib python3-soupsieve python3-webencodings qemu-block-extra", " syslinux-common", “Suggested packages:”, " python3-genshi python-lxml-doc xorriso-tcltk jigit cdck", “The following packages will be REMOVED:”, " proxmox-ve pve-container pve-ha-manager pve-manager pve-qemu-kvm qemu-server", " spiceterm", “The following NEW packages will be installed:”, " isolinux kpartx libburn4 libisoburn1 libisofs6 libjte2 libnfs13 libssh-4", " python3-bs4 python3-html5lib python3-lxml python3-soupsieve", " python3-webencodings qemu-block-extra qemu-utils squashfs-tools", " syslinux-common xorriso", “W: (pve-apt-hook) !! WARNING !!”, “W: (pve-apt-hook) You are attempting to remove the meta-package ‘proxmox-ve’!”, "W: (pve-apt-hook) ", “W: (pve-apt-hook) If you really want to permanently remove ‘proxmox-ve’ from your system, run the following command”, “W: (pve-apt-hook) \ttouch ‘/please-remove-proxmox-ve’”, “W: (pve-apt-hook) run apt purge proxmox-ve to remove the meta-package”, “W: (pve-apt-hook) and repeat your apt invocation.”, "W: (pve-apt-hook) ", “W: (pve-apt-hook) If you are unsure why ‘proxmox-ve’ would be removed, please verify”, “W: (pve-apt-hook) \t- your APT repository settings”, “W: (pve-apt-hook) \t- that you are using ‘apt full-upgrade’ to upgrade your system”, “0 upgraded, 18 newly installed, 7 to remove and 0 not upgraded.”, “Need to get 0 B/5813 kB of archives.”, “After this operation, 284 MB disk space will be freed.”]}

This is about trying to install: gdisk kpartx dosfstools e2fsprogs gnupg qemu-utils python3-lxml grub-efi-amd64 grub-efi-amd64-bin grub-common isolinux python3-requests rsync unzip squashfs-tools xorriso zliblg-dev

I know, that there is an easy trick to solve this, but I don’t know what it is. Can anybody tell me?

Someone told me, what it is: Don’t do that on pve, because something in the packages tries to deinstall pve. Do it on a standart system like debian, ubuntu or whatever.

I do use the vyos-vm-images repo from VyOS and use docker for it as mentioned in the README.

All of it I do on a Proxmox server (that’s all I got while I’m on the road). Since it runs in docker the Proxmox server configuration itself is not touched at all.

For the Cloud-Init part I also follow the guide you linked, the Cloud-init on Proxmox. I leave out all the seed.iso part of and use the Proxmox Cloud-Init feature. Worked well for me a few days ago.

I build a qcow2 image with docker environment on pve server just like u.
Building it in a docker environment will be a good choice.

wget https://raw.githubusercontent.com/vyos/vyos-vm-images/current/Dockerfile
docker run --rm -it --privileged -v $(pwd):/vm-build -v $(pwd)/images:/images -w /vm-build vyos-vm-images:latest bash

ansible-playbook qemu.yml   \
     -e disk_size=2   \
     -e iso_local=tmp/vyos-1.3.6-amd64.iso    \
     -e grub_console=serial   \
     -e cloud_init=true    \
     -e cloud_init_ds=NoCloud    \
     -e guest_agent=qemu    \
     -e enable_ssh=true

2 Likes

Doing that in Docker is an interesting idea. My solution was to set up a ubuntu vm and generate the image there, but bare metal would work either I guess. The core of the bug is probably the qemu-utils package, since pve has its own qemu-utils. If this package is deleted from the playbook there should be good chances, that one can do it directly under pve either.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.