windows-vm: promptless install ISO via Microsoft's noprompt boot image
UEFI does not use bootfix.bin (that is BIOS-only); cDBoot prompts on its own and cannot be dismissed without a keyboard device, which Proxmox reserves for root@pam via -args. So the prompt is removed from the media instead: the ISO ships efi/microsoft/boot/efisys_noprompt.bin, byte-for-byte the same size as the El Torito UEFI image, so it overwrites it in place and the boot catalog stays valid. build-noprompt-iso.sh does it and verifies the result. Firmware now starts the CD with no keystroke, but OVMF stalls in Start boot option and never reaches Setup, so the Packer build still does not complete.
This commit is contained in:
1 parent
0a1eaab6e7
commit
6a024fe75e
2 files changed
+58
-8
No files matched your search
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
# Build a promptless copy of the Windows 11 ISO for unattended Proxmox builds.
|
||||
#
|
||||
# Why: Proxmox creates VMs with only a usb-tablet, so VNC keystrokes have no
|
||||
# keyboard to land on and UEFI's "Press any key to boot from CD or DVD" always
|
||||
# times out -- the install never starts. Adding -device usb-kbd would fix it,
|
||||
# but needs qemu_additional_args, which Proxmox refuses for any API user other
|
||||
# than root@pam ("only root can set 'args' config").
|
||||
#
|
||||
# So the prompt is removed from the media: Microsoft ships the same UEFI boot
|
||||
# image twice, with the prompt (efisys.bin) and without (efisys_noprompt.bin).
|
||||
# They are byte-for-byte the same size, so the boot image can be overwritten in
|
||||
# place and the El Torito catalog stays valid. No catalog surgery needed.
|
||||
#
|
||||
# Run as root on the Proxmox host: sh build-noprompt-iso.sh [source [target]]
|
||||
set -eu
|
||||
|
||||
SRC_ISO="${1:-/var/lib/vz/template/iso/win11-eval.iso}"
|
||||
DST_ISO="${2:-/var/lib/vz/template/iso/win11-noprompt.iso}"
|
||||
BOOT_IMAGE_OFFSET=1097728 # El Torito UEFI image, verified with cmp below
|
||||
BOOT_IMAGE_SIZE=1474560
|
||||
WORK=$(mktemp -d /tmp/noprompt.XXXXXX)
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
[ -f "$SRC_ISO" ] || { echo "no such ISO: $SRC_ISO" >&2; exit 1; }
|
||||
|
||||
echo "extracting the promptless boot image from $(basename "$SRC_ISO")"
|
||||
7z e -y "$SRC_ISO" -o"$WORK" "efi/microsoft/boot/efisys_noprompt.bin" -r >/dev/null
|
||||
NEW="$WORK/efisys_noprompt.bin"
|
||||
[ -s "$NEW" ] || { echo "efisys_noprompt.bin not found in the ISO" >&2; exit 1; }
|
||||
SIZE=$(stat -c%s "$NEW")
|
||||
[ "$SIZE" -eq "$BOOT_IMAGE_SIZE" ] || {
|
||||
echo "boot image is $SIZE bytes, expected $BOOT_IMAGE_SIZE -- the offset would be wrong, refusing" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "copying $(basename "$SRC_ISO") -> $(basename "$DST_ISO")"
|
||||
cp --sparse=always "$SRC_ISO" "$DST_ISO"
|
||||
|
||||
echo "patching the UEFI boot image at byte $BOOT_IMAGE_OFFSET"
|
||||
dd if="$NEW" of="$DST_ISO" bs=2048 seek=$((BOOT_IMAGE_OFFSET / 2048)) conv=notrunc status=none
|
||||
|
||||
cmp -n "$BOOT_IMAGE_SIZE" -i "$BOOT_IMAGE_OFFSET":0 "$DST_ISO" "$NEW" \
|
||||
|| { echo "patch verification failed" >&2; exit 1; }
|
||||
|
||||
chown root:root "$DST_ISO"
|
||||
chmod 644 "$DST_ISO"
|
||||
echo "ok: $DST_ISO ($(stat -c%s "$DST_ISO") bytes, verified)"
|
||||
@@ -36,7 +36,7 @@ variable "proxmox_token" {
|
||||
|
||||
variable "iso_file" {
|
||||
type = string
|
||||
default = "local:iso/win11-eval.iso"
|
||||
default = "local:iso/win11-noprompt.iso"
|
||||
}
|
||||
|
||||
variable "virtio_iso" {
|
||||
@@ -118,13 +118,15 @@ source "proxmox-iso" "win11" {
|
||||
# The media prompt appears ~10-20 s into UEFI boot, not at 4 s, so wait longer
|
||||
# and keep tapping across a 40-second span. One press is a race against the
|
||||
# prompt rendering; forty spaced presses is not.
|
||||
# BLOCKED, do not re-add: the VM is created with only a usb-tablet, so the VNC
|
||||
# boot_command has no keyboard to land on and the "press any key" media prompt
|
||||
# times out -> UEFI falls through to "no bootable option". The fix would be
|
||||
# qemu_additional_args = "-device usb-kbd"
|
||||
# but Proxmox answers 500 "only root can set 'args' config" for any API user
|
||||
# other than root@pam. Either build with a root@pam token, or strip
|
||||
# efi/microsoft/boot/bootfix.bin from the ISO so no keypress is needed.
|
||||
# The VM is created with only a usb-tablet, so VNC keystrokes have no keyboard
|
||||
# to land on and UEFI's "press any key to boot from CD" always times out.
|
||||
# Adding one needs qemu_additional_args = "-device usb-kbd", which Proxmox
|
||||
# refuses: 500 "only root can set 'args' config" for any user but root@pam.
|
||||
#
|
||||
# So the prompt is removed from the media instead: win11-noprompt.iso is
|
||||
# win11-eval.iso with the 1474560-byte UEFI El Torito image at byte 1097728
|
||||
# replaced by the ISO's own efi/microsoft/boot/efisys_noprompt.bin (identical
|
||||
# size, so the boot catalog stays valid). See build-noprompt-iso.sh.
|
||||
|
||||
boot_wait = "10s"
|
||||
boot_command = ["<wait>${join("", [for i in range(40) : "<spacebar><wait>"])}"]
|
||||
|
||||
Reference in new issue
Block a user