Comment 19 for bug 32906

Revision history for this message
asmoore82 (asmoore82) wrote : Re: sudo shouldn’t ABSOLUTELY NEED to look up the host it’s running on

I can confirm similar behavior on Hardy Alpha6 to what's shown above, _but_ I say that there is no bug here.

The behavior stems from the fact that the hostname is preset in 3 locations:
1. "/etc/hosts" 2. "/etc/hostname" which, in turn, sets the precedent for 3. The kernel itself and/or "the Environment"
If you change the hostname from within the `network-admin` tool, you have no issues with `sudo`
_and_ the tool warns you that your system will be in an inconsistent state until the next reboot.

Steps to confirm the lack of a bug:
I, too, use 2 terminals, 1 in a `sudo -s` session as a failsafe and a second to test for breakage of `sudo` in general.
The commands are posted in the order I execute them and you can use the leading '$' or '#' to distinguish between the 2 terminals:

-----
# hostname
pickles
$ sudo true
[sudo] password for asmoore:
$ sudo -k
# sed -i "s/pickles/foobar/g" /etc/hosts
$ sudo true
sudo: unable to resolve host pickles
# hostname foobar
$ sudo -k
$ sudo true
[sudo] password for asmoore:
-----

Observe that `sudo` went from working, to "broken", to working again as I restored the system to a semi-consistent state
by having `hostname` and "/etc/hosts" agree. Note that, had I rebooted right after, `sudo` and many other things would've
been "broken" again because "/etc/hosts" and "/etc/hostname" do _not_ agree; this, too, is _not_ a bug.

The original "bug" reporter needs to understand that:
1. His system is broken simply because he broke it.
2. Freedom means "free to do anything, even if it is destructive."
3. A "blog post" does not a "bug report" make.

IMHO, this bug report is akin to "`sudo rm -rf` hosed my system!"

Adam sM, "ubuntuforums.org" member, my first "launchpad.net" posting.