Repository navigation
fix(packer): give the Kali template DHCP on eth0, the name kali-defaults gives its NIC (#790) - #1096
Merged
Merged
Conversation
…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>
There was a problem hiding this comment.
🟢 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
eth0DHCP 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kali's template never got an address once installed, so Packer timed out waiting for SSH. This fixes that in the preseed: one
late_commandstep writes a DHCP stanza foreth0.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:preseed/url=http://10.0.30.70:8800/preseed.cfgpre_enrolled_keys = false)kali-linux-defaulton 64Gtpl-kali login:The cause
The diagnostic run (with
PACKER_LOG=1and-on-error=abort, plus guest-agent probes) showed:eth0had no address. Packer's debug log repeatedFound no IP addresses on VM./etc/network/interfacesheld onlyallow-hotplug ens18/iface ens18 inet dhcp: the installer ran with predictable names and configuredens18.kali-defaults2026.3.2, whichkali-linux-defaultpulls in, links/etc/systemd/network/99-default.linkto/dev/null. So the installed system names the same NICeth0, the name Kali's tools expect.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/eth0through the agent and ranifup eth0. Within seconds Packer had an address and connected. It ran its provisioners and created template 902 (15:33Z). This PR makeslate_commandwrite that file./etc/network/interfacesalready sourcesinterfaces.d, so the installer's file isn't edited, and Kali keeps itseth0.Verified
eth0, only anens18stanza, and the99-default.linkmask owned bykali-defaults.packer-smoke.sh 902on Saruman passed: the clone took its user, phoenix's key and DHCP from cloud-init, came up at10.0.30.101assmoke-902, and phoenix's key openedsmoke@10.0.30.101. The clone was destroyed.scripts/lint.shexits 0, andcheck_docs.pypasses.late_commandline 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