twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
12.9k stars 478 forks source link

Wrong hostname being picked up after change #2973

Closed VoreckLukas closed 1 year ago

VoreckLukas commented 1 year ago

Describe the bug

When Initially installing my OS i used arcHP as hostname, but renamed it to ArcHP as my config templates relied on that capitalization. However even after a reboot chezmoi is picking up the old one"

❯ chezmoi data | grep hostname
    "hostname": "arcHP",
❯ echo $hostname
ArcHP
❯ hostnamectl status
 Static hostname: ArcHP

To reproduce

Change the hostname and reboot

Expected behavior

Chezmoi should pick up the new hostname

Output of chezmoi doctor

```console ❯ chezmoi doctor RESULT CHECK MESSAGE warning version v2.33.4, built at 2023-05-02T17:51:22Z ok latest-version v2.33.4 ok os-arch linux/amd64 (EndeavourOS) ok uname Linux ArcHP 6.2.13-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 26 Apr 2023 20:50:14 +0000 x86_64 GNU/Linux ok go-version go1.20.3 (gc) ok executable /usr/bin/chezmoi ok config-file no config file found warning source-dir ~/.local/share/chezmoi is a git working tree (dirty) ok suspicious-entries no suspicious entries warning working-tree ~/.local/share/chezmoi is a git working tree (dirty) ok dest-dir ~ is a directory ok umask 022 ok cd-command found /usr/bin/fish ok cd-args /usr/bin/fish info diff-command not set ok edit-command found /usr/bin/nano ok edit-args /usr/bin/nano ok git-command found /usr/bin/git, version 2.40.1 warning merge-command vimdiff not found in $PATH ok shell-command found /usr/bin/fish ok shell-args /usr/bin/fish info age-command age not found in $PATH ok gpg-command found /usr/bin/gpg, version 2.2.41 info pinentry-command not set info 1password-command op not found in $PATH info bitwarden-command bw not found in $PATH info dashlane-command dcli not found in $PATH info gopass-command gopass not found in $PATH info keepassxc-command keepassxc-cli not found in $PATH info keepassxc-db not set info keeper-command keeper not found in $PATH info lastpass-command lpass not found in $PATH info pass-command pass not found in $PATH info passhole-command ph not found in $PATH info rbw-command rbw not found in $PATH info vault-command vault not found in $PATH info secret-command not set ```
twpayne commented 1 year ago

Did you also update the hostname in /etc/hosts and /etc/hostname?

VoreckLukas commented 1 year ago
❯ cat /etc/hostname 
ArcHP
❯ cat /etc/hosts
# Standard host addresses
127.0.0.1  localhost
::1        localhost ip6-localhost ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters
# This host address
127.0.1.1  arcHP

seems like the one in /etc/hosts didn't get updated

After a quick test hostnamectl only changes the hostname file

twpayne commented 1 year ago

You should also check the output of uname and the contents of /proc/sys/kernel/hostname.

Anyhow, this is not a bug in chezmoi, so I'll close this now.

VoreckLukas commented 1 year ago
❯ uname
Linux
❯ cat /proc/sys/kernel/hostname 
ArcHP

The only thing unchanged seems to be /etc/hosts Still thanks for making me aware of that