[Lxc-users] sudo: unable to resolve host..

Stéphane Graber stgraber at ubuntu.com
Fri Nov 16 16:43:04 UTC 2012


On 11/16/2012 11:32 AM, Rintcius Blok wrote:
> Yes sure. This is in a container called b.lxc:
> 
> ubuntu at b:~$ cat /etc/hosts
> 127.0.0.1 localhost
> 
> # The following lines are desirable for IPv6 capable hosts
> ::1 ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> ff02::3 ip6-allhosts
> 
> ubuntu at b:~$ cat /etc/hostname
> b.lxc

Ok, so the problem is that you don't have an entry for b.lxc in your
/etc/hosts.

Add an extra line (below the localhost one):
127.0.1.1   b.lxc

This should then silence sudo.

I remember writing code that does that in the ubuntu template, maybe the
ubuntucloud template is missing that code somehow or the sed magic fails
for hostnames containing a dot. Would have to check...

Can you file a bug about it at?
https://launchpad.net/ubuntu/+source/lxc/+filebug

Thanks

> On 16/11/12 14:41, Stéphane Graber wrote:
>> On 11/16/2012 09:26 AM, Serge Hallyn wrote:
>>> Quoting Rintcius Blok (rintcius at gmail.com):
>>>> Hi,
>>>>
>>>> I am getting messages like this with every "sudo" I do in the container:
>>>>
>>>> "sudo: unable to resolve host test.lxc"
>>>>
>>>> It happens with every container I create on 12.10 (with 12.10 container).
>>>>
>>>> Reproduction:
>>>>
>>>> lxc-create -t ubuntu-cloud -n test.lxc -- --auth-key
>>>> $HOME/.ssh/id_rsa.pub --userdata /root/my-userdata
>>>>
>>>> with a simple userdata file like this:
>>>>
>>>> #!/bin/sh
>>>> ifconfig eth0 > /ifconfig-eth0
>>>>
>>>>
>>>> It is easy to solve for me: just add the container name to /etc/hosts.
>>>> But I was wondering whether it would make sense to add it in a generic way?
>>> Hm, I don't get this, either on 12.04 or 12.10.
>>>
>>> -serge
>> Can you attach the content of /etc/hosts and /etc/hostname in the container?
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Monitor your physical, virtual and cloud infrastructure from a single
>> web console. Get in-depth insight into apps, servers, databases, vmware,
>> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
>> Pricing starts from $795 for 25 servers or applications!
>> http://p.sf.net/sfu/zoho_dev2dev_nov
>>
>>
>> _______________________________________________
>> Lxc-users mailing list
>> Lxc-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/lxc-users
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20121116/5e7f0de4/attachment.pgp>


More information about the lxc-users mailing list