Packer waiting for SSH to become available

3,860 views
Skip to first unread message

Ebe JS

unread,
Jul 4, 2017, 9:58:07 PM7/4/17
to Packer
I am new to packer and vagrant and I am trying to build a brand new Windows OS Virtual box from Windows 10 disc image and packer. However, while doing build, packer never quits on the step "Waiting for SSH to become available". I have tried and followed multiple solutions from Stack overflow and Hashicorp but nothing fixed my issue.

My windows 10 JSON file:

{
  "builders": [
    {
      "type": "virtualbox-iso",
      "iso_url": "{{user `iso_url`}}",
      "iso_checksum_type": "{{user `iso_checksum_type`}}",
      "iso_checksum": "{{user `iso_checksum`}}",
      "headless": false,
      "boot_wait": "10m",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_wait_timeout": "2h",
      "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
      "guest_os_type": "Windows10_64",
      "disk_size": 61440,
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "2048"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "2"
        ]
      ]
    }
  ],
  "post-processors":[
    {
      "type": "vagrant",
      "keep_input_artifact": false,
      "output": "windows_10_{{.Provider}}.box",
      "vagrantfile_template": "windows10.template"
    }
  ],
  "variables": {
    "iso_url": "C:/Ebe/Vagrant/Windows_10/SW_DVD5_Win_Pro_10_1511.1_64BIT_English_MLF_X20-93914.iso",
    "iso_checksum_type": "md5",
    "iso_checksum": "bd09dc56c51a6ce137b8c0eb7c4369ea",
    "autounattend": "./answer_files/10/Autounattend.xml"
  }
}

My windows.template

Vagrant.require_version ">= 1.6.2"

Vagrant.configure("2") do |config|
    config.vm.define "vagrant-windows-10"
    config.vm.box = "windows_10"
    config.vm.communicator = "winrm"

    # Admin user name and password
    config.winrm.username = "vagrant"
    config.winrm.password = "vagrant"   config.vm.network :private_network, ip: "192.168.56.1"

    config.vm.guest = :windows
    config.windows.halt_timeout = 15

    config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
    config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", auto_correct: true

    config.vm.provider :virtualbox do |v, override|
        #v.gui = true
        v.customize ["modifyvm", :id, "--memory", 2048]
        v.customize ["modifyvm", :id, "--cpus", 2]
        v.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
    end

    config.vm.provider :vmware_fusion do |v, override|
        #v.gui = true
        v.vmx["memsize"] = "2048"
        v.vmx["numvcpus"] = "2"
        v.vmx["ethernet0.virtualDev"] = "vmxnet3"
        v.vmx["RemoteDisplay.vnc.enabled"] = "false"
        v.vmx["RemoteDisplay.vnc.port"] = "5900"
        v.vmx["scsi0.virtualDev"] = "lsisas1068"
    end

    config.vm.provider :vmware_workstation do |v, override|
        #v.gui = true
        v.vmx["memsize"] = "2048"
        v.vmx["numvcpus"] = "2"
        v.vmx["ethernet0.virtualDev"] = "vmxnet3"
        v.vmx["RemoteDisplay.vnc.enabled"] = "false"
        v.vmx["RemoteDisplay.vnc.port"] = "5900"

        v.vmx["scsi0.virtualDev"] = "lsisas1068"
    end end

I am using below command to kick off the build

packer build windows10.json

Below is the output of never ending build

virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying Guest additions
    virtualbox-iso: Downloading or copying: file:///C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: file:///C:/Ebe/Vagrant/Windows_10/SW_DVD5_Win_Pro_10_1511.1_64BIT_English_MLF_X20-93914.iso
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 3527)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1499123943 --memory 2048
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1499123943 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 10m0s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...

Please let me know if you have any suggestion to make this build work.

James Elmes

unread,
Jul 5, 2017, 1:01:34 AM7/5/17
to Packer
How are you enabling SSH on the windows build? you have no autounattend file either

Rickard von Essen

unread,
Jul 5, 2017, 1:46:22 AM7/5/17
to packe...@googlegroups.com
Also see https://stackoverflow.com/questions/44895377/packer-waiting-for-ssh-to-become-available/44904901

On 5 July 2017 at 07:01, James Elmes <jamesro...@gmail.com> wrote:
> How are you enabling SSH on the windows build? you have no autounattend file
> either
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/5222db41-6644-4da9-b5ba-bfad4f560681%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Ebe JS

unread,
Jul 5, 2017, 2:30:24 PM7/5/17
to Packer
Guys,  I see the issue now, I dont have autounattend.xml file, is it possible to generate the autounattend.xml for windows10 OS?

Stuart Luscombe

unread,
Jul 6, 2017, 1:40:09 AM7/6/17
to Packer
I'm new to packer myself, but don't you have to set the following in your json for Windows builds?
"communicator": "winrm"

With regards to creating an autounattend.xml, I would suggest grabbing the Windows ADK from https://developer.microsoft.com/en-us/windows/hardware/windows-assessment-deployment-kit

Rickard von Essen

unread,
Jul 6, 2017, 1:58:04 AM7/6/17
to packe...@googlegroups.com
Stuart, that is correct x2.

To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/d0604a7b-27bb-46f9-a414-e6858eeab792%40googlegroups.com.

Ebe JS

unread,
Jul 6, 2017, 10:22:52 AM7/6/17
to Packer
Thanks Stuart. I have set the below line in my JSON and downloading Windows ADK from the given link. Will keep you posted with the results.
Reply all
Reply to author
Forward
0 new messages