> On Nov 12, 2016, at 8:46 AM, Henrique de Moraes Holschuh <h...@debian.org> 
> wrote:
> 
> hostname -f does this:
> 
> 1. Asks glibc for the hostname, using gethostname().
> 
> 2. Does an IP lookup on the hostname, using getaddrinfo() and the
>   hostname it got from gethostname(), and returns the result from
>   getaddrinfo().
> 
> Since it uses glibc for the host name lookup, it is subject to the glibc
> name resolver, which is configured through /etc/nsswitch.conf.
> 
> Now, gethostname() works like this [in glibc]: it calls the uname()
> syscall, and uses the node name returned.  I.e. it looks up the
> *hostname* the kernel was set to.
> 
> So, glibc's gethostname() will match the output of "uname -n".  This
> information was set on the kernel by either systemd, or by the
> initscripts.
> 
> Initscripts use /etc/hostname to set this information.  I am not well
> versed on how exactly systemd persists this information, but it likely
> uses /etc/hostname as well.

Bingo! I had a feeling it was convoluted.

> root@srv:~# host srv.slsware.org
> srv.slsware.org has address 216.17.203.66
> root@srv:~# hostname
> srv
> root@srv:~# hostname -f
> srv.slsware.org
> root@srv:~# hostname -d
> slsware.org

I edited /etc/resolv.conf to point the nameserver at the host's IP instead of 
pointing at localhost (this host is the (temporary) DNS server for the .org 
domain).

Now all is well. Except for /proc, which I'll ignore in the future.

Just why the IP worked and 'localhost' didn't is another question -- I assume 
it has something to do with machinations in glibc. I'm not afraid of C, but 
things are working and I've got more interesting things to do today.

Thanks all. It's been quite a ride. Now everybody write it down: it has nothing 
to do with what's in /etc/hosts or /etc/resolv.conf. There has to be a live, 
accessible DNS server for the domain somewhere. At least at slsware.org there 
does.

What idiot designed that?

It does seem that /etc/hosts should work, though...


No, I take it back. I don't think DNS is the whole story. It worked in this 
case, but how does the installer get a domainname?

-- 
Glenn English


Reply via email to