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

Re: Got a machine name problem



On Wednesday 24 February 2021 03:32:04 tomas@tuxteam.de wrote:

> On Tue, Feb 23, 2021 at 08:21:48PM -0500, Gene Heskett wrote:
> > On Tuesday 23 February 2021 19:22:19 James B wrote:
> > > With systemd-based Debian, the probably now best way to set a
> > > hostname is with:
> > >
> > > hostnamectl set-hostname NAME
> > >
> > > What Tom suggested is completely valid, but hostnamectl should I
> > > understand be the preferred route [...]
>
> ...if you restrict yourself to the systemd world [0], that is.
>
> > Does this also have a set-domainname option? This also is
> > disappearing on a reboot. Not ack the man page so I assume there is
> > a different method to handle that?
>
> Gene, please read the hostname(1) man page. It is short and sweet
> (120 - 240 lines, depending on your screen width). It's all in there.
>
> Choice quotes:
>
> - from the top
>   NAME
>        hostname - show or set the system's host name
>        domainname - show or set the system's NIS/YP domain name
>        ypdomainname - show or set the system's NIS/YP domain name
>        nisdomainname - show or set the system's NIS/YP domain name
>        dnsdomainname - show the system's DNS domain name
>
I could spend the rest of my life changing it with variant 1, but when 
its been powered down overnight, the old name is restored in the morning 
boot. Now I've tried hostnamectl with its option set-hostname newname.
And I'm going to power it up right now, brb.

Ok hostname is good after reboot, but domainname has been reset to 
(none).

But wtf? I have edited "sudo nano" /etc/domainname, did not set the i 
bit, and the edit is still there, but asking for it is (none)

domainname domain.name changes it only for this boot, a reboot clears it 
to (none) again.

So I must have screwed something up with that edit, but how do I fix it?

Thanks Tomas.

> you can safely ignore all that NIS/YP [1] part, that rules out the
> variants 2-4; the last variant only shows the DNS domain name --
> you'd have to talk to Someone Else (TM) to change that. This leaves
> variant (1), i.e. hostname.
>
> Now:
>
>   DESCRIPTION
>     [...]
>     SET NAME
>       When called with one argument or with the --file option, the
>       commands set the host name or the NIS/YP domain name [...]
>
> So... it seems we're out of luck? Only changing your domain if it is
> with NIS/YP is supported? But, oh, lookee...
>
>    THE FQDN
>      The FQDN (Fully Qualified Domain Name) of the system is the
>      name that the resolver(3) returns for the host name, such as,
>      ursula.example.com [...]
>
>      You cannot change the FQDN with hostname or dnsdomainname.
>
>      The recommended method of setting the FQDN is to make the
>      hostname be an alias for the fully qualified name using
>      /etc/hosts, DNS, or NIS [...]
>
> So if your domain isn't imposed on your host by DNS (you would
> know that, since that's your home network, and you'd have done
> some setup to enforce that or by NIS/YP (you most probably don't
> have that, your network admin, i.e. you, would know that), the
> result is... go look in your /etc/hosts [2] for the domain name
> your box thinks it has.
>
> This seemingly baroque thing is due that the domain name "in"
> which your box lives is a decision that not always can be
> taken by your box alone. Like when I'm in France, I can't say
> "I'm in Luxembourg" unless I am a rich person ;-)
>
> (Exchange perhaps France for U.S. and Luxembourg for Delaware
> for those west of the pond. For those elsewhere, please teach
> me: where are your favourite tax paradises?)
>
> Cheers
>
> [0] Me? I prefer to stay portable. Works consistently across
>    systemd and non-systemd boxes.
> [1] https://en.wikipedia.org/wiki/Network_Information_Service
> [2] which kinda makes sense: if you squint a bit, /etc/hosts
>    is sorta the "poor person's DNS". Read on the resolver, and
>    /etc/resolv.conf for the next rabbit hole.

Rabbit hole is a misnomer, its worse than that. :(

Perhaps I should edit /etc/resolv.conf so it uses localhost, then the dns 
address, for resolving.  Its a real file here. And in looking around, 
none of my buster machines have a domainname. ???  That rabbit hole goes 
down to the iron core. At which point we have well overdone fried 
rabbit.

Thanks Tomas

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: