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

Re: armv7 vs buster sudo complains about hostname or something



On Fri, Jul 05, 2019 at 06:15:02AM -0400, Gene Heskett wrote:
> 127.0.0.1	localhost
> 192.168.71.1	router.coyote.den	router
> 192.168.71.3    coyote.coyote.den	coyote
> 192.168.71.4	shop.coyote.den		shop
> 192.168.71.5	lathe.coyote.den	lathe
> 192.168.71.6	lappy.coyote.den	lappy
> 192.168.71.7	sheldon.coyote.den	sheldon
> 192.168.71.10	GO704.coyote.den	GO704
> 192.168.71.12	picnic.coyote.den	picnc
> 192.168.71.21	MFC.coyote.den		printer	scanner
> 192.168.71.30	vna.coyote.den		vna
> ::1		localhost ip6-localhost ip6-loopback
> ff02::1		ip6-allnodes
> ff02::2		ip6-allrouters
> 
> #127.0.1.1	raspberrypi

I don't know which machine this /etc/hosts is from, but see how the
last line is commented out, and has the name "raspberrypi", which
does not appear on any other line?

If "raspberrypi" is supposed to be your machine's local hostname, then
you should uncomment that line.  Or, if you prefer, add a line with
the machine's proper IPv4 LAN address plus its local hostname.

The purpose of having your local hostname in /etc/hosts (with *any*
valid address for it, even a loopback one like 127.0.1.1) is so that
processes which try to look up the local hostname before DNS is
working will get a valid response, and not freak out.

Debian uses 127.0.1.1 for this by default, but encourages you to
override this with a static LAN address, if your host has one.  If
you don't have a static LAN address, then the default will work.

Since you commented out the default (again, assuming this machine's
local hostname is "raspberrypi"), any process that tries to look up
your hostname in the absence of DNS will throw a fit, and I wouldn't
care to predict the exact symptoms you'll see.  Among them may be
processes dying immediately upon startup, processes hanging, processes
assuming things about your local network numbering scheme, processes
spewing error messages, and so on.

sudo does a hostname lookup because, for some reason incomprehensible to
mortal women and men, it has a "host" field on every configuration line.
It seems that the intent is you'll write one gigantic-ass sudoers file
with lines for every host on your network all mixed together, and drop
a copy in /etc on every host; then, the "host" field on each line will
tell each machine which lines to ignore.

I don't know *anyone* who does it that way, and the documentation does
not give any rationale for why sudoers has a "host" field, or what the
intended use of this field is... so that's just my guess.

So anyway, because of this "feature" that absolutely nobody uses, sudo
tries to look up your hostname, with multiple paths to failure if your
hostname is not properly defined.


Reply to: