Hi All
I'm trying to build a Ubuntu VM on Hyper-V using the hyperv-iso builder. The VM starts correctly but the VM gets the wrong IP address for the local HTTP server. The console output says:
OpsToolsBuild_Build_Pack_Packer_Run:
Building E:\documents\Petrik\documents\operations\calvinverse\base.linux\src\ubuntu_1604\hyperv.json ...
[1;32mhyperv-iso output will be in this color. [0m
[1;32m==> hyperv-iso: Creating temporary directory... [0m
[1;32m==> hyperv-iso: Downloading or copying ISO [0m
[0;32m hyperv-iso: Downloading or copying: file:///F:/iso/linux/ubuntu-16.04.2-server-amd64.iso [0m
[1;32m==> hyperv-iso: Starting HTTP server on port 8872 [0m
[1;32m==> hyperv-iso: Creating switch 'External switch' if required... [0m
[1;32m==> hyperv-iso: switch 'External switch' already exists. Will not delete on cleanup... [0m
[1;32m==> hyperv-iso: Creating virtual machine... [0m
[1;32m==> hyperv-iso: Enabling Integration Service... [0m
[1;32m==> hyperv-iso: Setting boot drive to os dvd drive F:/iso/linux/ubuntu-16.04.2-server-amd64.iso ... [0m
[1;32m==> hyperv-iso: Mounting os dvd drive F:/iso/linux/ubuntu-16.04.2-server-amd64.iso ... [0m
[1;32m==> hyperv-iso: Skipping mounting Integration Services Setup Disk... [0m
[1;32m==> hyperv-iso: Mounting secondary DVD images... [0m
[1;32m==> hyperv-iso: Configuring vlan... [0m
[1;32m==> hyperv-iso: Starting the virtual machine... [0m
[1;32m==> hyperv-iso: Waiting 5s for boot... [0m
[1;32m==> hyperv-iso: Host IP for the HyperV machine: False [0m
[1;32m==> hyperv-iso: Typing the boot command... [0m
[1;31m==> hyperv-iso: Error preparing boot command: template: root:1:22: executing "root" at <user `host_ip`>: error calling user: test [0m
[1;32m==> hyperv-iso: Clean up os dvd drive... [0m
[1;32m==> hyperv-iso: Unregistering and deleting virtual machine... [0m
[1;32m==> hyperv-iso: Deleting output directory... [0m
[1;32m==> hyperv-iso: Deleting temporary directory... [0m
I don't think 'False' is the correct IP address for my host machine.
My JSON file is:
{
"variables": {
"iso_checksum": null,
"iso_url": null,
"vm_ram_size_in_mb": "2048",
"vm_switch_name": "internal_switch",
"admin_username": "admin",
"admin_password": "admin",
"dir_deploy": null,
"dir_scripts_user": null,
"dir_temp_packer": null
},
"builders": [
{
"boot_wait": "5s",
"boot_command": [
"<esc><wait10><esc><esc><enter><wait>",
"set gfxpayload=1024x768<enter>",
"linux /install/vmlinuz ",
"preseed/url=http://{{ .HTTPIP }}:{{.HTTPPort}}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{.Name}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false <enter>",
"initrd /install/initrd.gz<enter>",
"boot<enter>"
],
"communicator": "ssh",
"enable_secure_boot": false,
"generation": 2,
"guest_additions_mode": "disable",
"http_directory": "{{ user `dir_scripts_user` }}/ubuntu/http/",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "sha256",
"iso_checksum": "{{user `iso_checksum`}}",
"ram_size": "{{user `vm_ram_size_in_mb`}}",
"shutdown_command": "echo 'vagrant' | sudo -S -E shutdown -P now",
"ssh_password": "{{user `admin_password`}}",
"ssh_timeout": "4h",
"ssh_username": "{{user `admin_username`}}",
"switch_name": "{{user `vm_switch_name`}}",
"type": "hyperv-iso",
"vm_name": "base-ubuntu1604"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'vagrant' | sudo -S -E sh {{.Path}}",
"scripts": [
"{{ user `dir_scripts_user` }}/ubuntu/update.sh",
"{{ user `dir_scripts_user` }}/ubuntu/network.sh",
"{{ user `dir_scripts_user` }}/ubuntu/cleanup.sh"
]
}
],
"post-processors": [
[
{
"output": "manifest.json",
"strip_path": true,
"type": "manifest"
},
{
"inline": [
"jq \".builds[].files[].name\" manifest.json | xargs tar cfz artifacts.tgz"
],
"type": "shell-local"
}
]
]
}
and my additional configuration is
{
"iso_checksum": "737AE7041212C628DE5751D15C3016058B0E833FDC32E7420209B76CA3D0A535",
"iso_url": "F:/iso/linux/ubuntu-16.04.2-server-amd64.iso",
"vm_ram_size_in_mb": "2048",
"vm_switch_name": "External switch",
"admin_username": "TheBigKahuna",
"admin_password": "TheB1gK@huna",
"dir_deploy": "E:/documents/Petrik/documents/operations/calvinverse/base.linux/build/deploy",
"dir_scripts_user": "E:/documents/Petrik/documents/operations/calvinverse/base.linux/build/temp/scripts",
"dir_temp_packer": "E:/documents/Petrik/documents/operations/calvinverse/base.linux/build/temp/packer"
}
I'm on a Windows 10 machine with two network cards, one for the machine itself and one for Hyper-V. The host machine has only got 1 IP address (not two).
Thanks
Petrik