updating the hostname via snappy config does not update /etc/hosts
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Snappy |
Medium
|
Oliver Grawert | ||
Bug Description
when using snappy config to set a hostname only /etc/hostname is updated, but there is no:
127.0.1.1 <newhostname>
added to /etc/hosts which results in:
sudo: unable to resolve host <newhostname>
when using sudo after the name change.
/etc/hosts should be made writable and whatever is used as backend to snappy config here should set a proper "127.0.1.1" entry in that file.
| Steve Langasek (vorlon) wrote : Re: [Bug 1495058] [NEW] updating the hostname via snappy config does not update /etc/hosts | #1 |
| Oliver Grawert (ogra) wrote : | #2 |
i guess that would require using systemd-hostnamed, which we do not do yet apparently:
...
// getHostname returns the hostname for the host
var getHostname = os.Hostname
var hostnamePath = "/etc/writable/
var syscallSethostname = syscall.Sethostname
// setHostname sets the hostname for the host
var setHostname = func(hostname string) error {
hostnameB := []byte(hostname)
if err := syscallSethostn
return err
}
return ioutil.
}
...
(from lp:snappy/coreconfig/config.go)
| Oliver Grawert (ogra) wrote : | #3 |
hmm, i just notice that for plain name resolution it shouldnt matter, i'll seed libnss-myhostname for a test to see if it gets along with the symlinked /etc/hosts
| Oliver Grawert (ogra) wrote : | #4 |
tested and verified that libnss-myhostname works fine in our setup
| Oliver Grawert (ogra) wrote : | #5 |
libnss-myhostname is seeded in both, stable and rolling now
| Changed in snappy: | |
| status: | New → Fix Released |
| importance: | Undecided → Medium |
| assignee: | nobody → Oliver Grawert (ogra) |


On Sat, Sep 12, 2015 at 11:26:11AM -0000, Oliver Grawert wrote:
> Public bug reported:
> when using snappy config to set a hostname only /etc/hostname is
> updated, but there is no:
> 127.0.1.1 <newhostname>
> added to /etc/hosts which results in:
> sudo: unable to resolve host <newhostname>
> when using sudo after the name change.
> /etc/hosts should be made writable and whatever is used as backend to
> snappy config here should set a proper "127.0.1.1" entry in that file.
You might want to look into whether using libnss-myhostname is a better
choice for snappy, to avoid /etc/hosts having to be added to the list of
bind-mounted files.