Updating a Raspberry Pi hostname

Changing the hostname the usual way with hostnamectl kept reverting after every reboot, until some digging turned up what was silently overriding it.