Set the hostname

Pick a name for the machine and write it down in the one file that defines it:

Run this inside the chroot:
echo myhost > /etc/hostname

Substitute your own name. It is the name you will type into ssh for the rest of the machine’s life, so something short and memorable beats something descriptive.

Not hostnamectl -- not yet

On a running system, hostnamectl hostname myhost is the right tool. In a chroot it is actively dangerous, because arch-chroot bind-mounts the live system’s /run – including the D-Bus socket – so hostnamectl talks to the installer’s systemd rather than the target’s:

# arch-chroot /mnt hostnamectl status
 Static hostname: arch-iso

That is the stick answering, not the machine you are installing. Setting the hostname that way renames the live environment and leaves the target with no /etc/hostname at all. Nothing warns you.

Writing the file directly is what the Arch installation guide specifies for exactly this reason, and hostnamectl writes the same file once the machine is up and running on its own.

You do not need to edit /etc/hosts

Older guides tell you to add a 127.0.1.1 myhost line. On a current Arch system that is unnecessary, because systemd’s myhostname resolver answers for the local hostname already:

[bash]: Run this on your workstation:
grep '^hosts:' /etc/nsswitch.conf
(stdout)
hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns

myhostname in that list is what resolves myhost and localhost without any help from /etc/hosts. Leave the file alone.

// settings
theme:
fx: