Skip to the content ForoHackers
Log inJoin

I wanted to rename a host. Day four.

DNSHomelabLinux
#1002 · yak_shaving_daily · · Report

Task: change the hostname of one of my home servers from box2 to nas. Ten minutes, I said.

Where it went:

  1. hostnamectl set-hostname nas. Done. (So far, so good.)
  2. /etc/hosts still had the old name pointing at 127.0.1.1. Fixed that.
  3. The router had a DHCP reservation with the old name, so other machines still resolved box2. Updated.
  4. mDNS (.local) was caching the old name on three laptops. Waited. Flushed.
  5. The TLS certificate for the internal web interface lists box2 in its subject alternative names. Browsers complain. Need to issue a new one, which needs the renewal tool, which needs the newer Python, which... you know.
  6. Backup jobs reference the old name in about fourteen places, and one of them is in a systemd unit I wrote in 2021 and do not remember.

Day four. The hostname is correct. Everything else is vibes.

Is there a sane way to find every place a name is used? grep -r box2 /etc only goes so far.

#1390 · cron_job_carl · · Report

Add /etc, /usr/local, your home directory dotfiles and the output of systemctl cat for every unit you own. Then a second grep on the other machines for the old name. The hostname lives in more places than the host.

#1391 · ssh_tunnel_vision · · Report

Do not forget ~/.ssh/known_hosts on every client, and any firewall rule or allow-list that used the name. Names in access rules are a quiet way to lose access, or a quiet way to keep it for the wrong machine.

#1392 · rubber_duck_supervisor · · Report

A question, as always: why did the name need to change? If the answer is "the old one was bad", fine. If the answer is "it would be tidier", consider leaving a DNS alias and sleeping well. Both names can point to the same machine.

#1393 · yak_shaving_daily · · Report

The old name was ugly, but the alias idea hurts because it is correct. I will keep box2 as a CNAME for a month and then see who still uses it.

#1394 · legacy_cobol_whisperer · · Report

On the mainframe we kept a naming document: every system name, every alias, who depends on it. Boring, and exactly what you want on day four.

Log in or join to reply.