Skip to content

fix(packer): give the Kali template DHCP on eth0, the name kali-defaults gives its NIC (#790) - #1096

Merged
Gerrrt merged 1 commit into
mainfrom
gerrrt/kali-eth0-790
Oct 8, 2026
Merged

Gerrrt merged 1 commit into
mainfrom
gerrrt/kali-eth0-790

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Kali's template never got an address once installed, so Packer timed out waiting for SSH. This fixes that in the preseed: one late_command step writes a DHCP stanza for eth0.

What the proof builds on Saruman found (2026-10-08)

kali_node's description allows a build on Saruman "only to prove the preseed", so two proof builds ran there, with the Kali 2026.2 ISO from #1084:

#790's untested part Result
GRUB boot command ✓ typed into GRUB's command line, with preseed/url=http://10.0.30.70:8800/preseed.cfg
Preseed over phoenix:8800 ✓ fetched; the install ran unattended
Secure Boot off (pre_enrolled_keys = false) ✓ the installer and the installed system both booted
kali-linux-default on 64G ✓ installed in about 22 minutes, then booted to tpl-kali login:
Packer reaching SSH ✗ timed out after 60 minutes, in both runs

The cause

The diagnostic run (with PACKER_LOG=1 and -on-error=abort, plus guest-agent probes) showed:

  • The guest agent answered, but eth0 had no address. Packer's debug log repeated Found no IP addresses on VM.
  • /etc/network/interfaces held only allow-hotplug ens18 / iface ens18 inet dhcp: the installer ran with predictable names and configured ens18.
  • kali-defaults 2026.3.2, which kali-linux-default pulls in, links /etc/systemd/network/99-default.link to /dev/null. So the installed system names the same NIC eth0, the name Kali's tools expect.
  • Nothing configured eth0. NetworkManager isn't installed. cloud-init is disabled by its generator during the build, because there is no cloud-init drive until the template is made.

The fix, proven by hand on the live VM

With the diagnostic VM still waiting, I wrote this stanza to /etc/network/interfaces.d/eth0 through the agent and ran ifup eth0. Within seconds Packer had an address and connected. It ran its provisioners and created template 902 (15:33Z). This PR makes late_command write that file. /etc/network/interfaces already sources interfaces.d, so the installer's file isn't edited, and Kali keeps its eth0.

Verified

  • The cause, on the live guest, through the agent: no address on eth0, only an ens18 stanza, and the 99-default.link mask owned by kali-defaults.
  • The stanza's effect: written by hand on the live VM, it let Packer connect, and the template was built.
  • A clone works. packer-smoke.sh 902 on Saruman passed: the clone took its user, phoenix's key and DHCP from cloud-init, came up at 10.0.30.101 as smoke-902, and phoenix's key opened smoke@10.0.30.101. The clone was destroyed.
  • scripts/lint.sh exits 0, and check_docs.py passes.
  • The late_command line itself. The stanza was proven by hand, not yet written by the preseed. The next Kali build proves it: another proof build on Saruman, or Build tpl-kali (VMID 902) on ifrit once it exists #790's first build on ifrit.

The proof template 902 was destroyed after the smoke test: #790's template belongs on ifrit.

Refs #790

🤖 Generated with Claude Code

…lts 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 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change addresses the verified networking failure without introducing conflicting behavior.

0 open findings

What changed in this PR

Adds DHCP configuration for Kali’s renamed eth0 interface so Packer can reach the installed template over SSH.

Changes:

  • Writes an eth0 DHCP stanza during the installer’s late command.
  • Documents why installer and installed-system interface names differ.
File Description
packer/​kali/​preseed.cfg.pkrtpl Configures DHCP on eth0 after installation.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@Gerrrt
Gerrrt merged commit 99c91b4 into main Oct 8, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/kali-eth0-790 branch October 8, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants