lxc: sudo: unable to resolve host

Bug #1328269 reported by David Britton
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Unassigned
juju-core
Won't Fix
Medium
Unassigned

Bug Description

this is an annoyance rather than a real error. Still gives an unpolished look.

When you deploy a container (either on the maas provider or the local provider), and login to the container and attempt to use 'sudo', you see:

    sudo: unable to resolve host dpb-local-machine-1

Everything works, but with every sudo command you run, you get this. I found a relevant bug which suggests perhaps just a configuration change?

    https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1079794

Work around:
Add the hostname to /etc/hosts

Revision history for this message
Curtis Hovey (sinzui) wrote :

This appears to be fixed in saucy+. Precise may need special attention. From the other bug:
    Note that there is an easy workaround by adding the container name to /etc/hosts yourself.

Changed in juju-core:
status: New → Triaged
importance: Undecided → Medium
tags: added: local-provider lxc maas-provider
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Still happens with trusty:

$ juju ssh ubuntu-lxc/0 sudo -u ubuntu lsb_release -cs
Warning: Permanently added '10.96.1.13' (ECDSA) to the list of known hosts.
Warning: Permanently added '10.96.1.195' (ECDSA) to the list of known hosts.
sudo: unable to resolve host juju-machine-1-lxc-0
trusty
Connection to 10.96.1.195 closed.
$

This was with juju 1.19.3

Curtis Hovey (sinzui)
description: updated
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: none → next-stable
importance: Medium → High
tags: added: cts-cloud-review landscape
tags: added: cts
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 1.21 → 1.22
Changed in juju-core:
milestone: 1.22-alpha1 → 1.23
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 1.23 → none
importance: High → Medium
Revision history for this message
Johan Ehnberg (johan-ehnberg) wrote :

This also causes backuppc rsync protocol negotiation fail due to backuppc receiving an invalid protocol number.

The logs will show the following:
'Got remote protocol 1868854643'

tags: removed: cts
Revision history for this message
Johan Ehnberg (johan-ehnberg) wrote :

Workaround automation script:
#!/bin/bash
if [ -f "/proc/1/cgroup" ] && grep -vq "/$" /proc/1/cgroup; then
    sudo sed -i '/127\.0\.1\.1/d' /etc/hosts
    echo "127.0.1.1 $HOSTNAME" |sudo tee -a /etc/hosts
fi

Revision history for this message
Stuart Bishop (stub) wrote :

I've added a workaround to the Cassandra charm for this.

Per Bug #1489598, "Generally a-lot of openstack breaks (neutron and nova esp) when
hostnames are not resolvable."

Revision history for this message
Stuart Bishop (stub) wrote :

RabbitMQ was the other victim I'm aware of.

Revision history for this message
David Britton (dpb) wrote :

Still happens in trusty with lxd

Stuart Bishop (stub)
tags: added: canonical-is
Alvaro Uria (aluria)
tags: added: canonical-bootstack
Revision history for this message
Andrew McDermott (frobware) wrote :
no longer affects: juju
Changed in juju-core:
status: Triaged → Won't Fix
Changed in juju:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Andrew Wilkins (axwalk) wrote :

This appears not to be an issue any more. At least I can't reproduce it (and I did see it in the past). Please reopen/unmark duplicate if it's still an issue, describing the details of the network configuration.

Revision history for this message
Andrew Wilkins (axwalk) wrote :

Sorry, closed wrong one; this is lxc, not lxd.

Revision history for this message
David A. Desrosiers (setuid) wrote :
Download full text (3.7 KiB)

Still affects juju (2.0.2) with lxc (2.0.10) and maas (2.2.2-6099-g8751f91) on latest Xenial (16.04.3 LTS).

In my case, the 'maas' network is as follows (as documented and described in numerous HOWTO and training guides):

<network connections='1'>
  <name>maas</name>
  <uuid>b97f7d0e-66e0-40b9-b6c9-274ead6f1c36</uuid>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:63:36:54'/>
  <domain name='maas'/>
  <ip address='192.168.100.1' netmask='255.255.255.0'>
  </ip>
</network>

Pods work, commission and deploy works, but bootstrapping juju on a cloud, does not.

Cloud config is:

clouds:
   dev-maas:
      type: maas
      auth-types: [oauth1]
      endpoint: http://192.168.100.1/MAAS

Relevant debug output is:

02:51:44 DEBUG juju.cloudconfig.instancecfg instancecfg.go:782 Setting numa ctl preference to false
Waiting for address
Attempting to connect to 192.168.100.4:22
02:51:44 DEBUG juju.provider.common bootstrap.go:396 connection attempt for 192.168.100.4 failed: Warning: Permanently added '192.168.100.4' (ECDSA) to the list of known hosts.
/var/lib/juju/nonce.txt does not exist
02:51:49 DEBUG juju.provider.common bootstrap.go:396 connection attempt for 192.168.100.4 failed: /var/lib/juju/nonce.txt does not exist
02:51:56 INFO juju.cloudconfig userdatacfg_unix.go:346 Fetching agent: curl -sSfw 'tools from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s ' --retry 10 -o $bin/tools.tar.gz <[https://streams.canonical.com/juju/tools/agent/2.0.2/juju-2.0.2-xenial-amd64.tgz]>
02:51:56 DEBUG juju.utils.ssh ssh.go:292 using OpenSSH ssh client
sudo: unable to resolve host kind-gator: Connection timed out
Logging to /var/log/cloud-init-output.log on the bootstrap machine
Running apt-get update
Running apt-get upgrade
Installing curl, cpu-checker, bridge-utils, cloud-utils, tmux
Fetching Juju agent version 2.0.2 for amd64

It will hang forever here, until I kill the kvm instance.

The last chunk of lines in /var/log/cloud-init-output.log on the bootstrap node are:

Unpacking cloud-utils (0.27-0ubuntu24) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Setting up libiscsi2:amd64 (1.12.0-2) ...
Setting up distro-info (0.14build1) ...
Setting up genisoimage (9:1.1.11-3ubuntu1) ...
Setting up libaio1:amd64 (0.3.110-2) ...
Setting up libboost-iostreams1.58.0:amd64 (1.58.0+dfsg-5ubuntu3.1) ...
Setting up libboost-system1.58.0:amd64 (1.58.0+dfsg-5ubuntu3.1) ...
Setting up libboost-random1.58.0:amd64 (1.58.0+dfsg-5ubuntu3.1) ...
Setting up libboost-thread1.58.0:amd64 (1.58.0+dfsg-5ubuntu3.1) ...
Setting up libnspr4:amd64 (2:4.13.1-0ubuntu0.16.04.1) ...
Setting up sharutils (1:4.15.2-1) ...
Setting up libnss3-nssdb (2:3.28.4-0ubuntu0.16.04.2) ...
Setting up libnss3:amd64 (2:3.28.4-0ubuntu0.16.04.2) ...
Setting up librados2 (10.2.7-0ubuntu0.16.04.1) ...
Setting up librbd1 (10.2.7-0ubuntu0.16.04.1) ...
Setting up qemu-block-extra:amd64 (1:2.5+dfsg-5ubuntu10.15) ...
Setting up qemu-utils (1:2.5+dfsg-5ubuntu10.15) ...
Setting up cloud-image-utils...

Read more...

Revision history for this message
Andrew Wilkins (axwalk) wrote :

David, are you on the right bug? I don't see a connection between your comment and the bug description.

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.