Open hc-github-team-packer opened 2 years ago
Replacing /etc/dhcp/dhclient.conf
with the value send dhcp-client-identifier = hardware;
is a workaround, to keep the IP from changing. But doesn't actually fix the underlying issue documented above.
This issue was originally opened by @ladar in https://github.com/hashicorp/packer/issues/11431 and has been migrated to this repository. The original issue description is below.
Overview of the Issue
The Parallels DHCP is a bit temperamental. As such, a handful of things can cause it to assign guests new IP addresses during a reboot. What triggers the address changes varies, depending on the DHCP client configuration inside the guests, but for several of the distros I work with, applying operating system updates and/or changing the hostname before the reboot, both cause problems. Devuan 4.0 appears to be doing this consistently.
Reproduction Steps
Install a basic Devuan 4.0 server environment. The IP address will sometimes change between when the installer finishes, and when the guest boots for the first time, but
packer
seems to detect this change. Unfortunately if the IP changes afterpacker
has connected via SSH, it won't. Rather it will continue trying to connect to the previous IP address until the SSH timeout expires, and the build fails. Running these commands seemed to trigger the problem consistently for me.Packer version
Tested using version 1.7.7 and 1.7.8.
Simplified Packer Template
You can duplicate my process precisely, and try building the Devuan 4.0 image using the current commit (presumably by the time you look at this I'll have a workaround in HEAD):
You can also skip the last command, and examine the
packer
templates/bash
scripts manually. The configuration for the box in question is inside thegeneric-parallels.json
config file.Operating system and Environment details
macOS High Sierra v10.13.6 Parallels Desktop v16.5.0 Packer v1.7.8
Log Fragments and crash.log files
I'm including a small portion of the log, condensed to show the most important parts. Specifically when
packer
first detects the IP. The log will then skip to when the guest reboots. I only included the first two connection errors, as the same error repeats until the timeout is reached, and the build aborts.If you scroll down past the log, you'll see the guest IP changed from
10.211.55.216
to10.211.55.217
... and that Parallels can provide the updated IP address information.