WinRM does not connect - Packer Build for Windows 11 in VirtualBox, in Ubuntu 20.04 VM, on KVM Host (Unraid)

Hi all, I’m relatively new to the Packer community and asking for help, so please forgive me if I’m missing anything out here.

I’m trying to build a Windows 11 Enterprise automated build using Packer (Latest 1.8.2) using VirtualBox on a fresh Ubuntu 20.04 VM, which is running on KVM (Unraid 6.10.3).

I believe I’ve got everything in place, and I have a Makefile, build.json and input.json which has all my details for the build. I’m customising an existing Windows 10 build to build Windows 11, with UEFI support.

However, when I run “make” I cannot get past the “Waiting for WinRM to become available” prompt. I can see the VirtualBox VM come online, boot into the installer (In screenshot below) and I can click through the menus manually if desired, but nothing automatic happens, apparently because the WinRM connector is connecting to 127.0.0.1.

I’m unsure if this the wrong IP or a wrong port situation?
I will try to post my packer config. Can anyone help?

The packer template you are using is going to be what determins if windows can boot and complete setup without interaction. There should be a autounattend.xml file that will need to match the settings for the windows iso you have.

thanks for responding, here is my build.json I’m running for the Packer build:

{
  "builders": [
    {
      "type": "virtualbox-iso",
      "format": "{{user `vm_image_format`}}",
      "guest_os_type": "Windows11_64",
      "iso_url": "{{user `iso_url`}}",
      "iso_checksum": "{{user `iso_checksum`}}",
      "iso_interface": "sata",
      "vm_name": "{{user `vm_name`}}",
      "disk_size": "{{user `vm_disk_size`}}",
      "hard_drive_interface": "sata",
      "headless": "false",
      "guest_additions_mode": "disable",
      "shutdown_command": "{{user `shutdown_command`}}",
      "shutdown_timeout": "10m",
      "disable_shutdown": "true",
      "post_shutdown_delay": "30s",
      "boot_wait": "3s",
      "gfx_controller": "vboxsvga",
      "gfx_vram_size": "128",
      "gfx_accelerate_3d": "true",
      "boot_command": [
        "<spacebar><spacebar>"
      ],
      "floppy_files": [
        "floppy/auto_winrm.ps1",
        "floppy/Autounattend.xml"
      ],
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "{{user `vm_memory`}}"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "{{user `vm_cpus`}}"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--firmware",
          "EFI"
        ]
      ],
      "export_opts": [
        "--manifest",
        "--vsys",
        "0",
        "--description",
        "{{user `vm_description`}}",
        "--version",
        "{{user `vm_version`}}"
      ],
      "communicator": "winrm",
      "winrm_host": "5985",
      "winrm_username": "{{user `admin_user`}}",
      "winrm_password": "{{user `admin_pass`}}",
      "winrm_timeout": "6h",
      "skip_nat_mapping": "true",
      "pause_before_connecting": "20s"
    }
  ]
}

I have a autounattend.xml that I built in WSIM matched to the Windows 11 Enterprise install.wim in the ISO that I’m using.

Even still, I still cannot get it to run unattended, it won’t step past the first screen.
I’m building this image using the virtualbox-iso type to get an OVA output.

I’ve been looking at a lot of examples online of autounattend.xml files, and the matching of Images to WSIM answer file. I’ve been reading that if the Image is listed as Windows 10 Enterprise you need to specify that, even if it is Windows 11 Enterprise you are trying to install, but I’m not sure because even when I try this it still does not start:

I’ve also noted that the language has to match exactly, which I am also ensuring. I’m Running everything as standard en-US and keyboard input as standard US (Which I understand is still also en-US?):

Again, still cannot get past the intial screen and WinRM connector reports no connection to 127.0.0.1:

So I believe that I’ve found something interesting.

I’ve been trying to test getting this running, and I believe it has to do with the EFI status of the BIOS. I can get an identical Autounattend.xml running simply by disabling EFI.

For this test I downloaded the official ISO from Microsoft using Media Creation Tool W11, and used it, hash is: sha1:31120A51909F17038DD056E6E4844096401855BD.

I refer to the repo:

In this repo, the relevant files are:

  • /build_windows_11.sh
  • /windows_11.json
  • /answer_files/11/Autounattend.xml

In /build_windows_11.sh:

  • Specify --only=virtualbox-iso
  • Specified ISO from Microsoft using Media Creation Tool W11.

In /windows_11.json (In builder for virtualbox-iso):

  • Add line: "firmware": "efi"
  • Expand boot_command:
      "boot_command": [
        "<leftShiftOn><f10><leftShiftOff><wait>",
        "reg add HKLM\\SYSTEM\\Setup\\LabConfig /t REG_DWORD /v BypassTPMCheck /d 1<return>",
        "reg add HKLM\\SYSTEM\\Setup\\LabConfig /t REG_DWORD /v BypassSecureBootCheck /d 1<return><wait>",
        "reg add HKLM\\System\\Setup\\LabConfig /t REG_DWORD /v BypassRAMCheck /d 1<return><wait>",
        "reg add HKLM\\System\\Setup\\LabConfig /t REG_DWORD /v BypassCPUCheck /d 1<return><wait>",
        "reg add HKLM\\System\\Setup\\LabConfig /t REG_DWORD /v BypassStorageCheck /d 1<return><wait>",
        "exit<return>",
        "<wait><return>"
      ],

In /answer_files/11/Autounattend.xml:

  • On line 113, Specify: <Value>Windows 11 Enterprise</Value>

With all that in mind…

This template works and I can produce a working unattended installation by running this WITHOUT adding the line: "firmware": "efi":

The IDENTICAL TEMPLATE, with the line "firmware": "efi" present, the system hangs waiting at virtualbox-iso: Waiting for WinRM to become available...:


So with that in mind, why does this indentical template not work with the line "firmware": "efi" present?

I feel like I’m stuck here.

Can anyone help?

If you manually go through the OOBE interface, do all the devices show up like hard disks and such? Toggling EFI mode will change how the hypervisor presents hardware devices to the OS.

One thing to try is Shift + F10 to open a command line interface. You can then review or copy out the setup logs. Deployment Troubleshooting and Log Files | Microsoft Docs and look for some errors.

Hi, yes I did test for that also.
I was able to manually browse and see the disk and the CD is recognised even without specifying "hard_drive_interface": "sata", or "iso_interface": "sata" like the online Packer docs recommend:

Virtualbox also seems to provision a floppy hardware device during bootup, but it does not show up in the installation:

Most importantly, I speant a lot of time looking around and I have found that both Windows 11, and Virtualbox EFI have issues with using floppy disks. Apparently Windows 11 assumes that you are not using a floppy disk in 2022 (which I think is reasonable), and therefore does not load the floppy disk drivers during installation (But they can be loaded after installation for regular OS use) and even defaults “Browse…” functions to drive C instead of A.
No idea if this can be fixed, but this seems to be by design.

The solution that I have found is to use the cd_files function in the Packer builder to load the Autounattend.xml file to root of a CD, then it’s magically found (I think I will have to load the other floppy_files here as well):

¯\_(ツ)_/¯

I hope might help someone who is stuck with this also, but I’ve been able to get much further installation using these modifications:

I’m gonna keep plugging at it.

As you manually browse through the OOBE interface, do you see all your devices, such as hard drives? When the hypervisor is switched to EFI mode.The OS will be presented with a different view of the hardware devices.

Yes, as I showed in the screenshots above, I can browse all the way through the OOBE interface, see hard drives, install the OS, get to a desktop.

Yes the Hypervisor will see a different configuration when using EFI, but what is available will be presented in GUI very similarly.

Either way, I got past that and posted the solution above already.

Nice work sorting that out! No floppy = no autounattend file. Putting it on a second Virtual CD seems like the best solution to me!

As you can see in the screenshots above, the OOBE interface allows me to browse through hard drives, install the OS, and access the desktop.maxifoot