From 1cef82ef09e8715dd3c89ad584895dae7df29710 Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Thu, 8 Oct 2026 08:35:59 -0700 Subject: [PATCH] fix(packer): give the Kali template DHCP on eth0, the name kali-defaults gives its NIC (#790) Two proof builds of the Kali template on Saruman on 2026-10-08 (the first at 04:48Z, the diagnostic at 14:44Z) installed cleanly and booted to a login prompt. Packer then timed out waiting for SSH, because the guest never had an address. The guest agent reported eth0 with none, and Packer's debug log repeated "Found no IP addresses on VM". The cause: the installer runs with predictable interface names, so it wrote `iface ens18 inet dhcp`. kali-defaults (2026.3.2), pulled in by kali-linux-default, links /etc/systemd/network/99-default.link to /dev/null, so the installed system names the same NIC eth0. Nothing configured eth0. NetworkManager is not installed, and cloud-init is disabled during the build because there is no cloud-init drive yet. Proven on the live diagnostic VM: writing this stanza to /etc/network/interfaces.d/eth0 and running `ifup eth0` gave it an address. Packer connected within seconds and created the template, at 15:33Z. late_command now writes that file. Refs #790 Co-Authored-By: Claude Opus 5.5 --- packer/kali/preseed.cfg.pkrtpl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packer/kali/preseed.cfg.pkrtpl b/packer/kali/preseed.cfg.pkrtpl index 0d41ec02..56af17e3 100644 --- a/packer/kali/preseed.cfg.pkrtpl +++ b/packer/kali/preseed.cfg.pkrtpl @@ -47,7 +47,16 @@ popularity-contest popularity-contest/participate boolean false d-i grub-installer/only_debian boolean true d-i grub-installer/bootdev string default +# DHCP on eth0 as well as on the name the installer saw. The installer runs with +# predictable interface names, so it configures ens18. kali-defaults, which +# kali-linux-default pulls in, links /etc/systemd/network/99-default.link to +# /dev/null, so the installed system calls the same NIC eth0: Kali's tools expect +# it. With only an ens18 stanza, eth0 never came up, the guest had no address, and +# Packer timed out waiting for SSH (#790, two proof builds on Saruman, 2026-10-08). +# interfaces sources interfaces.d, so this adds eth0 without editing the +# installer's file. A clone's cloud-init configures its own network on top. d-i preseed/late_command string \ + printf 'allow-hotplug eth0\niface eth0 inet dhcp\n' > /target/etc/network/interfaces.d/eth0; \ in-target mkdir -p /home/packer/.ssh; \ echo '${ssh_public_key}' > /target/home/packer/.ssh/authorized_keys; \ in-target chown -R packer:packer /home/packer/.ssh; \