-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automate updating /etc/hosts #12793
Comments
|
We have provided nss-myhostname for this purpose for a long time. It maps the local hostname to 127.0.0.1 (or a more appropriate local IP address) in absence of any other record. Please work with your distribution to enable it, many already do. With the module enable the local hostname never has to be listed in /etc/hosts and it stay always resolvable. For further details see: https://www.freedesktop.org/software/systemd/man/nss-myhostname.html (Some installers still write out the entry into /etc/hosts even though nss-myhostname is already enabled by default. They should be fixed to simply not do that anymore.) Anyway, closing, since this is already available in a better, more efficient more dynamic version. |
|
Thank you, that seems to be a good solution that we can integrate to ROSA distribution out of the box (UPD: it was already), it seems to do what I wanted to, didn't know about it. |
|
no, it's the other way round: first listed NSS module that considers itself authoritative for a name wins. |
Curently
hostnamectl set-hostname <new hostname>leaves old hostname in/etc/hosts, what may lead to unsertain behaviour in different situation, e.g. sudo may take long to start, samba'snet ads joinwill work incorrectly etc.I would propose to automate changing /etc/hosts at least when there is old hostname in it and so we may change it to a new one.
Another aspect is that we need to keep the following format:
127.0.0.1 <FQDN> <short>(e.g.
127.0.0.1 pc.domain.loc pc)as recommended in
hostname(1).net ads joinfails to work correctly when it is127.0.0.1 <short> <FQDN>, it wants to see127.0.0.1 <FQDN> <short>(https://ubuntuforums.org/showthread.php?t=2346398&p=13588177#post13588177, https://bugzilla.rosalinux.ru/show_bug.cgi?id=9962)The text was updated successfully, but these errors were encountered: