This tutorial explains how to modify a minimal image so that it can be booted from ESXi 7+ or VMWare Workstation
The minimal cloud image enables the GRUB_FORCE_PARTUUID option
which means system boots from root filesystem only, and the well-known vmw_pvscsi module is compiled as a kernel module.
Therefore, we need to enable initrd.img to load the vmw_pvscsi driver before mounting the root filesystem.
We need server and minimal cloud image that can be downloaded from ubuntu offical server.
- Enable module
modprobe nbd
- Mount & copy initrd.img-6.8.0-60-generic + vmlinuz-6.8.0-71-generic from ubuntu-24.04-server-cloudimg-amd64.img
mkdir -p /mnt/nbd0qemu-nbd -c /dev/nbd0 ubuntu-24.04-server-cloudimg-amd64.imgmount /dev/nbd0p16 /mnt/nbd0cp -a /mnt/nbd0/initrd.img-6.8.0-60-generic /mnt/nbd0/vmlinuz-6.8.0-71-generic %1(%1 is pathname) πumount /mnt/nbd0qemu-nbd -d /dev/nbd0
- Connect to another disk image
qemu-nbd -c /dev/nbd0 ubuntu-24.04-minimal-cloudimg-amd64.img
- Mount partitions and copy initramfs ralted files (ensure all files permission is 600)
mount /dev/nbd0p1 /mnt/nbd0mount /dev/nbd0p16 /mnt/nbd0/bootmount /dev/nbd0p15 /mnt/nbd0/boot/efimount --bind /dev /mnt/nbd0/devmount --bind /proc /mnt/nbd0/procmount --bind /sys /mnt/nbd0/syscp -a %1 /mnt/nbd0/bootπcd /mnt/nbd0/bootπln -s initrd.img-6.8.0-60-generic initrd.img.oldπln -s vmlinuz-6.8.0-71-generic vmlinuz.oldπln -s initrd.img-6.8.0-60-generic initrd.imgπln -s vmlinuz-6.8.0-71-generic vmlinuzπ
- Comment the line starts with
GRUB_FORCE_PARTUUID=in /mnt/nbd0/etc/default/grub.d/40-force-partuuid.cfg πrm -f /mnt/nbd0/etc/default/grub.d/40-force-partuuid.cfg(alternative)
- chroot and update GRUB configuration
chroot /mnt/nbd0update-grubπexitumount -R /mnt/nbd0qemu-img --disconnect /dev/nbd0
Also, hardware version 6 is too old, you should convert it after attached to virtual machine
qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=monolithicSparse,compat6 ubuntu-24.04-minimal-cloudimg-amd64.img ubuntu-24.04-minimal-cloudimg-amd64.vmdk
Device Start End Sectors Size Type
/dev/nbd0p1 2099200 7339998 5240799 2.5G Linux filesystem
/dev/nbd0p14 2048 10239 8192 4M BIOS boot
/dev/nbd0p15 10240 227327 217088 106M EFI System
/dev/nbd0p16 227328 2097152 1869825 913M Linux extended boot