You can find more info on the required files and configs here: https://github.com/vyos/vyos-build/blob/current/data/build-flavors/README.md oh wait I mean here in the doc: Build VyOS — VyOS 1.5.x (circinus) documentation hmm I guess just modify the generic config file to your needs, it’s probably self documenting: vyos-build/data/build-flavors/generic.toml at current · vyos/vyos-build · GitHub …
At least the output is clear, and you know what you have to do 
Since it is so well explained to you already this is probably just a waste of time, but I will do it anyway.
As documented here: vyos-build/scripts/image-build/build-vyos-image at 0bd5cb4f5038f560d1b915ef5f62c14e0a9a10b3 · vyos/vyos-build · GitHub
you need to create a .toml so in this case a qemu.toml
The options for image_format
is documented here: vyos-build/scripts/image-build/build-vyos-image at 0bd5cb4f5038f560d1b915ef5f62c14e0a9a10b3 · vyos/vyos-build · GitHub as being compatible with qmeu-img convert
, I believe those to be “raw” and “qcow2”. With some others mentioned in the man pages:
QEMU also supports various other image file formats for compatibility with older QEMU versions or other hypervisors, including VMDK, VDI, VHD (vpc), VHDX, qcow1 and QED. For a full list of supported formats see qemu-img --help.
For a more detailed description of these formats, see the QEMU block drivers reference documentation.
For me I would like to add the qemu agent so I also config packages
setting.
This is my qemu.toml
afterwards
build_type = "release"
image_format = "qcow2"
packages = [
"qemu-guest-agent"
]
I ended up creating a small script to do the build since it was so clear and exact in what I had to do that I only had to patch a single line in the build scripts.
I “test” / ran this on a clean Debian Bookworm VM, if you wish to do that I believe nested virtualization is needed, on proxmox I get this by setting the CPU to “host” on the VM. I added 8GB ram, and 48GB disk.
It will take a good while to complete so get some water and popcorn so you can watch an episode of Stargate SG-1.
Script:
#!/usr/bin/env bash
# Debugability
set -e
set -x
# Add the docker repository to Apt sources:
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg git
sudo install -m 0755 -d /etc/apt/keyrings
[ -f /etc/apt/keyrings/docker.gpg ] || curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $(id -un)
# Some weirdness in the debian git package?
rmdir /home/debian/.gitconfig || true
touch /home/debian/.gitconfig
# Fetch build files
[ -d vyos-build ] || git clone -b current --single-branch https://github.com/vyos/vyos-build
cd vyos-build
git pull
# Fix losetup not populating the partitions on the image
sed -i 's/losetup --show/losetup --partscan --show/' scripts/image-build/raw_image.py
# Add qemu build flavor
cat << EOF > data/build-flavors/qemu.toml
build_type = "release"
image_format = "qcow2"
packages = [
"qemu-guest-agent"
]
EOF
# Reuse existing iso if we already built it
PARAMS=""
iso="$(ls build/*.iso | sort | tail -n1)"
if [ -n "$iso" ]; then
PARAMS+=" --reuse-iso $iso"
fi
# Build vyos (use sg to run with the newly created docker group)
export PARAMS
sg docker '\
set -x; \
docker pull vyos/vyos-build:current && \
docker run --rm -it \
-v /dev:/dev \
-v "$(pwd)":/vyos \
-w /vyos --privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 \
-e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) \
vyos/vyos-build:current \
bash -c "sudo make qemu -- $PARAMS"'