Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Proper way to set hostname
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
akrmn24
n00b
n00b


Joined: 24 Nov 2024
Posts: 13

PostPosted: Mon Jan 13, 2025 6:02 pm    Post subject: Proper way to set hostname Reply with quote

In the installation manual it says to set the hostname in /etc/hostname. But this has no effect for me. In my terminal it shows just user@#, and hostname command returns a blank entry, and various programs that depend on the hostname give warnings. It only gets set when I use the hostname command (hostname <name>). Then I logout and log back in and I see the user@hostname in the terminal.

I'm trying this on a MUSL / arm64 / openrc system btw.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9860
Location: almost Mile High in the USA

PostPosted: Mon Jan 13, 2025 7:17 pm    Post subject: Reply with quote

After changing /etc/hostname you'll need to make openrc reread it.

/etc/init.d/hostname restart (or a reboot) should do it?

As an aside, does changing /etc/conf.d/hostname even work? The code looks wrong... or is it...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1044
Location: Somewhere in Denmark

PostPosted: Mon Jan 13, 2025 7:37 pm    Post subject: Reply with quote

eccerr0r wrote:
After changing /etc/hostname you'll need to make openrc reread it.

/etc/init.d/hostname restart (or a reboot) should do it?

As an aside, does changing /etc/conf.d/hostname even work? The code looks wrong... or is it...


I'm setting hostname with/in /etc/conf.d/hostname since forever - works perfectly fine.
Code:
ns ~ # cat /etc/conf.d/hostname
# Hostname fallback if /etc/hostname does not exist
hostname="ns.vlh.dk"
ns ~ # hostname
ns.vlh.dk
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 700

PostPosted: Mon Jan 13, 2025 8:25 pm    Post subject: Reply with quote

freke wrote:
hostname="ns.vlh.dk"
ns ~ # hostname
ns.vlh.dk[/code]
My mail server does odd things if I set the hostname to an FQDN and not just the host, like sending mail from root@hostname.mydomain.com.mydomain.com.
The only time the FQDN is set outside the context of "connect to/use this <IP|FQDN>" optional software config files is in /etc/hosts, re:
Code:
127.0.0.1 <FQDN> <hostname> localhost
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9860
Location: almost Mile High in the USA

PostPosted: Mon Jan 13, 2025 9:59 pm    Post subject: Reply with quote

hostname should be just the name of the host, not fqdn.
domain name is separate.

I was staring at the init script for hostname and it just looks wrong for some reason. maybe there's some other script that handles /etc/conf.d/hostname.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum