instances cannot resolve their own hostname

Bug #1475260 reported by Martin Pitt
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Unassigned
juju-core (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

cloud instances created by juju are missing their hostname in /etc/hosts. This results in effects like

$ sudo whoami
sudo: unable to resolve host juju-prod-ues-proposed-migration-machine-6
root

or failure to install packages like ssmtp.

Please add "manage_etc_hosts: true" to the user-data config supplied to the instances. This is a kind of "unbreak my setup" option which you always want when starting instances.

Martin Pitt (pitti)
summary: - instances don't know their own hostname
+ instances cannot resolve their own hostname
Revision history for this message
Martin Pitt (pitti) wrote :

This is still an issue with latest yakkety-proposed juju-2.0 2.0~beta17-0ubuntu1.16.10.1.

$ lxc exec juju-68160d-0 -- sh -c 'ping `hostname`'
ping: unknown host juju-68160d-0

This breaks e. g. the standard rabbitmq-server charm:

2016-09-07 20:08:24 INFO config-changed Traceback (most recent call last):
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/config-changed", line 724, in <module>
2016-09-07 20:08:24 INFO config-changed hooks.execute(sys.argv)
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/charmhelpers/core/hookenv.py", line 717, in execute
2016-09-07 20:08:24 INFO config-changed self._hooks[hook_name]()
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/rabbit_utils.py", line 734, in wrapped_f
2016-09-07 20:08:24 INFO config-changed f(*args, **kwargs)
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/config-changed", line 657, in config_changed
2016-09-07 20:08:24 INFO config-changed configure_nodename()
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/config-changed", line 113, in configure_nodename
2016-09-07 20:08:24 INFO config-changed nodename = rabbit.get_local_nodename()
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/rabbit_utils.py", line 672, in get_local_nodename
2016-09-07 20:08:24 INFO config-changed ip_addr = get_host_ip(unit_get('private-address'))
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/charmhelpers/contrib/network/ip.py", line 417, in get_host_ip
2016-09-07 20:08:24 INFO config-changed ip_addr = ns_query(hostname)
2016-09-07 20:08:24 INFO config-changed File "/var/lib/juju/agents/unit-rabbitmq-server-0/charm/hooks/charmhelpers/contrib/network/ip.py", line 403, in ns_query
2016-09-07 20:08:24 INFO config-changed answers = dns.resolver.query(address, rtype)
2016-09-07 20:08:24 INFO config-changed File "/usr/lib/python2.7/dist-packages/dns/resolver.py", line 981, in query
2016-09-07 20:08:24 INFO config-changed raise_on_no_answer, source_port)
2016-09-07 20:08:24 INFO config-changed File "/usr/lib/python2.7/dist-packages/dns/resolver.py", line 910, in query
2016-09-07 20:08:24 INFO config-changed raise NXDOMAIN
2016-09-07 20:08:24 INFO config-changed dns.resolver.NXDOMAIN
2016-09-07 20:08:24 ERROR juju.worker.uniter.operation runhook.go:107 hook "config-changed" failed: exit status 1

tags: added: lxd
tags: removed: lxd
Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.0-beta18
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.0-beta18 → 2.0-beta19
Changed in juju:
milestone: 2.0-beta19 → 2.0-rc1
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in juju-core (Ubuntu):
status: New → Confirmed
Changed in juju:
assignee: nobody → Christian Muirhead (2-xtian)
Revision history for this message
Christian Muirhead (2-xtian) wrote :

I'm unable to reproduce this in beta18, although I was definitely seeing it a couple of days ago.
Maybe it's been recently fixed?

Revision history for this message
Martin Pitt (pitti) wrote :

beta18 is not in yakkety-proposed yet, so I cannot test this yet. Is it available from some PPA?

Revision history for this message
Christian Muirhead (2-xtian) wrote :

Hmm, I tried with some older builds and also don't see it on this machine, but I was seeing it on the other one I was using. So I'll need to chase it on that one (and hopefully work out why it's not happening on this one at the same time).

Changed in juju:
status: Triaged → In Progress
Revision history for this message
Andrew McDermott (frobware) wrote :

If we use manage_etc_hosts: "true" then we will get:

 127.0.1.1 vmhost.home vmhost

(for example).

I'm concerned about how well charms would hold out if they were always using localhost-esque addresses.

For the LXD container case also take a look at:

 https://bugs.launchpad.net/juju/+bug/1623480

Fixing that bug I believe would fix the container case.

Revision history for this message
Andrew McDermott (frobware) wrote :

@2-xtian - if you're testing on MAAS 2.0 then I suspect you're seeing perfectly working DNS for hosts and their containers. Bootstrap across AWS, GCE, and in particular Azure to see the issues on the public clouds.

Note: we are also proposing to land the following as an additional solution for the public clouds _and_ charms:

  https://github.com/frobware/nss-juju

It won't fix the general case of:

  $ lxc exec juju-68160d-0 -- sh -c 'ping `hostname`'

though see my comment about container hostname resolution in comment #6.

Revision history for this message
Andrew McDermott (frobware) wrote :

And for completness:

 https://github.com/dimitern/juju/commit/60e89f1d6cb02f3f0f9f36dbf8e3156ad4e9f7e8

that tree has, as a PoC, support for returning hostname that will work with nss-juju.

Changed in juju:
milestone: 2.0-rc1 → 2.0-rc2
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.0-rc2 → none
Changed in juju:
milestone: none → 2.0.0
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.0-rc3 → 2.0.0
Changed in juju:
milestone: 2.0.0 → 2.0.1
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.0.1 → none
Changed in juju:
milestone: none → 2.1.0
status: In Progress → Triaged
assignee: Christian Muirhead (2-xtian) → nobody
milestone: 2.1.0 → 2.2.0
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.2-beta1 → 2.2-beta2
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.2-beta2 → 2.2-beta3
Changed in juju:
milestone: 2.2-beta3 → 2.2-beta4
Changed in juju:
milestone: 2.2-beta4 → 2.2-rc1
Revision history for this message
Tim Penhey (thumper) wrote :

Is at least fixed on 2.1.3

Changed in juju:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.