Hyper-V image not booting (sagitta-latest)

To reproduce:

From a Debian/Ubuntu system with Docker installed, run

# Source: https://docs.vyos.io/en/latest/contributing/build-vyos.html#build-iso

VYOS_BRANCH=sagitta
BUILD_BY=j.randomhacker@vyos.io

DOCKER_BUILD_IMAGE=vyos/vyos-build:$VYOS_BRANCH
VYOS_ROOT=/tmp/vyos-build/$VYOS_BRANCH

git clone -b $VYOS_BRANCH --single-branch https://github.com/vyos/vyos-build $VYOS_ROOT

VYOS_VERSION=1.4.666

docker pull $DOCKER_BUILD_IMAGE

# For VyOS 1.4 (sagitta) For VyOS 1.5 (circinus,current)
docker run --rm -it --privileged -v $VYOS_ROOT:/vyos -w /vyos $DOCKER_BUILD_IMAGE bash -c "sudo make clean ; sudo ./build-vyos-image iso --architecture amd64 --build-by $BUILD_BY --build-type release --version $VYOS_VERSION"

OUTPUT_ISO="$VYOS_ROOT/build/vyos-$VYOS_VERSION-amd64.iso"

# Build VyOS Hyper-V cloud image
# Source: https://github.com/vyos/vyos-vm-images#prepare

# Copy ISO to /tmp
cp $OUTPUT_ISO /tmp/vyos.iso

VYOS_VM_ROOT=/tmp/vyos-vm-images

# Original repo: Failing when building inside docker.
# git clone --single-branch https://github.com/vyos/vyos-vm-images.git $VYOS_VM_ROOT

# Fixed repo. PR #36 applied.
git clone --single-branch https://github.com/fdcastel/vyos-vm-images $VYOS_VM_ROOT

# Build local docker image
cd $VYOS_VM_ROOT
docker build --tag vyos-vm-images:latest -f ./Dockerfile .

# Build Hyper-V image with cloud-init
OUTPUT_IMAGE_NAME=vyos-$VYOS_VERSION-hyperv.vhdx
docker run --rm -it --privileged -v $VYOS_VM_ROOT:/vm-build -v $VYOS_VM_ROOT/images:/images -v /tmp:/source -w /vm-build vyos-vm-images:latest bash -c "ansible-playbook hyperv.yml -e iso_local=/source/vyos.iso -e vyos_version=$VYOS_VERSION -e vyos_hyperv_img=/source/$OUTPUT_IMAGE_NAME -e disk_size=20 -e cloud_init=true -e cloud_init_ds=NoCloud,ConfigDrive,None -e grub_console=KVM -e keep_user=true"

# All done!
echo "* ISO image is '$OUTPUT_ISO'"
echo "* Hyper-V image is '/tmp/$OUTPUT_IMAGE_NAME'"

Creating a Gen2 VM on Hyper-V with this image does not boot:

I also tried to build the image with -e parttable_type=gpt to no avail.

Meanwhile, building a qemu image with

docker run --rm -it --privileged -v $VYOS_VM_ROOT:/vm-build -v $VYOS_VM_ROOT/images:/images -v /tmp:/source -w /vm-build vyos-vm-images:latest bash -c "ansible-playbook qemu.yml -e iso_local=/source/vyos.iso -e vyos_version=$VYOS_VERSION -e vyos_qemu_img=/source/$OUTPUT_IMAGE_NAME -e disk_size=20 -e cloud_init=true -e cloud_init_ds=NoCloud,ConfigDrive,None -e grub_console=KVM -e keep_user=true"

and then converting it to vhdx with qemu-img for Windows:

qemu-img.exe convert -f qcow2 vyos-qemu.qcow2 -O vhdx -o subformat=dynamic vyos.vhdx

It boots (Gen2 VM, with Secure boot disabled).

Unfortunately, I cannot provide more information now due to some errors occurring during the system init (GRUB errors, configuration errors), which are blocking my ability to login with the vyos user.

I’m not a windows guy to check but here we got confirm that is is working after recently fixes ⚓ T3429 Hyper-V integration services not working on VyOS 1.4 (sagitta/current)

I’m the original author of that issue, @Viacheslav :smile:

That was an entirely different problem. Back then I was booting the base ISO image, created in the first step of my script above (instructions from Build VyOS — VyOS 1.5.x (circinus) documentation). This is working fine.

Now I’m trying to build a CLOUD IMAGE (the second part of above script), following these: GitHub - vyos/vyos-vm-images. And here lies the problem.

There’s something wrong with the build process of Hyper-V Cloud Image because it is not producing a bootable image.

This is not a problem with Windows or Hyper-V. Something is broken in the build script (ansible-playbook hyperv.yml ...). But I cannot pinpoint exactly what it is since it is not showing any apparent errors during the process.

I can’t test hyperv
But tested kvm-libvirtd qcow2 images works fine with cloud-init
Could it be issue with serial console after rewriting image tools or related this ⚓ T4516 Rewrite system image manipulation tools in Python

Thanks. Investigating…

Meanwhile… Who in VyOS team maintains Hyper-V cloud images in your CI builds?

He/she must be having the same problem.