-
Notifications
You must be signed in to change notification settings - Fork 374
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 provider #119
base: main
Are you sure you want to change the base?
Hyper-V provider #119
Conversation
This is awesome. Maybe my next machine at work will have HyperV installed, so I'm looking forward to have some boxcutter VMs for it. |
ubuntu.json
Outdated
"passwd/user-password={{ user `ssh_password` }} ", | ||
"passwd/user-password-again={{ user `ssh_password` }} ", | ||
"passwd/username={{ user `ssh_username` }} ", | ||
"initrd=/install/initrd.gz -- <enter>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying your pull request with a cherry-pick to update to 16.04.3 ISO URL's (could you please rebase your PR?).
It seems that Packer has some problems with the boot_command. The last key strokes show some errors and I only get initrd=/installngz
I had this several times. After manually fixing the string to initrd=/install/initrd.gz --
and pressing ENTER the Packer build seems to work. I remember that other providers also had timing issues typing long boot commands.
My setup is an Azure VM running Windows Server 2016 with Packer 1.0.4.
One other thing to mention. We have to quote the file name for the -var-file
option. Otherwise PowerShell ignores the .json
extension. So my command to run your PR was:
packer build -only=hyperv-iso -var-file="ubuntu1604.json" ubuntu.json
The Azure VM was created using a Terraform template: https://github.com/StefanScherer/packer-windows/tree/my/hyperv/terraform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Stefan, I have just merged my branch with master to upgrade to 16.04.3 ISO (no issue there). I can reproduce issues with boot_command
you are mentioning on Azure VM as well. On physical machine this works as expected.
I have quickly tested "generation": "2"
VM where boot_command
seems to be more reliable. Since floppy is not supported I had to use preseed/url
.
When testing, you will probably need to:
- run your own DHCP server such as http://www.dhcpserver.de/
- enable firewall exceptions for packer to serve preseed via HTTP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. In the meantime I've opened hashicorp/packer#5291 and it seems a bug in Packer. I went through the sources, but couldn't find the right place. It seems the hyperv builder uses some PowerShell code where the delay between each key stroke should be added.
My Azure VM has the DHCP feature installed and running, so this shouldn't be a problem. And yes, packer.exe should have a firewall exception as for other providers as well.
I will try your latest commit tomorrow.
OK, after adding a firewall rule for packer.exe I make a little progress. But right now the VM has only a black screen, can react on ctrl+alt+delete events. When I type ctrl+alt+f1 I can make the tty visible and login. The VM has an IP address from the Windows DHCP server running on the host machine. I also can ssh into the VM manually. In Azure I have to use an internal VM switch with NAT, the external switch didn't work there. |
This might be caused by the fact that I used I hit similar issues with Debian VM after kernel upgrade. |
Tried to remove the "uname -r" packages, installed the lts-xenial packages, rebooted the VM, but Hyper-V Manager still does not show an IP address in the networking tab. I also tried the example showed in the packer.io docs for hyperv-iso, but it also hangs at the same point. BTW: Your vagrant box tsmolka/ubuntu1604 works in my Azure VM and shows an IP address and also |
Not sure what is causing networking issue then. This timeout could be caused by SMB synced_folder. You might want to pass
|
Thanks, I'll try that. In the meantime I tried the previous packer template with generation 1 again, but had also no luck seeing the IP address in the Hyper-V Manager. I found out that only two of the three hv-xxx-daemon were running. the hv-kvp-daemon crashed after 60 seconds. When I start it again with I also have tried the generation 2 build with 16.04.2 ISO file with the 4.4.0-62 version, but hv_kvp_daemon also stops after the first minute. |
I have just tested
ubuntu1604
build with Hyper-V provider and I would like your feedback. Would you be interested in adding this provider to boxcutter?Few notes:
hyperv-iso
builder that preventsboot_command
to be processed properly (builder/hyperv/iso: missing InterpolateContext hashicorp/packer#5184). With this fixed packer works as expected.linux-tools-$(uname -r)
andlinux-cloud-tools-$(uname -r)
are needed for obtaining guest IP and can't be installed during provisioning.