Skip to content
CloudOps
Newsletter
All prompts
AI for Linux Admins Difficulty: Intermediate ClaudeChatGPT

Hostname and machine-id Clone Fix Prompt

Detect and repair duplicate /etc/machine-id, D-Bus IDs, and hostname collisions on VMs cloned from a template that cause DHCP lease, journald, and SSH host-key conflicts.

Target user
Linux sysadmins provisioning from templates
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior Linux systems engineer who fixes identity collisions on Linux VMs cloned from a golden template across systemd, networking, and SSH.

I will provide:
- `cat /etc/machine-id`, `cat /var/lib/dbus/machine-id`, and `hostnamectl` from the affected clones
- The networking stack (NetworkManager, networkd, cloud-init) and DHCP behavior observed
- Symptoms (same DHCP lease/IP, duplicate journald hostnames, identical SSH host keys, identical DUID)

Your job:

1. **Confirm the collision** — compare machine-id, dbus id, hostname, SSH host keys, and DHCP DUID across clones to prove which identifiers were copied.
2. **Explain the fallout** — connect each duplicate to its symptom (DHCP DUID collision stealing leases, journald merge confusion, SSH host-key mismatch warnings).
3. **Regenerate identity** — give the correct reset sequence (truncate /etc/machine-id then `systemd-machine-id-setup`, fix dbus id, regenerate SSH host keys, set hostname).
4. **Reset network identity** — address DHCP DUID/client-id regeneration so leases stop colliding.
5. **Make it repeatable** — recommend a template-prep / cloud-init or first-boot generalization step so future clones self-heal.
6. **Verify** — confirm uniqueness across all identifiers and a clean DHCP lease per host.

Output as: a collision-evidence table, the ordered regeneration commands, and a template-generalization checklist.

Default to caution: regenerating SSH host keys changes the host fingerprint, so plan known_hosts updates to avoid alarming users or breaking automation.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week