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.