** Description changed: + =============================== + SRU Justification: + 1. Impact: lxc-start-ephemeral does not update hostname for fedora containers + 2. Development fix: add the necessary files (/etc/sysconfig/) for fedora hosts to the list of files to be updated. + 3. Stable fix: same as development fix. + 4. test case: create a fedora container, then start an ephemeral one based on it: + lxc-create -t fedora -n f14 + lxc-start-ephemeral -o f14 + and check its hostname + 5. Regression potential: none - we only attempt updates if the file exists. + =============================== As discussed in the thread "lxc template for RHEL?" http://sourceforge.net/mailarchive/message.php?msg_id=29730103 lxc-start-ephemeral only knows how to tweak the hostname for ubuntu and debian, and needs to be taught about where rhel and centos put hostname, something like this: --- lxc-start-ephemeral.orig 2012-08-27 12:19:03.935513119 -0700 +++ lxc-start-ephemeral 2012-08-27 12:19:54.471514479 -0700 @@ -154,7 +154,19 @@ - LXC_MOUNTED=1 + LXC_MOUNTED=1 - # Update the ephemeral lxc's configuration to reflect the new + # Update the ephemeral lxc's configuration to reflect the new container name. - sudo sed -i -e "s/$LXC_BASE/$LXC_NAME/" $LXC_DIR/fstab $LXC_DIR/config $LXC_DIR/rootfs/etc/hostname $LXC_DIR/rootfs/etc/hosts + # Check all the places known distros keep hostnames. + # FIXME: should we sanity check the hostname to make sure it contains no bad chars? + for file in $LXC_DIR/fstab $LXC_DIR/config \ + $LXC_DIR/rootfs/etc/hostname \ + $LXC_DIR/rootfs/etc/hosts \ + $LXC_DIR/rootfs/etc/sysconfig/network \ + $LXC_DIR/rootfs/etc/sysconfig/network-scripts/ifcfg-eth0 + do + if test -f "$file" + then + sudo sed -i -e "s/$LXC_BASE/$LXC_NAME/" $file + fi + done - # Update the fstab to have all bind mounts be ephemeral. - sudo cp $LXC_DIR/fstab $LXC_DIR/fstab.old + # Update the fstab to have all bind mounts be ephemeral. + sudo cp $LXC_DIR/fstab $LXC_DIR/fstab.old This affects 12.04 and the ppa for lxc, so probably also 12.10 alpha 3.
** Changed in: lxc (Ubuntu Precise) Status: New => In Progress ** Changed in: lxc (Ubuntu Precise) Importance: Undecided => Medium -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to lxc in Ubuntu. https://bugs.launchpad.net/bugs/1042431 Title: lxc-start-ephemeral needs tweak to handle centos and fedora hostname setting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1042431/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs