[lxc-users] Is this a bug

Björn Mittelsdorf bjoern.mittelsdorf at scheer-management.com
Mon Apr 20 09:43:07 UTC 2015


Hi Serge, 
hi Yonsi,
hi all,

I am using lxc version 1.0.7

	ii  liblxc1                             1.0.7-0ubuntu0.1                      amd64        Linux Containers userspace tools (library)
	ii  lxc                                 1.0.7-0ubuntu0.1                      amd64        Linux Containers userspace tools

If I am not mistaken the hook file only looks for files below /etc/sysconfig.
Thus /etc/hosts cannot be found, actually there is no folder /etc/sysconfig at all on my HOST

	bjmi at fa04:~$ ls -lthr /etc | grep sys
		-rw-r--r--  1 root root   1,3K Aug 19  2014 rsyslog.conf
		drwxr-xr-x  2 root root   4,0K Jan 24 23:02 rsyslog.d
		drwxr-xr-x  2 root root   4,0K Mär  2 14:14 sysctl.d
		drwxr-xr-x  3 root root   4,0K Mär  2 14:14 systemd
		-rw-r--r--  1 root root   2,4K Mär  4 10:43 sysctl.conf

I looked again for OS:
	bjmi at fa04:~$ lsb_release -a
	No LSB modules are available.
	Distributor ID:	Ubuntu
	Description:	Ubuntu 14.04.2 LTS
	Release:	14.04
	Codename:	trusty

I do not know if it can be seen in this info, that it is a server edition ubuntu.

# Note that /etc/hostname is updated by lxc itself
for file in \
    $LXC_ROOTFS_PATH/etc/sysconfig/network \
    $LXC_ROOTFS_PATH/etc/sysconfig/network-scripts/ifcfg-* ;
do
    if [ -f $file ]; then
        sed -i "s|$LXC_SRC_NAME|$LXC_NAME|" $file
    fi
done
exit 0

I guess the solution would be to add "$LXC_ROOTFS_PATH/etc/hosts" and "$LXC_ROOTFS_PATH/etc/network/interfaces" to the in-statement.
But I am not certain that I understood all of it :-)

Best regards

Björn

> > in Ubuntu trusty a clone of an Ubuntu container gets a new hostname but
> the line containing the hostname in /etc/hosts is not updated.
> > This results in error messages when using sudo or similar stuff.


> 
> This is supposed to be handled by
> 
> /usr/share/lxc/config/common.conf
> 
> which has a line:
> 
> lxc.hook.clone = /usr/share/lxc/hooks/clonehostname
> 
> which does update /etc/hosts.
> 



More information about the lxc-users mailing list