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.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
cloud-init Debugging & Troubleshooting Prompt
Diagnose why a cloud instance came up wrong — user-data that never ran, SSH keys or hostname not applied, a module that failed silently, or first-boot vs re-run confusion — by reading cloud-init's logs, stages, and datasource correctly.
-
Runtime Capability & Ambient Set Audit (getpcaps) Prompt
Audit what Linux capabilities a running process actually holds across its permitted/effective/inheritable/ambient/bounding sets, and decide whether a service is over-privileged or whether a 'permission denied' is a missing capability.
-
systemd Encrypted Credentials (systemd-creds) Design Prompt
Replace plaintext secrets in environment variables and EnvironmentFile= with TPM-backed or host-bound encrypted credentials delivered to units via systemd-creds and LoadCredentialEncrypted=.
-
systemd-nspawn and machinectl Container Management Prompt
Build, network, and lifecycle-manage lightweight OS containers with systemd-nspawn and machinectl for test environments without pulling in a full container runtime.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.