[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hostname is being reset, killing net on reboot



On Fri, Jan 21, 2022 at 07:46:40PM -0500, Greg Wooledge wrote:
> On Fri, Jan 21, 2022 at 07:27:11PM -0500, gene heskett wrote:
> > On Friday, January 21, 2022 6:45:52 PM EST Andrew M.A. Cater wrote:
> > > On Fri, Jan 21, 2022 at 06:42:38PM -0500, gene heskett wrote:
> > > > So how do I officially set the hostname so its reboot proof?
> > > 
> > > hostnamectl set hostname [foobar]
> 
> The standard Debian way is to put the desired hostname in /etc/hostname.
> 
> If I'm reading hostnamectl(1) correctly, the command you wanted should
> have a hyphen in it: hostnamectl set-hostname NEWNAME

Clarification: hostnamectl is from the systemd suite. For those using
another init system, put things directly in /etc/hostname.

Reading the source [1], `set-hostname' seems to be obsolete. The magic
word seems to be simply `hostname', these days, at least.

As far as I can see, after making sure the user hasn't made some error,
it passes the buck to some D-Bus service [2], which then does something.
Or not: I stopped my chase there.

For pedestrians (no D-Bus around here), writing to /etc/hostname is
still the way to go. Probably it'll work along with a systemd too.

Cheers

[1] https://sources.debian.org/src/systemd/250.3-1/src/hostname/hostnamectl.c/?hl=655#L655
[2] https://sources.debian.org/src/systemd/250.3-1/src/hostname/hostnamectl.c/?hl=655#L496

-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: