| Post Reply | RetroFed Forum Forum Index » Linux |
| Author | Message | ||
|---|---|---|---|
jokeyrhyme
lemmy.ml
jokeyrhyme@lemmy.mlJoined: 2021-04-06 |
hehe, so ... if you ever change the hostname of a Linux machine, you really really ought to double-check /etc/hosts to make the same hostname change there it's surprising just how much will break if a machine's own hostname isn't resolvable to a 127.x.x.x address :P |
||
| 75 Original | |||
|
otacon239
lemmy.world
otacon239@lemmy.world Joined: 2024-10-07 |
Interesting. I’ve changed my hostname on a few machines throughout the past and never ran into this. Good to know if I ever run into this in the future. |
||
| 9 | |||
|
monovergent
lemmy.ml
monovergent@lemmy.ml Joined: 2023-11-27 |
Lost my mind a few years ago over this quirk. Now I always change both files when I want to change the hostname. |
||
| 4 | |||
|
fuckwit_mcbumcrumble
lemmy.dbzer0.com
fuckwit_mcbumcrumble@lemmy.dbzer0.com Joined: 2024-03-20 |
Nothing is worse than waiting for sudo to time out. I forget how long it would take, but it always feels like ages. |
||
| 5 | |||
|
ark3
lemmy.dbzer0.com
ark3@lemmy.dbzer0.com Joined: 2025-01-13 |
|
||
| 9 | |||
|
Hawke
lemmy.world
Hawke@lemmy.world Joined: 2023-06-21 |
It’s always been wild to me how the seemingly-simplest change (“what is the name of this computer”) has so many little gotchas and quirks. |
||
| 2 | |||
jokeyrhyme
lemmy.ml
jokeyrhyme@lemmy.mlJoined: 2021-04-06 |
https://man7.org/linux/man-pages/man1/hostnamectl.1.html
yep, I used that command to modify the hostname, rather than edit /etc/hostname directly |
||
| 3 | |||
|
alastel
lemmy.ml
alastel@lemmy.ml Joined: 2025-02-18 |
If you have myhostname set for hosts in /etc/nsswitch.conf it shall take care of this for you (should be the default on most systemd distros I believe? not sure) |
||
| 2 | |||
|
non_burglar
lemmy.world
non_burglar@lemmy.world Joined: 2023-06-16 |
https://man7.org/linux/man-pages/man1/hostnamectl.1.html
I know this is the preferred way to do it now, but I sometimes worry that abstracting where things are configured in an is that configures everything in a file. You used to only have to check two places to change a hostname. Oldmanyellsatsky.jpg |
||
| 5 | |||
|
JasonDJ
lemmy.zip
JasonDJ@lemmy.zip Joined: 2024-01-16 |
Isn't this what hostnamectl is supposed to handle? |
||
| 12 | |||
∟⊔⊤∦∣≶
lemmy.nz
luthis@lemmy.nzJoined: 2023-06-29 |
There's another way to change the hostname that isn't etc/hosts? |
||
| 7 | |||
|
arty
feddit.org
arty@feddit.org Joined: 2024-07-02 |
You guys are having own hostname in hosts file? |
||
| 4 | |||
|
MonkderVierte
lemmy.zip
MonkderVierte@lemmy.zip Joined: 2025-05-30 |
There's another way to change the hostname that isn't etc/hosts?
Probably a systemd-somethingd. Edit: yup |
||
| 5 | |||
|
MonkderVierte
lemmy.zip
MonkderVierte@lemmy.zip Joined: 2025-05-30 |
https://man7.org/linux/man-pages/man1/hostnamectl.1.html
Laughs in Alpine. |
||
| 4 | |||
|
limelight79
lemmy.world
limelight79@lemmy.world Joined: 2025-06-04 |
This reminds me... My server demands to be known as hostname.local on my network. The other machines just respond to just hostname. I really should figure out why that is. |
||
| 5 | |||
P03 Locke
lemmy.dbzer0.com
p03locke@lemmy.dbzer0.comJoined: 2023-06-23 |
This reminds me... My server demands to be known as hostname.local on my network. The other machines just respond to just hostname. I really should figure out why that is.
Domain search suffixes |
||
| 4 | |||
jokeyrhyme
lemmy.ml
jokeyrhyme@lemmy.mlJoined: 2021-04-06 |
You guys are having own hostname in hosts file?
seems like a pretty common practice across Linux distributions /etc/hostname for the actual hostname, and a mapping in /etc/hosts pointing it at a 127.x.x.x address |
||
| 2 | |||
jokeyrhyme
lemmy.ml
jokeyrhyme@lemmy.mlJoined: 2021-04-06 |
There's another way to change the hostname that isn't etc/hosts?
no, you might have misunderstood /etc/hosts is not where the hostname is configured /etc/hostname for the actual hostname, and a mapping in /etc/hosts pointing it at a 127.x.x.x address |
||
| 5 | |||
jokeyrhyme
lemmy.ml
jokeyrhyme@lemmy.mlJoined: 2021-04-06 |
Isn't this what hostnamectl is supposed to handle?
it modifies /etc/hostname for you, but doesn't seem to touch /etc/hosts i still prefer hostnamectl, but i'm now unsure of what benefit it offers over editing /etc/hostname directly |
||
| 4 | |||
jokeyrhyme
lemmy.ml
jokeyrhyme@lemmy.mlJoined: 2021-04-06 |
If you have myhostname set for hosts in /etc/nsswitch.conf it shall take care of this for you (should be the default on most systemd distros I believe? not sure)
i'm guessing a few things somehow consume /etc/hosts mappings without going through nss /shrug |
||
| 1 | |||
∟⊔⊤∦∣≶
lemmy.nz
luthis@lemmy.nzJoined: 2023-06-29 |
no, you might have misunderstood /etc/hosts is not where the hostname is configured /etc/hostname for the actual hostname, and a mapping in /etc/hosts pointing it at a 127.x.x.x address
Ohh right yes. I only ever touch hostname once during install and then only hosts after that |
||
| 2 | |||
|
itmosi
sh.itjust.works
itmosi@sh.itjust.works Joined: 2023-06-19 |
You guys are having own hostname in hosts file?
Never, there's no need for it. I can reach it with localhost or 127.0.0.1, so why would I even put it in? |
||
| 2 | |||
|
CarrotsHaveEars
lemmy.ml
racketlauncher831@lemmy.ml Joined: 2021-10-03 |
Laughs in Alpine.
Laughs louder in Void, Gentoo, and Devuan. |
||
| 1 | |||
|
limelight79
lemmy.world
limelight79@lemmy.world Joined: 2025-06-04 |
Domain search suffixes
I use DHCP for everything, even my server, with a reserved IP address in the router for the server and my desktop and a few other things I don't want to move around (printers, some IoT things, Home Assistant, etc.). I think the issue is the bridge interface I have to set up for Home Assistant. |
||
| 1 | |||
| Post Reply |
Back to top |