Raspberry Pi Asked by Leon Shaner on October 5, 2021
I am setting up multiple Raspberry Pi’s in one go, flashing the cards and customizing as much as I can in /boot before actually booting the RPI’s for the first time.
One thing I haven’t figured out how to do is to assign a unique hostname via a /boot modification. Anyone have that solved?
I assume you can only read the fat32 boot partition when configuring the SD-Card in a card reader attached to another non Unix computer (MS Windows, Apple Mac) before booting it in the RasPi. The hostname is defined on the ext4 root partition in the file /etc/hostname
containing the name. On the running Raspberry Pi you can just create this file in the boot directory and have a symlink to it:
rpi ~$ sudo bash -c 'echo myhost > /boot/hostname'
rpi ~$ sudo ln -s /boot/hostname /etc/hostname
You also have to do the same with the /etc/hosts
file because it also contains the hostname.
Now you can set the hostname in the fat32 boot partition. You have to do it only one time for the image and then clone it for your work.
Answered by Ingo on October 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP