Closed oxyc closed 4 years ago
Well that's a fun one!
I am happy to accept this patch—would you mind terribly making the same change in the ubuntu (and is Debian the same) things over in https://github.com/geerlingguy/packer-boxes ?
Sure thing! I also just finished building the box locally and confirmed it worked with linked clones etc.
This took me a long time to finally figure out! For a few years now I've been using Vagrants DHCP feature to assign IPs to VMs, but about a year ago (since https://github.com/geerlingguy/packer-drupal-vm/commit/f389b8e4c65c1f06a94663fe2e92a64c2597ca33 i guess), all VMs started getting the same IP.
As it turns out this is because Ubuntu 18.04 changed how it identifies itself to DHCP servers, using machine-ids instead of mac addresses. There's quite a few reports on this if you search for "truncate -s 0 /etc/machine-id"
I'm not sure this is the correct fix but it's inspired by Google search results. Packer example does it a bit simpler but not sure.
I've verified that if I run this on an existing VM, it's DHCP assigned IP finally becomes unique
I had a PR open to Drupal VM for DHCP https://github.com/geerlingguy/drupal-vm/pull/1559 but nowadays I just patch it with composer-patches.