Can't create ESXi image for MAAS

I have followed the instructions above on a fresh new Ubuntu 22.04 VM (on top of ESXi) to create ESXi image.

ESXi host: Xeon Silver 4208 8C16T, 32G DDR4 RAM
VM: 8C, 8192MB RAM

sudo apt update
sudo apt install build-essential fuse2fs fusefat libnbd0 libosinfo-bin libvirt-daemon libvirt-daemon-system nbdfuse nbdkit ovmf python3-dev python3-pip qemu qemu-kvm libvirt-daemon qemu-block-extra qemu-system qemu-utils packer -y
sudo apt install xorriso

egrep -c '(vmx|svm)' /proc/cpuinfo
# 16

kvm-ok
# KVM acceleration can be used

packer version
# v1.10.0

packer plugins install github.com/hashicorp/qemu
git clone https://github.com/canonical/packer-maas.git --recurse-submodules
cd packer-maas/vmware-esxi

md5sum ~/VMware-VMvisor-Installer-8.0U2-22380479.x86_64.iso
# 2403e11fb6d46dd57ba0a6ee0fa1c833  /home/ubuntu/VMware-VMvisor-Installer-8.0U2-22380479.x86_64.iso
sudo make ISO=/home/ubuntu/VMware-VCSA-all-8.0.2-22617221.iso

# inside of VNC
# No bootable device
# seems to be an issue of EFI boot, thus
sudo apt install grub-pc-bin

# Now I can see ESXi image is booting via VNC

Log

==> qemu.esxi: Retrieving ISO
==> qemu.esxi: Trying /home/ubuntu/VMware-VMvisor-Installer-8.0U2-22380479.x86_64.iso
==> qemu.esxi: Trying /home/ubuntu/VMware-VMvisor-Installer-8.0U2-22380479.x86_64.iso
==> qemu.esxi: /home/ubuntu/VMware-VMvisor-Installer-8.0U2-22380479.x86_64.iso => /home/ubuntu/VMware-VMvisor-Installer-8.0U2-22380479.x86_64.iso
==> qemu.esxi: Creating CD disk...
    qemu.esxi: xorriso 1.5.4 : RockRidge filesystem manipulator, libburnia project.
    qemu.esxi: Drive current: -outdev 'stdio:/tmp/packer3337766323.iso'
    qemu.esxi: Media current: stdio file, overwriteable
    qemu.esxi: Media status : is blank
    qemu.esxi: Media summary: 0 sessions, 0 data blocks, 0 data, 35.7g free
    qemu.esxi: xorriso : WARNING : -volid text does not comply to ISO 9660 / ECMA 119 rules
    qemu.esxi: Added to ISO image: directory '/'='/tmp/packer_to_cdrom778902206'
    qemu.esxi: xorriso : UPDATE :       1 files added in 1 seconds
    qemu.esxi: xorriso : UPDATE :       1 files added in 1 seconds
    qemu.esxi: ISO image produced: 185 sectors
    qemu.esxi: Written to medium : 185 sectors at LBA 0
    qemu.esxi: Writing to 'stdio:/tmp/packer3337766323.iso' completed successfully.
    qemu.esxi: Done copying paths from CD_dirs
    qemu.esxi: No communicator is set; skipping port forwarding setup.
==> qemu.esxi: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu.esxi: Starting VM, booting from CD-ROM
    qemu.esxi: The VM will be run headless, without a GUI. If you want to
    qemu.esxi: view the screen of the VM, connect via VNC without a password to
    qemu.esxi: vnc://127.0.0.1:5920
==> qemu.esxi: Overriding default Qemu arguments with qemuargs template option...
==> qemu.esxi: Waiting 3s for boot...
==> qemu.esxi: Connecting to VM via VNC (127.0.0.1:5920)
==> qemu.esxi: Typing the boot commands over VNC...
    qemu.esxi: No communicator is configured -- skipping StepWaitGuestAddress
==> qemu.esxi: Waiting for shutdown...
==> qemu.esxi: Running post-processor:  (type shell-local)
==> qemu.esxi (shell-local): Running local shell script: /tmp/packer-shell3768234766
==> qemu.esxi (shell-local): ++ PACKER_OUTPUT=output-esxi/packer-esxi
==> qemu.esxi (shell-local): ++ IMG_FMT=raw
==> qemu.esxi (shell-local): ++ '[' '!' -f output-esxi/packer-esxi ']'
==> qemu.esxi (shell-local): ++ sync -f output-esxi/packer-esxi
==> qemu.esxi (shell-local): +++ mktemp -d /tmp/packer-maas-XXXX
==> qemu.esxi (shell-local): ++ TMP_DIR=/tmp/packer-maas-pzzL
==> qemu.esxi (shell-local): ++ trap cleanup EXIT
==> qemu.esxi (shell-local): ++ sleep 5
==> qemu.esxi (shell-local): ++ qemu-nbd --socket=/tmp/packer-maas-pzzL/qemu-img.sock --format=raw --shared=10 output-esxi/packer-esxi
==> qemu.esxi (shell-local): ++ mkdir -p /tmp/packer-maas-pzzL/root
==> qemu.esxi (shell-local): + source ./post.sh
==> qemu.esxi (shell-local): ++ echo 'Adding curtin-hooks to image...'
    qemu.esxi (shell-local): Adding curtin-hooks to image...
==> qemu.esxi (shell-local): ++ mount_part 1 /tmp/packer-maas-pzzL/boot fusefat
==> qemu.esxi (shell-local): ++ PART=1
==> qemu.esxi (shell-local): ++ MOUNTPOINT=/tmp/packer-maas-pzzL/boot
==> qemu.esxi (shell-local): ++ FUSEDRV=fusefat
==> qemu.esxi (shell-local): ++ DEV=/tmp/packer-maas-pzzL/p1
==> qemu.esxi (shell-local): ++ mkdir -p /tmp/packer-maas-pzzL/boot
==> qemu.esxi (shell-local): ++ mkdir -p /tmp/packer-maas-pzzL/p1
==> qemu.esxi (shell-local): ++ retries=0
==> qemu.esxi (shell-local): ++ '[' -f /tmp/packer-maas-pzzL/p1/nbd ']'
==> qemu.esxi (shell-local): ++ sleep 1
==> qemu.esxi (shell-local): ++ nbdfuse /tmp/packer-maas-pzzL/p1 --command nbdkit -s nbd socket=/tmp/packer-maas-pzzL/qemu-img.sock --filter=partition partition=1
==> qemu.esxi (shell-local): ++ (( ++retries > 10 ))
==> qemu.esxi (shell-local): ++ '[' -f /tmp/packer-maas-pzzL/p1/nbd ']'
==> qemu.esxi (shell-local): ++ case "${FUSEDRV}" in
==> qemu.esxi (shell-local): ++ fusefat /tmp/packer-maas-pzzL/p1/nbd /tmp/packer-maas-pzzL/boot -o rw+ -s
==> qemu.esxi (shell-local): volume mounted in rw mode
==> qemu.esxi (shell-local): fat type: FAT16
==> qemu.esxi (shell-local): root dir off : 205824
==> qemu.esxi (shell-local): dataclusters :51091
==> qemu.esxi (shell-local): first data byte : 222208
==> qemu.esxi (shell-local): 1st fat off :  1024
==> qemu.esxi (shell-local): 2nd fat off :  103424
==> qemu.esxi (shell-local): fat_eoc_value: 65535
==> qemu.esxi (shell-local): fat_eoc_value is eoc?: 1
==> qemu.esxi (shell-local): ++ cp -rv curtin /tmp/packer-maas-pzzL/boot/
    qemu.esxi (shell-local): 'curtin' -> '/tmp/packer-maas-pzzL/boot/curtin'
==> qemu.esxi (shell-local): cp: preserving permissions for '/tmp/packer-maas-pzzL/boot/curtin': Function not implemented
==> qemu.esxi (shell-local): ++ echo 'Adding post-install scripts to image...'
    qemu.esxi (shell-local): 'curtin/curtin-hooks' -> '/tmp/packer-maas-pzzL/boot/curtin/curtin-hooks'
    qemu.esxi (shell-local): Adding post-install scripts to image...
==> qemu.esxi (shell-local): ++ cp -v scripts.tar.xz /tmp/packer-maas-pzzL/boot/curtin/
    qemu.esxi (shell-local): 'scripts.tar.xz' -> '/tmp/packer-maas-pzzL/boot/curtin/scripts.tar.xz'
    qemu.esxi (shell-local): Unmounting image...
==> qemu.esxi (shell-local): ++ echo 'Unmounting image...'
==> qemu.esxi (shell-local): ++ sync -f /tmp/packer-maas-pzzL/boot
==> qemu.esxi (shell-local): ++ fusermount -z -u /tmp/packer-maas-pzzL/boot
==> qemu.esxi (shell-local): ++ grep -qs '/tmp/packer-maas-pzzL/boot ' /proc/mounts
==> qemu.esxi (shell-local): ++ echo Done
==> qemu.esxi (shell-local): + cleanup
==> qemu.esxi (shell-local): + for dev in "${TMP_DIR}"/p*/ "${TMP_DIR}"/disk/ "${TMP_DIR}"/boot/
==> qemu.esxi (shell-local): + dev=/tmp/packer-maas-pzzL/p1
==> qemu.esxi (shell-local): + '[' -d /tmp/packer-maas-pzzL/p1 ']'
==> qemu.esxi (shell-local): + fusermount -u -z /tmp/packer-maas-pzzL/p1
    qemu.esxi (shell-local): Done
==> qemu.esxi (shell-local): + grep -qs '/tmp/packer-maas-pzzL/p1 ' /proc/mounts
==> qemu.esxi (shell-local): + for dev in "${TMP_DIR}"/p*/ "${TMP_DIR}"/disk/ "${TMP_DIR}"/boot/
==> qemu.esxi (shell-local): + dev=/tmp/packer-maas-pzzL/disk
==> qemu.esxi (shell-local): + '[' -d /tmp/packer-maas-pzzL/disk ']'
==> qemu.esxi (shell-local): + for dev in "${TMP_DIR}"/p*/ "${TMP_DIR}"/disk/ "${TMP_DIR}"/boot/
==> qemu.esxi (shell-local): + dev=/tmp/packer-maas-pzzL/boot
==> qemu.esxi (shell-local): + '[' -d /tmp/packer-maas-pzzL/boot ']'
==> qemu.esxi (shell-local): + fusermount -u -z /tmp/packer-maas-pzzL/boot
==> qemu.esxi (shell-local): fusermount: entry for /tmp/packer-maas-pzzL/boot not found in /etc/mtab
==> qemu.esxi: Running post-processor:  (type compress)
==> qemu.esxi (compress): Using pgzip compression with 8 cores for vmware-esxi.dd.gz
==> qemu.esxi (compress): Archiving output-esxi/packer-esxi with pgzip
==> qemu.esxi (compress): Archive vmware-esxi.dd.gz completed
Build 'qemu.esxi' errored after 7 minutes 11 seconds: 1 error(s) occurred:

* Post-processor failed: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Wait completed after 7 minutes 11 seconds

==> Some builds didn't complete successfully and had errors:
--> qemu.esxi: 1 error(s) occurred:

* Post-processor failed: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]
==> Builds finished but no artifacts were created.
make: *** [Makefile:27: vmware-esxi.dd.gz] Error 1
rm scripts.tar.xz

fixed in https://github.com/canonical/packer-maas/pull/184

thanks for reporting this bug

1 Like