diff -Nru lxc-1.1.4/debian/changelog lxc-1.1.4/debian/changelog --- lxc-1.1.4/debian/changelog 2015-10-06 09:46:19.000000000 -0500 +++ lxc-1.1.4/debian/changelog 2015-10-23 19:30:02.000000000 -0500 @@ -1,3 +1,29 @@ +lxc (1.1.4-0ubuntu2~ppa3) wily; urgency=medium + + * if user had deleted /etc/default/lxc-net (intending to disable lxcbr0), + honor that by creating one which says not to use lxcbr0. + + -- Serge Hallyn Fri, 23 Oct 2015 19:29:23 -0500 + +lxc (1.1.4-0ubuntu2~ppa2) wily; urgency=medium + + * New version for ppa (fixes lxc-net not restarting on first upgrade from + 1.1.4-0ubuntu1) + + -- Serge Hallyn Fri, 23 Oct 2015 17:36:21 -0500 + +lxc (1.1.4-0ubuntu2~ppa1) wily; urgency=medium + + * update lxc-net init script to ensure it uses a unique subnet for lxcbr0. + (LP: #1509414) + * lxc-net init script - also move cleanup() definition as it was undefined + when called after failed dnsmasq. + * lxc.preinst: + - remove the code auto-creating /etc/default/lxc-net + - add code removing just the known-potentially-bad /etc/default/lxc-net + + -- Serge Hallyn Fri, 23 Oct 2015 10:26:57 -0500 + lxc (1.1.4-0ubuntu1) wily; urgency=medium * New upstream bugfix release (1.1.4) diff -Nru lxc-1.1.4/debian/lxc.preinst lxc-1.1.4/debian/lxc.preinst --- lxc-1.1.4/debian/lxc.preinst 2015-10-06 09:45:06.000000000 -0500 +++ lxc-1.1.4/debian/lxc.preinst 2015-10-23 19:27:42.000000000 -0500 @@ -2,70 +2,6 @@ set -e -write_lxc_net() -{ - local i=$1 - cat >> /etc/default/lxc-net << EOF -# Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your -# containers. Set to "false" if you'll use virbr0 or another existing -# bridge, or mavlan to your host's NIC. -USE_LXC_BRIDGE="true" - -# If you change the LXC_BRIDGE to something other than lxcbr0, then -# you will also need to update your /etc/lxc/default.conf as well as the -# configuration (/var/lib/lxc//config) for any containers -# already created using the default config to reflect the new bridge -# name. -# If you have the dnsmasq daemon installed, you'll also have to update -# /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon. -LXC_BRIDGE="lxcbr0" -LXC_ADDR="10.0.$i.1" -LXC_NETMASK="255.255.255.0" -LXC_NETWORK="10.0.$i.0/24" -LXC_DHCP_RANGE="10.0.$i.2,10.0.$i.254" -LXC_DHCP_MAX="253" -# Uncomment the next line if you'd like to use a conf-file for the lxcbr0 -# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have -# container 'mail1' always get ip address 10.0.3.100. -#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf - -# Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc -# domain. You can then add "server=/lxc/10.0.$i.1' (or your actual \$LXC_ADDR) -# to your system dnsmasq configuration file (normally /etc/dnsmasq.conf, -# or /etc/NetworkManager/dnsmasq.d/lxc.conf on systems that use NetworkManager). -# Once these changes are made, restart the lxc-net and network-manager services. -# 'container1.lxc' will then resolve on your host. -#LXC_DOMAIN="lxc" -EOF -} - -configure_lxcbr0() -{ - local i=3 - cat > /etc/default/lxc-net << EOF -# This file is auto-generated by lxc.postinst if it does not -# exist. Customizations will not be overridden. -EOF - # if lxcbr0 exists, keep using the same network - if ip addr show lxcbr0 > /dev/null 2>&1 ; then - i=`ip addr show lxcbr0 | grep "inet\>" | awk '{ print $2 }' | awk -F. '{ print $3 }'` - write_lxc_net $i - return - fi - # if no lxcbr0, find an open 10.0.a.0 network - for l in `ip addr show | grep "inet\>" |awk '{ print $2 }' | grep '^10\.0\.' | sort -n`; do - j=`echo $l | awk -F. '{ print $3 }'` - if [ $j -gt $i ]; then - write_lxc_net $i - return - fi - i=$((j+1)) - done - if [ $i -ne 254 ]; then - write_lxc_net $i - fi -} - migrate_auto() { echo "Migrating /etc/lxc/auto to lxc.auto.start config flag" @@ -99,10 +35,6 @@ case "${1}" in install|upgrade) - if [ ! -f /etc/default/lxc-net ]; then - configure_lxcbr0 - fi - if [ -d /etc/lxc/auto ]; then migrate_auto fi @@ -111,6 +43,23 @@ mkdir -p /etc/lxc/ echo "# USERNAME TYPE BRIDGE COUNT" > /etc/lxc/lxc-usernet fi + + # If we have the stock preinstalled /etc/default/lxc-net, then + # remove it so that lxc-net can recreate on startup. + if dpkg --compare-versions "$2" eq "1.1.4-0ubuntu1"; then + if [ -f /etc/default/lxc-net ]; then + sum="$(md5sum /etc/default/lxc-net | awk '{ print $1 }')" + if [ "$sum" = e3f08a54cbdd4ebff86207417f366e6e ]; then + found=0; for f in /sys/class/net/lxcbr0/lower*; do [ -d "$f" ] && found=$(($found+1)); done + if [ $found -eq 0 ]; then + invoke-rc.d lxc-net stop + fi + rm -f /etc/default/lxc-net + fi + else + echo "USE_LXC_BRIDGE=false" > /etc/default/lxc-net + fi + fi ;; abort-upgrade) ;; diff -Nru lxc-1.1.4/debian/patches/fix-lxcbr0-on-preinstall lxc-1.1.4/debian/patches/fix-lxcbr0-on-preinstall --- lxc-1.1.4/debian/patches/fix-lxcbr0-on-preinstall 1969-12-31 18:00:00.000000000 -0600 +++ lxc-1.1.4/debian/patches/fix-lxcbr0-on-preinstall 2015-10-23 15:29:41.000000000 -0500 @@ -0,0 +1,135 @@ +Index: lxc-1.1.4/config/init/common/lxc-net.in +=================================================================== +--- lxc-1.1.4.orig/config/init/common/lxc-net.in ++++ lxc-1.1.4/config/init/common/lxc-net.in +@@ -22,6 +22,96 @@ LXC_IPV6_MASK="" + LXC_IPV6_NETWORK="" + LXC_IPV6_NAT="false" + ++write_lxc_net() ++{ ++ local i=$1 ++ cat >> $distrosysconfdir/lxc-net << EOF ++# Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your ++# containers. Set to "false" if you'll use virbr0 or another existing ++# bridge, or mavlan to your host's NIC. ++USE_LXC_BRIDGE="true" ++ ++# If you change the LXC_BRIDGE to something other than lxcbr0, then ++# you will also need to update your /etc/lxc/default.conf as well as the ++# configuration (/var/lib/lxc//config) for any containers ++# already created using the default config to reflect the new bridge ++# name. ++# If you have the dnsmasq daemon installed, you'll also have to update ++# /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon. ++LXC_BRIDGE="lxcbr0" ++LXC_ADDR="10.0.$i.1" ++LXC_NETMASK="255.255.255.0" ++LXC_NETWORK="10.0.$i.0/24" ++LXC_DHCP_RANGE="10.0.$i.2,10.0.$i.254" ++LXC_DHCP_MAX="253" ++# Uncomment the next line if you'd like to use a conf-file for the lxcbr0 ++# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have ++# container 'mail1' always get ip address 10.0.3.100. ++#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf ++ ++# Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc ++# domain. You can then add "server=/lxc/10.0.$i.1' (or your actual \$LXC_ADDR) ++# to your system dnsmasq configuration file (normally /etc/dnsmasq.conf, ++# or /etc/NetworkManager/dnsmasq.d/lxc.conf on systems that use NetworkManager). ++# Once these changes are made, restart the lxc-net and network-manager services. ++# 'container1.lxc' will then resolve on your host. ++#LXC_DOMAIN="lxc" ++EOF ++} ++ ++configure_lxcbr0() ++{ ++ local i=3 ++ cat > $distrosysconfdir/lxc-net << EOF ++# This file is auto-generated by lxc.postinst if it does not ++# exist. Customizations will not be overridden. ++EOF ++ # if lxcbr0 exists, keep using the same network ++ if ip addr show lxcbr0 > /dev/null 2>&1 ; then ++ i=`ip addr show lxcbr0 | grep "inet\>" | awk '{ print $2 }' | awk -F. '{ print $3 }'` ++ write_lxc_net $i ++ return ++ fi ++ # if no lxcbr0, find an open 10.0.a.0 network ++ for l in `ip addr show | grep "inet\>" |awk '{ print $2 }' | grep '^10\.0\.' | sort -n`; do ++ j=`echo $l | awk -F. '{ print $3 }'` ++ if [ $j -gt $i ]; then ++ write_lxc_net $i ++ return ++ fi ++ i=$((j+1)) ++ done ++ if [ $i -ne 254 ]; then ++ write_lxc_net $i ++ fi ++} ++ ++update_lxcnet_config() ++{ ++ local i=3 ++ # if lxcbr0 exists, keep using the same network ++ if ip addr show lxcbr0 > /dev/null 2>&1 ; then ++ return ++ fi ++ # find an open 10.0.a.0 network ++ conflict=0 ++ for l in `ip addr show | grep "inet\>" |awk '{ print $2 }' | grep '^10\.0\.' | sort -n`; do ++ j=`echo $l | awk -F. '{ print $3 }'` ++ if [ "$LXC_ADDR" = "10.0.$j.1" ]; then ++ conflict=1 ++ fi ++ done ++ if [ $conflict -eq 0 ]; then ++ return ++ fi ++ # our LXC_NET conflicts with an existing interface. Probably first ++ # run after system install with package pre-install. Find a new subnet ++ configure_lxcbr0 ++ ++ # and re-load the newly created config ++ [ ! -f $distrosysconfdir/lxc-net ] || . $distrosysconfdir/lxc-net ++} ++ + [ ! -f $distrosysconfdir/lxc ] || . $distrosysconfdir/lxc + + use_iptables_lock="-w" +@@ -48,7 +138,18 @@ ifup() { + ip link set dev $1 up + } + ++cleanup() { ++ set +e ++ if [ "$FAILED" = "1" ]; then ++ echo "Failed to setup lxc-net." >&2 ++ stop force ++ fi ++} ++ + start() { ++ ++ [ ! -f $distrosysconfdir/lxc-net ] && update_lxcnet_config ++ + [ "x$USE_LXC_BRIDGE" = "xtrue" ] || { exit 0; } + + [ ! -f "${varrun}/network_up" ] || { echo "lxc-net is already running"; exit 1; } +@@ -59,14 +160,6 @@ start() { + + FAILED=1 + +- cleanup() { +- set +e +- if [ "$FAILED" = "1" ]; then +- echo "Failed to setup lxc-net." >&2 +- stop force +- fi +- } +- + trap cleanup EXIT HUP INT TERM + set -e + diff -Nru lxc-1.1.4/debian/patches/series lxc-1.1.4/debian/patches/series --- lxc-1.1.4/debian/patches/series 1969-12-31 18:00:00.000000000 -0600 +++ lxc-1.1.4/debian/patches/series 2015-10-23 14:57:48.000000000 -0500 @@ -0,0 +1 @@ +fix-lxcbr0-on-preinstall