Public bug reported: LXC 2.x behaved like this when cloning containers: it wrote the new hostname into /etc/hostname of the new container, and changed /etc/hosts accordingly. LXC 3.0.0.beta3 no longer does it.
root@zh1cn:/var/lib/lxc# lxc-create -t download -n ubuntu-1604-new -- -d ubuntu -a amd64 -r xenial Setting up the GPG keyring Downloading the image index Downloading the rootfs Downloading the metadata The image cache is now ready Unpacking the rootfs --- You just created an Ubuntu container (release=xenial, arch=amd64, variant=default) To enable sshd, run: apt-get install openssh-server For security reason, container images ship without user accounts and without a root password. Use lxc-attach or chroot directly into the rootfs to set a root password or create user accounts. root@zh1cn:/var/lib/lxc# cat ubuntu-1604-new/config # Template used to create this container: /usr/share/lxc/templates/lxc-download # Parameters passed to the template: -d ubuntu -a amd64 -r xenial # Template script checksum (SHA-1): 5f6cea9c51537459a7ab5f81e2c1eac6a94b5e08 # For additional config options, please look at lxc.container.conf(5) # Uncomment the following line to support nesting containers: #lxc.include = /usr/share/lxc/config/nesting.conf # (Be aware this has security implications) # Distribution configuration lxc.include = /usr/share/lxc/config/common.conf lxc.arch = x86_64 # Container specific configuration lxc.rootfs.path = dir:/var/lib/lxc/ubuntu-1604-new/rootfs lxc.uts.name = ubuntu-1604-new # Network configuration lxc.net.0.type = veth lxc.net.0.link = lxcbr0 lxc.net.0.flags = up lxc.net.0.hwaddr = 00:16:3e:65:85:6b root@zh1cn:/var/lib/lxc# cat ubuntu-1604-new/rootfs/etc/hostname ubuntu-1604-new root@zh1cn:/var/lib/lxc# lxc-copy -n ubuntu-1604-new -N ubuntu-1604-new1 root@zh1cn:/var/lib/lxc# cat ubuntu-1604-new1/config # Template used to create this container: /usr/share/lxc/templates/lxc-download # Parameters passed to the template: -d ubuntu -a amd64 -r xenial # Template script checksum (SHA-1): 5f6cea9c51537459a7ab5f81e2c1eac6a94b5e08 # For additional config options, please look at lxc.container.conf(5) # Uncomment the following line to support nesting containers: #lxc.include = /usr/share/lxc/config/nesting.conf # (Be aware this has security implications) # Distribution configuration lxc.include = /usr/share/lxc/config/common.conf lxc.arch = x86_64 # Container specific configuration # Network configuration lxc.net.0.type = veth lxc.net.0.link = lxcbr0 lxc.net.0.flags = up lxc.net.0.hwaddr = 00:16:3e:ec:9a:54 lxc.rootfs.path = dir:/var/lib/lxc/ubuntu-1604-new1/rootfs lxc.uts.name = ubuntu-1604-new1 root@zh1cn:/var/lib/lxc# cat ubuntu-1604-new1/rootfs/etc/hostname ubuntu-1604-new I would expect ubuntu-1604-new1 here, or maybe no such file at all (so that lxc.uts.name applies from the config). ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: lxc 3.0.0~beta3-0ubuntu1 ProcVersionSignature: Ubuntu 4.15.0-12.13-generic 4.15.7 Uname: Linux 4.15.0-12-generic x86_64 ApportVersion: 2.20.9-0ubuntu1 Architecture: amd64 Date: Tue Mar 27 19:21:21 2018 InstallationDate: Installed on 2018-01-25 (61 days ago) InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Alpha amd64 (20180120) PackageArchitecture: all ProcEnviron: LANG=en_US.UTF-8 TERM=xterm SHELL=/bin/bash PATH=(custom, no user) SourcePackage: lxc UpgradeStatus: No upgrade log present (probably fresh install) defaults.conf: lxc.net.0.type = veth lxc.net.0.link = lxcbr0 lxc.net.0.flags = up lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx ** Affects: lxc (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apparmor apport-bug bionic ** Attachment removed: "JournalErrors.txt" https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1759247/+attachment/5092115/+files/JournalErrors.txt ** Attachment removed: "KernLog.txt" https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1759247/+attachment/5092116/+files/KernLog.txt ** Attachment removed: "dnsmasq.conf.txt" https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1759247/+attachment/5092119/+files/dnsmasq.conf.txt ** Attachment removed: "lxcsyslog.txt" https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1759247/+attachment/5092122/+files/lxcsyslog.txt -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1759247 Title: lxc-copy forgets to change /etc/hostname and /etc/hosts To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1759247/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs