hashicorp / hashicorp/packer-plugin-hyperv
No DHCP lease using hyper-v iso
- Dominant language
- Go
- Stars
- 27
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
_This issue was originally opened by @ckl-syrocon as hashicorp/packer#8488. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._
#### Overview of the Issue
I am trying to build a hyper-v image using a custom .iso-image. The image itself is valid and works in manual tests. However, there is no DHCP lease when using the hyper-v builder and thus our kickstarter file fails.
#### Reproduction Steps
Option A)
- Download CentOS-7 NetInstall iso
- run `packer build .\iso.json` using the given Buildfile
- manually enter graphical install and see that there is no network connection
- try connecting to the network and observe that it does not connect
Option B)
- Boot into a dracut recovery shell
- run `dhcpclient -v etho0`
- observe that no lease is received
### Packer version
Packer v1.4.5
### Simplified Packer Buildfile
```
{
"variables": {
"iso_url": "./extra/CentOS-7-x86_64-NetInstall-1908.iso",
"iso_checksum": "6FFA7AD44E8716E4CD6A5C3A85BA5675A935FC0448C260F43B12311356BA85AD",
"switch_name": "",
"vm_name": "test",
"disk_size": "20000",
"output_directory": "",
"ssh_password": "rootroot",
"memory": "8192",
"cpus": "1"
},
"builders": [
{
"type": "hyperv-iso",
"vm_name": "{{ user `vm_name` }}",
"temp_path": ".",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{user `iso_checksum`}}",
"disk_size": "{{user `disk_size`}}",
"disk_block_size": "1",
"communicator": "ssh",
"ssh_username": "root",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_timeout" : "4h",
"shutdown_timeout": "30m",
"shutdown_command": "echo 'password' | sudo -S shutdown -P now",
"memory": "{{ user `memory` }}",
"enable_dynamic_memory": "true",
"cpus": "{{ user `cpus` }}",
"generation": 1,
"switch_name": "{{user `switch_name`}}",
"http_directory": "./extra/html",
"boot_wait": "5s",
"boot_command": [ ],
"guest_additions_mode":"disable",
"enable_secure_boot": false,
"output_directory": "{{ user `output_directory` }}"
}
],
"provisioners": [ ]
}
```
### Operating system and Environment details
Windows 10 Host
Hyper-V Version 10.0.17763.1
### Log Fragments and crash.log files
When checking through the hyper-v manager, there is no IP address allocated to the VM.
Booting into the dracut shell, we can check the network status using `ip addr`. The result shows no allocated IPv4 address for eth0.
```
1: lo mtu 65536 qdisc noqueue state UNKNOWN group
[...]
2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:01:c4:35 brd ff:ff:ff:ff:ff:ff
inet6 fe80::215::5dff::fe01::c435/64 scope link
valid_lft forever preferred_lft forever
```
Contributor guide
Assessment
This issue has not been assessed yet.