I am a newbie to Linux environment and building a Linux system from scratch using busy box. I created /etc/hosts and /etc/hostname file. But every time I start the system it shows (none)login: But I can change the hostname using hostname command after logging in. I don't want any FQDN hostname or dynamic hostname configuration from DNS server. The content of the host name files are:-
$cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 tiny
$cat /etc/hostname
tiny
Is there wrong with the procedure or file. Please any help is appreciated.
You're likely going about this the right way and just need to either restart the system sudo reboot
(or just reboot
as the root user) or reload networking.
On Ubuntu and other Debian-variants, you're correct - you need to update /etc/hostname
and /etc/hosts
. To reload networking: service networking reload
or invoke-rc.d networking force-reload
.
On Fedora/CentOS and other Red Hat variants, you can set the hostname using the hostnamectl
program. To reload networking: /etc/init.d/network reload
On Android, I believe the command you want is: setprop net.hostname <your name here>
.
Also, you can combine your entry in /etc/hostname
to:
127.0.0.1 localhost tiny