gusztavvargadr / packer

Packer templates for building Windows and Ubuntu images

Home Page:https://app.vagrantup.com/gusztavvargadr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Windows 11 arm64 images

mmatczuk opened this issue · comments

This would allow to bridge the gap and run Vagrant with Windows on modern Apple hardware i.e. M1/M2 CPUs.

VirtualBox support for arm64 is available in 7.x BETA. I think it is outside of the scope of this issue, and can be added later when the whole ecosystem matures.

Vagrant has an official VMWare provider. VMware Fusion 12/13 supports arm64. This generally works (with Linux) and is accessible via Personal License for free (thank you VMWare). The process is confirmed by many to work, you can take a look at this gist.

Parallels also support arm64, and have homegrown Vagrant provider but I did not check it. Unlike VMWare there is no free Personal License.

Windows 11 provides arm64 images that can be run on Apple M1/M2 CPUs. At the moment of writing this there is one Windows ARM image for Vagrant see here. This image loads but does work with Vagrant for me, and there is no source.

I think this awesome project is perfectly positioned to address this important issue and allow us to work on Windows on Mac.

@mmatczuk thanks for reaching out, for providing all these details and for your kind words :)

I already build VMware and VirtualBox images for amd64, so those would be the best starting points indeed. I cannot promise a timeline for this, first I would need to set up my build environment for Mac, but I was thinking of getting a Mac mini anyway, so this gives some more motivation :) I can also try for some hosted options for the time being.

Btw, there was a regression in Vagrant booting Windows boxes in the latest version, you can check here for more details, maybe it solves the problem of booting the other box you found: #404

Thanks again, I will keep you posted.

Thanks for the heads up. I downgraded Vagrant. The issue seems to be in the image. For reference please find below the details:

Vagrantfile

Vagrant.configure("2") do |config|

  # Disable the default synced folder
  config.vm.synced_folder ".", "/vagrant", disabled: true

  config.vm.define "windows" do |windows|
    config.vm.box = "pipegz/Windows11ARM"
    config.vm.box_version = "1.0.0"
  end

  config.vm.provider "vmware_fusion" do |v|
    v.ssh_info_public = true
    v.gui = true
    v.linked_clone = false
    v.vmx["ethernet0.pcislotnumber"] = "160"
    v.vmx["ethernet0.virtualdev"] = "vmxnet3"

    v.cpus = 2
    v.memory = "4096"
  end
end

vagrant up stdout

Bringing machine 'windows' up with 'vmware_fusion' provider...
==> windows: Cloning VMware VM: 'pipegz/Windows11ARM'. This can take some time...
==> windows: Checking if box 'pipegz/Windows11ARM' version '1.0.0' is up to date...
==> windows: Verifying vmnet devices are healthy...
==> windows: Preparing network adapters...
==> windows: Starting the VMware VM...
==> windows: Waiting for the VM to receive an address...
==> windows: Forwarding ports...
    windows: -- 22 => 2222
==> windows: Waiting for machine to boot. This may take a few minutes...
    windows: SSH address: 172.16.137.134:22
    windows: SSH username: vagrant
    windows: SSH auth method: private key

Failed SSH debug logs

DEBUG ssh: == Net-SSH connection debug-level log START ==
DEBUG ssh: D, [2023-10-16T10:59:13.146447 #32748] DEBUG -- net.ssh.transport.session[8c0]: establishing connection to 172.16.137.134:22

DEBUG ssh: == Net-SSH connection debug-level log END ==
 INFO ssh: SSH not ready: #<Vagrant::Errors::NetSSHException: An error occurred in the underlying SSH library that Vagrant uses.
The error message is shown below. In many cases, errors from this
library are caused by ssh-agent issues. Try disabling your SSH
agent or removing some keys and try again.

If the problem persists, please report a bug to the net-ssh project.

Net::SSH::ConnectionTimeout>
 INFO subprocess: Starting process: ["/Applications/VMware Fusion.app/Contents/Library/vmrun", "-T", "fusion", "list"]
DEBUG subprocess: Command not in installer, not touching env vars.
 INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG vmware: VM state requested. Current state: running
 INFO vmware_driver: Reading an accessible IP for machine...
 INFO vmware_driver: Reading VMX data...
DEBUG vmware_driver:   - .encoding = UTF-8
DEBUG vmware_driver:   - cleanshutdown = FALSE
DEBUG vmware_driver:   - config.version = 8
DEBUG vmware_driver:   - cpuid.corespersocket = 1
DEBUG vmware_driver:   - cryptostate = none
DEBUG vmware_driver:   - displayname = a: windows
DEBUG vmware_driver:   - ehci.pcislotnumber = 18
DEBUG vmware_driver:   - ehci.present = TRUE
DEBUG vmware_driver:   - ethernet0.addresstype = generated
DEBUG vmware_driver:   - ethernet0.connectiontype = nat
DEBUG vmware_driver:   - ethernet0.pcislotnumber = 160
DEBUG vmware_driver:   - ethernet0.present = TRUE
DEBUG vmware_driver:   - ethernet0.virtualdev = vmxnet3
DEBUG vmware_driver:   - extendedconfigfile = Windows 11 64-Bit ARM.vmxf
DEBUG vmware_driver:   - firmware = efi
DEBUG vmware_driver:   - floppy0.present = FALSE
DEBUG vmware_driver:   - guestos = arm-windows11-64
DEBUG vmware_driver:   - hpet0.present = TRUE
DEBUG vmware_driver:   - memsize = 4096
DEBUG vmware_driver:   - monitor.phys_bits_used = 36
DEBUG vmware_driver:   - msg.autoanswer = true
DEBUG vmware_driver:   - numa.autosize.cookie = 20012
DEBUG vmware_driver:   - numa.autosize.vcpu.maxpervirtualnode = 2
DEBUG vmware_driver:   - numvcpus = 2
DEBUG vmware_driver:   - nvme0.pcislotnumber = 224
DEBUG vmware_driver:   - nvme0.present = TRUE
DEBUG vmware_driver:   - nvme0:0.filename = Virtual Disk-cl3.vmdk
DEBUG vmware_driver:   - nvme0:0.present = TRUE
DEBUG vmware_driver:   - nvme0:0.redo = 
DEBUG vmware_driver:   - nvram = Windows 11 64-Bit ARM.nvram
DEBUG vmware_driver:   - pcibridge4.functions = 8
DEBUG vmware_driver:   - pcibridge4.pcislotnumber = 21
DEBUG vmware_driver:   - pcibridge4.present = TRUE
DEBUG vmware_driver:   - pcibridge4.virtualdev = pcieRootPort
DEBUG vmware_driver:   - pcibridge5.functions = 8
DEBUG vmware_driver:   - pcibridge5.pcislotnumber = 22
DEBUG vmware_driver:   - pcibridge5.present = TRUE
DEBUG vmware_driver:   - pcibridge5.virtualdev = pcieRootPort
DEBUG vmware_driver:   - pcibridge6.functions = 8
DEBUG vmware_driver:   - pcibridge6.pcislotnumber = 23
DEBUG vmware_driver:   - pcibridge6.present = TRUE
DEBUG vmware_driver:   - pcibridge6.virtualdev = pcieRootPort
DEBUG vmware_driver:   - pcibridge7.functions = 8
DEBUG vmware_driver:   - pcibridge7.pcislotnumber = 24
DEBUG vmware_driver:   - pcibridge7.present = TRUE
DEBUG vmware_driver:   - pcibridge7.virtualdev = pcieRootPort
DEBUG vmware_driver:   - policy.vm.mvmtid = 
DEBUG vmware_driver:   - powertype.poweroff = soft
DEBUG vmware_driver:   - powertype.poweron = soft
DEBUG vmware_driver:   - powertype.reset = soft
DEBUG vmware_driver:   - powertype.suspend = soft
DEBUG vmware_driver:   - sata0.pcislotnumber = 19
DEBUG vmware_driver:   - sata0.present = TRUE
DEBUG vmware_driver:   - sata0:1.devicetype = cdrom-image
DEBUG vmware_driver:   - sata0:1.filename = /Users/andres.gomez/Downloads/22000.1_PROFESSIONAL_ARM64_EN-US.ISO
DEBUG vmware_driver:   - sata0:1.present = TRUE
DEBUG vmware_driver:   - sata0:1.startconnected = TRUE
DEBUG vmware_driver:   - sensor.location = pass-through
DEBUG vmware_driver:   - softpoweroff = FALSE
DEBUG vmware_driver:   - sound.autodetect = TRUE
DEBUG vmware_driver:   - sound.filename = -1
DEBUG vmware_driver:   - sound.pcislotnumber = 17
DEBUG vmware_driver:   - sound.present = TRUE
DEBUG vmware_driver:   - sound.virtualdev = hdaudio
DEBUG vmware_driver:   - svga.guestbackedprimaryaware = TRUE
DEBUG vmware_driver:   - svga.vramsize = 268435456
DEBUG vmware_driver:   - tools.synctime = TRUE
DEBUG vmware_driver:   - tools.upgrade.policy = upgradeAtPowerCycle
DEBUG vmware_driver:   - toolsinstallmanager.lastinstallerror = 21004
DEBUG vmware_driver:   - toolsinstallmanager.updatecounter = 1
DEBUG vmware_driver:   - usb.pcislotnumber = 16
DEBUG vmware_driver:   - usb.present = TRUE
DEBUG vmware_driver:   - usb.vbluetooth.startconnected = TRUE
DEBUG vmware_driver:   - usb:1.devicetype = hub
DEBUG vmware_driver:   - usb:1.parent = -1
DEBUG vmware_driver:   - usb:1.port = 1
DEBUG vmware_driver:   - usb:1.present = TRUE
DEBUG vmware_driver:   - usb:1.speed = 2
DEBUG vmware_driver:   - usb_xhci.pcislotnumber = 192
DEBUG vmware_driver:   - usb_xhci.present = TRUE
DEBUG vmware_driver:   - usb_xhci:6.devicetype = hub
DEBUG vmware_driver:   - usb_xhci:6.parent = -1
DEBUG vmware_driver:   - usb_xhci:6.port = 6
DEBUG vmware_driver:   - usb_xhci:6.present = TRUE
DEBUG vmware_driver:   - usb_xhci:6.speed = 2
DEBUG vmware_driver:   - usb_xhci:7.devicetype = hub
DEBUG vmware_driver:   - usb_xhci:7.parent = -1
DEBUG vmware_driver:   - usb_xhci:7.port = 7
DEBUG vmware_driver:   - usb_xhci:7.present = TRUE
DEBUG vmware_driver:   - usb_xhci:7.speed = 4
DEBUG vmware_driver:   - uuid.action = create
DEBUG vmware_driver:   - uuid.bios = 56 4d 22 83 76 ba 65 a7-99 f9 94 1f b5 18 12 dc
DEBUG vmware_driver:   - uuid.location = 56 4d 22 83 76 ba 65 a7-99 f9 94 1f b5 18 12 dc
DEBUG vmware_driver:   - vc.uuid = 
DEBUG vmware_driver:   - virtualhw.productcompatibility = hosted
DEBUG vmware_driver:   - virtualhw.version = 20
DEBUG vmware_driver:   - vmci0.id = 1732251124
DEBUG vmware_driver:   - vmci0.present = TRUE
DEBUG vmware_driver:   - vmotion.checkpointfbsize = 4194304
DEBUG vmware_driver:   - vmotion.checkpointsvgaprimarysize = 268435456
DEBUG vmware_driver:   - vmotion.svga.graphicsmemorykb = 262144
DEBUG vmware_driver:   - vmotion.svga.mobmaxsize = 268435456
DEBUG vmware_driver:   - vmxstats.filename = Windows 11 64-bit Arm.scoreboard
DEBUG vmware_driver:   - vm.genid = 8023867271924578547
DEBUG vmware_driver:   - vm.genidx = 8130721402106416199
DEBUG vmware_driver:   - ethernet0.generatedaddress = 00:0c:29:18:12:dc
DEBUG vmware_driver:   - ethernet0.generatedaddressoffset = 0
DEBUG vmware_driver:   - usb_xhci:4.present = TRUE
DEBUG vmware_driver:   - usb_xhci:4.devicetype = hid
DEBUG vmware_driver:   - usb_xhci:4.port = 4
DEBUG vmware_driver:   - usb_xhci:4.parent = -1
DEBUG vmware_driver:   - ehci:0.present = TRUE
DEBUG vmware_driver:   - ehci:0.devicetype = video
DEBUG vmware_driver:   - ehci:0.port = 0
DEBUG vmware_driver:   - ehci:0.parent = -1
DEBUG vmware_driver: Trying to get MAC address for ethernet0
DEBUG vmware_driver: No explicitly set MAC, looking or auto-generated one...
DEBUG vmware_driver:  -- MAC: 00:0c:29:18:12:dc
 INFO vmware_driver: Reading DHCP lease for '00:0c:29:18:12:dc' on 'vmnet8'
DEBUG vagrant_utility: request METHOD=GET PATH=/vmnet/vmnet8/dhcplease/00:0c:29:18:12:dc RESPONSE=200 
DEBUG vmware: Using public address lookup for SSH info.
DEBUG ssh: Checking key permissions: /Users/michal/.vagrant.d/insecure_private_key
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 172.16.137.134
 INFO ssh:   - Port: 22
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/Users/michal/.vagrant.d/insecure_private_key"]
DEBUG ssh:   - connect_opts: {:auth_methods=>["none", "hostbased", "keyboard-interactive", "publickey"], :config=>false, :forward_agent=>false, :send_env=>false, :keys_only=>true, :verify_host_key=>:never, :password=>nil, :port=>22, :timeout=>15, :user_known_hosts_file=>[], :verbose=>:debug, :logger=>#<Logger:0x000000010bd3c898 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter:0x000000010bd3c870 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x000000010bd3c820 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<StringIO:0x000000010bd3c8e8>, @binmode=false, @mon_data=#<Monitor:0x000000010bd3c7d0>, @mon_data_owner_object_id=2260>>, :keys=>["/Users/michal/.vagrant.d/insecure_private_key"], :remote_user=>"vagrant", :keepalive=>true, :keepalive_interval=>5}
 INFO subprocess: Starting process: ["/Applications/VMware Fusion.app/Contents/Library/vmrun", "-T", "fusion", "list"]
DEBUG subprocess: Command not in installer, not touching env vars.
 INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG vmware: VM state requested. Current state: running
 INFO subprocess: Starting process: ["/Applications/VMware Fusion.app/Contents/Library/vmrun", "-T", "fusion", "list"]
DEBUG subprocess: Command not in installer, not touching env vars.
 INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0

It seems to have ssh-agent but not server.

image

@mmatczuk thanks for the detailed investigation.

SSH is not the default communicator for Windows, but WinRM is, this is maybe indeed an issue with the box's configuration. As a reference, this is my default box configugration for Windows boxes and VMware, can you try maybe merging the relevant sections?

You'd probably need to set at least these two vm settings:

config.vm.guest = :windows
config.vm.communicator = 'winrm'

Thanks @gusztavvargadr this seems to help but there is still some networking issue

==> windows: Starting the VMware VM...
==> windows: Waiting for the VM to receive an address...
==> windows: Forwarding ports...
    windows: -- 5985 => 55985
    windows: -- 5986 => 55986
    windows: -- 22 => 2222
==> windows: Waiting for machine to boot. This may take a few minutes...
    windows: WinRM address: 172.16.137.142:5985
    windows: WinRM username: vagrant
    windows: WinRM execution_time_limit: PT2H
    windows: WinRM transport: negotiate

It seems to hang here, I cannot access any port from host to guest :/

@mmatczuk this looks then indeed some issue with the box itself, likely it's not configured properly.

If you want to experiment with this further, check out the bootstrapping code that I use when booting all Windows machines for the first time to enable WinRM (and also SSH btw).

You can try running the relevant part of that script via the VMware UI, then test if Vagrant can connect to the machine that way.

Btw, I am building my amd64 Hyper-V based boxes in Azure now, I will give it a try if I can do there the arm64 too, then I don't need to purchase too much stuff upfront to have at least an experimental image.

If you want to experiment with this further, check out the bootstrapping code that I use when booting all Windows machines for the first time to enable WinRM (and also SSH btw).

It looks to me like there is a network configuration issue first.

Btw, I am building my amd64 Hyper-V based boxes in Azure now, I will give it a try if I can do there the arm64 too, then I don't need to purchase too much stuff upfront to have at least an experimental image.

That's awesome!