-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyper-V builder assumes that host operating system shares network adapter with VMs #5023
Comments
Could you please provide me the output of the following commands:
|
From my home PC (where this also happens) I executed this:
Which results in this:
The When I'm back at work tomorrow morning I will do the same for the machine there (which does have |
And the outcome of the previously mentioned script on the work machine is:
In this case the |
Issue what is duplicate #4947 of the current but formally was the first ;-) |
Wanted to confirm that I'm also seeing the same behaviour. |
I get similar error behavior on my system. I'm trying to build a Hyper-V provided Debian box, but Hyper-V is not propagating the preseed HTTP server connection into the guest. I can access the HTTP server from the host, but not from the guest. I tried adding packer.exe through the Windows firewall, but that doesn't seem to be sufficient to fix this error. Possibly interesting note: For what it's worth, Packer appears to be using the same IP address for both the guest VM and the HTTP server, 192.168.2.12. I'm not sure if this is bad form, or if this usually works. Anyway, thought that might be a contributing factor. packer configuration: {
"builders": [
{
"type": "hyperv-iso",
"vm_name": "debian",
"iso_url": "http://cdimage.debian.org/cdimage/release/9.2.1/amd64/iso-cd/debian-9.2.1-amd64-netinst.iso",
"iso_checksum_type": "sha512",
"iso_checksum": "ebfe25dc593967e39349b205480b0ec0103ef4a0468c602f4857e13d06d407bfe876162399e0e8d4dea5675953dc37ab585316f307ccf9f4440124b4f719df04",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_timeout": "1800s",
"disk_size": 8000,
"ram_size": 1024,
"http_directory": "http",
"boot_command": [
"<esc><wait>",
"install ",
"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
"locale=en_US ",
"kbd-chooser/method=us ",
"keyboard-configuration/xkb-keymap=us ",
"netcfg/get_hostname={{.Name}} ",
"netcfg/get_domain=vagrantup.com ",
"debconf/frontend=noninteractive ",
"fb=false ",
"<enter><wait>"
],
"shutdown_command": "sudo halt -p"
}
],
"post-processors": [
{
"type": "vagrant",
"output": "debian-{{.Provider}}.box",
"compression_level": "9"
}
]
} |
So... no solution for the issue yet?
|
The hyper-V builder is a community-maintained plugin; we'll gladly review any PR submitted to fix this. |
@SwampDragons - It's extremely hard when you have no clue about Go ;)
|
maybe also a fix for issue hashicorp#5023 at least I got same error like there, incl. VM response ==> hyperv-iso: Host IP for the HyperV machine: False although hashicorp#4947 is marked as duplicate but shows different error output ==> hyperv-iso: Error getting host adapter ip address: PowerShell error: Get-VMNetworkAdapter : No network adapter is found with the given input.
maybe also a fix for issue hashicorp#5023 at least I got same error like there, incl. VM response ==> hyperv-iso: Host IP for the HyperV machine: False although hashicorp#4947 is marked as duplicate but shows different error output ==> hyperv-iso: Error getting host adapter ip address: PowerShell error: Get-VMNetworkAdapter : No network adapter is found with the given input.
I pulled down the current nightly as I encountered this issue myself, and wanted to test the recently merged fix. The releases page indicates the release was produced from 65d6677, which seems to have the fix included. However, in my environment it seems the problem persists:
I'm not sure what's unique about my configuration that might cause this issue. Can (or should) this issue be re-opened? |
Bummer. @Rychard can you share your debug logs and repro case? |
Here you go @SwampDragons https://gist.github.com/Rychard/715f9b4a896378ce61adc5287dd97b76 It's far from a Minimal, Complete, and Verifiable example, but I tried to capture as many relevant details about my configuration as I could think of. The build in the gist is a continuation of a base Windows installation (step 1), followed by installing Windows updates (step 2). There's nothing magical about those steps, in fact they were obtained by modifying these builds. |
Here's a much smaller repro using alpine linux. I started with this template, but since Consequently, I decided to truncate everything else in that template and modified it to simply type the variables into the shell. I did have to set packer_windows_amd64.exe build repro.json // repro.json
{
"builders": [
{
"type": "hyperv-iso",
"iso_url": "http://dl-cdn.alpinelinux.org/alpine/v3.6/releases/x86_64/alpine-virt-3.6.2-x86_64.iso",
"iso_checksum": "92c80e151143da155fb99611ed8f0f3672fba4de228a85eb5f53bcb261bf4b0a",
"iso_checksum_type": "sha256",
"disk_size": "512",
"skip_compaction": "true",
"communicator": "ssh",
"ssh_username": "root",
"ssh_password": "alpine",
"http_directory": "./office/",
"boot_wait": "5s",
"headless": "false",
"boot_command": [
"root<enter><wait>",
"echo '{{ .HTTPIP }}:{{ .HTTPPort }}'<enter>"
],
"shutdown_command": "poweroff",
"generation": 1,
"enable_secure_boot": false
}
]
} |
@SwampDragons I need to confirm - packer-nightly produces same result in my config. |
Thanks. |
Hi @SwampDragons - 1.4.3 version doesn't solve the issue. |
Hi @SwampDragons - I was able te replicate it and using extra fast course 'learn Go' my dev version of packer seems to work with finding ip in case when management interface is not part of VirtualSwitch. |
Wonderful! I look forward to reviewing your PR. |
It's here: #8017 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
When booting the VM it is possible for Packer to host a webserver from which the VM can download files. The boot command can encode the host IP address by using the following template
preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg
Where
HTTPIP
andHTTPPort
are replaced with the host OS IP address and the suitable port respectively.This process fails when the host OS does not share the network adapter, i.e. when the host OS has a network adapter for itself and a separate one for the VM networks which is the approach recommended by Microsoft
Software
Packer version: 1.0, but also on the latest version build from #4944
Host platform: Seen in both Windows 10 and on Win 2016
VM response
Packer log
Note the line that says:
The text was updated successfully, but these errors were encountered: