Is it possible to change the host name before the first boot? I've tried changing the name in /etc/hostname
, but then the Pi doesn't boot properly. Is there something else that needs to be done?
This is intended for a Raspberry Pi running Raspbian/Raspberry Pi OS (lite) that is headless and connected by Ethernet. I'd like to be able to connect to the Raspberry Pi using ssh
. (I have verified that if I don't change the host name I am able connect with ssh
.)
man 5 hostname
and the suggestion about usingsystemd-firstboot
(then readman systemd-firstboot
); the idea is that you mount the root filesystem somewhere (with systemd available) and use that to tweak the image without having to run the system in it. If it works out, please leave an answer of your own!