From c2c01c0d47d32e99583273d3cb2df0a7253358e9 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 24 Oct 2013 13:39:19 +0200 Subject: main/lxc: add various fixes for alpine template and improve init.d messages ref #2293 --- ...add-hwaddr-for-a-single-macvlan-interface.patch | 36 ++++++++++++++++++++++ main/lxc/0001-lxc-alpine-allow-dev-full.patch | 33 ++++++++++++++++++++ ...1-lxc-alpine-enable-4-consoles-by-default.patch | 30 ++++++++++++++++++ ...pine-enable-loopback-interface-by-default.patch | 34 ++++++++++++++++++++ ...-run-bootmisc-and-syslog-at-boot-runlevel.patch | 33 ++++++++++++++++++++ main/lxc/APKBUILD | 30 +++++++++++++++--- main/lxc/lxc.initd | 8 ++--- 7 files changed, 196 insertions(+), 8 deletions(-) create mode 100644 main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch create mode 100644 main/lxc/0001-lxc-alpine-allow-dev-full.patch create mode 100644 main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch create mode 100644 main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch create mode 100644 main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch diff --git a/main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch b/main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch new file mode 100644 index 0000000000..432c86c341 --- /dev/null +++ b/main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch @@ -0,0 +1,36 @@ +From 75b5535282453b3442a41df4a3ba6d3058cd6e48 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 4 Sep 2013 17:01:09 +0200 +Subject: [PATCH] lxc-alpine: add hwaddr for a single macvlan interface + +We already add harware address for a single veth interface. Do the same +with a single macvlan interface. + +Signed-off-by: Natanael Copa +Signed-off-by: Serge Hallyn +--- + templates/lxc-alpine.in | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index 2ab10bb..05aec74 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -173,9 +173,11 @@ lxc.network.flags = up + EOF + fi + +- # if there is exactly one veth network entry, make sure it has an +- # associated mac address. +- nics=$(grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l) ++ # if there is exactly one veth or macvlan network entry, make sure ++ # it has an associated mac address. ++ nics=$(awk -F '[ \t]*=[ \t]*' \ ++ '$1=="lxc.network.type" && ($2=="veth" || $2=="macvlan") {print $2}' \ ++ $path/config | wc -l) + if [ "$nics" -eq 1 ] && ! grep -q "^lxc.network.hwaddr" $path/config; then + # see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303 + hwaddr="fe:$(dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \ +-- +1.8.4.1 + diff --git a/main/lxc/0001-lxc-alpine-allow-dev-full.patch b/main/lxc/0001-lxc-alpine-allow-dev-full.patch new file mode 100644 index 0000000000..5abbf22e6b --- /dev/null +++ b/main/lxc/0001-lxc-alpine-allow-dev-full.patch @@ -0,0 +1,33 @@ +From 6bd3f98c469f311f6afbffbb3586efddae3c4eb4 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Tue, 22 Oct 2013 13:23:31 +0200 +Subject: [PATCH] lxc-alpine: allow /dev/full + +The template creates /dev/full for the container but needs also give +permission to access it. + +Signed-off-by: Natanael Copa +Signed-off-by: Serge Hallyn +--- + templates/lxc-alpine.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index 5fdf36f..8600a34 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -197,9 +197,10 @@ lxc.cap.drop = sys_module mac_admin mac_override sys_time + + # devices + lxc.cgroup.devices.deny = a +-# /dev/null and zero ++# /dev/null, zero and full + lxc.cgroup.devices.allow = c 1:3 rwm + lxc.cgroup.devices.allow = c 1:5 rwm ++lxc.cgroup.devices.allow = c 1:7 rwm + # consoles + lxc.cgroup.devices.allow = c 5:1 rwm + lxc.cgroup.devices.allow = c 5:0 rwm +-- +1.8.4.1 + diff --git a/main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch b/main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch new file mode 100644 index 0000000000..c971a54101 --- /dev/null +++ b/main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch @@ -0,0 +1,30 @@ +From 11a944612ca93b8e39f6681c265c70e108f3caf2 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 24 Oct 2013 13:13:28 +0200 +Subject: [PATCH] lxc-alpine: enable 4 consoles by default + +We allow 4 consoles in the LXC config file so we can enable 4 in the +inittab as well. + +Signed-off-by: Natanael Copa +--- + templates/lxc-alpine.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index 2756b89..258eed4 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -103,6 +103,9 @@ configure_alpine() { + ::sysinit:/sbin/rc sysinit + ::wait:/sbin/rc default + tty1:12345:respawn:/sbin/getty 38400 tty1 ++tty2:12345:respawn:/sbin/getty 38400 tty2 ++tty3:12345:respawn:/sbin/getty 38400 tty3 ++tty4:12345:respawn:/sbin/getty 38400 tty4 + ::ctrlaltdel:/sbin/reboot + ::shutdown:/sbin/rc shutdown + EOF +-- +1.8.4.1 + diff --git a/main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch b/main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch new file mode 100644 index 0000000000..4d13d01248 --- /dev/null +++ b/main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch @@ -0,0 +1,34 @@ +From 3d460a3856376a043b3fa9addee50f89d21fa747 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 16 Oct 2013 14:55:31 +0200 +Subject: [PATCH] lxc-alpine: enable loopback interface by default +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It was probably disabled by a mistake + +Signed-off-by: Natanael Copa +Acked-by: Stéphane Graber +--- + templates/lxc-alpine.in | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index 05aec74..5fdf36f 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -110,9 +110,8 @@ EOF + grep nameserver /etc/resolv.conf > "$rootfs/etc/resolv.conf" + + # configure the network using the dhcp +- # note that lxc will set up lo interface + cat < $rootfs/etc/network/interfaces +-#auto lo ++auto lo + iface lo inet loopback + + auto eth0 +-- +1.8.4.1 + diff --git a/main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch b/main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch new file mode 100644 index 0000000000..a24abbb96b --- /dev/null +++ b/main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch @@ -0,0 +1,33 @@ +From d19e00ae49f654b90f26f4c7828f74ea1b664343 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 24 Oct 2013 08:13:34 +0200 +Subject: [PATCH] lxc-alpine: run bootmisc and syslog at boot runlevel + +The bootmisc script is needed to clean up various temp dirs like /tmp +and migrate /var/run to /run if needed. + +The syslog service is started in 'boot' runlevel when running on real +hardware so we do the same for containers. + +Signed-off-by: Natanael Copa +--- + templates/lxc-alpine.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index 8600a34..2756b89 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -140,7 +140,8 @@ EOF + mknod -m 666 "$rootfs/dev/ptmx" c 5 2 + + # start services +- ln -s /etc/init.d/syslog "$rootfs"/etc/runlevels/default/syslog ++ ln -s /etc/init.d/bootmisc "$rootfs"/etc/runlevels/boot/bootmisc ++ ln -s /etc/init.d/syslog "$rootfs"/etc/runlevels/boot/syslog + + return 0 + } +-- +1.8.4.1 + diff --git a/main/lxc/APKBUILD b/main/lxc/APKBUILD index a2b5e4d6b5..ed0b64c4a5 100644 --- a/main/lxc/APKBUILD +++ b/main/lxc/APKBUILD @@ -3,7 +3,7 @@ pkgname=lxc pkgver=0.9.0 _mypkgver=${pkgver/_rc/-rc} -pkgrel=5 +pkgrel=6 pkgdesc="linux containers - tools" url="http://lxc.sourceforge.net/" arch="all" @@ -19,6 +19,13 @@ source="http://linuxcontainers.org/downloads/lxc-$_mypkgver.tar.gz alpine-template-backport.patch 0001-lxc-alpine-create-dev-zero.patch 0002-lxc-alpine-add-arm.patch + + 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch + 0001-lxc-alpine-allow-dev-full.patch + 0001-lxc-alpine-enable-4-consoles-by-default.patch + 0001-lxc-alpine-enable-loopback-interface-by-default.patch + 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch + lxc-fix-headers.patch lxc.initd " @@ -62,21 +69,36 @@ e96514860ee34b62d1b208ab03c569bc bb-shutdown.patch 25dd200bd158d16a05bb3e7aaef84697 alpine-template-backport.patch e08b77b3b35adac290b49b9c9e04754c 0001-lxc-alpine-create-dev-zero.patch 181c01649399b2c2dbadab9713381358 0002-lxc-alpine-add-arm.patch +c57d7008ab6e7f652159a5f2856a343d 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch +ee3339a1c5d388b65b24bdea924387a8 0001-lxc-alpine-allow-dev-full.patch +c12ea194274b6c8d3b05bd43ed70c61d 0001-lxc-alpine-enable-4-consoles-by-default.patch +999a89373f5e2c61d1369526de7e5850 0001-lxc-alpine-enable-loopback-interface-by-default.patch +75979789ec45ef865895f5ce5721dd3e 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch 24e7ae51da3c8c483d5228b821cc7244 lxc-fix-headers.patch -4d248c3d47317d7f770963f07fcc1473 lxc.initd" +9f780f761dcaec3ce40d083c6df044d4 lxc.initd" sha256sums="1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120 lxc-0.9.0.tar.gz c9caea06b87baf5e335821c7e9ce3caca849b33f8176fbd48126c605583e78fc bb-rm.patch 0e5706cb077f750afdd6a5a4fd2afdf0b9113126c85e130d92680bed4ce9c20e bb-shutdown.patch df193c4cf08e171c23b0b472750b7b1e0e7a66971c03201a0523e4039909f33b alpine-template-backport.patch 8b3b314d99209ae27d78cd4e9469638a945d68d03beefaec499bad373a7cb8cd 0001-lxc-alpine-create-dev-zero.patch 415e28eae4d0611c899509835c70e82a06b2bae0b8f380b40de6eb0b5a039684 0002-lxc-alpine-add-arm.patch +526ed739247422e0d326d0892612bec520508763203136c620c3c1ee4a9329bf 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch +66c10a207380f5c0f1945ed6f6b1254c554b68127bc3729d7bf335137ab0750d 0001-lxc-alpine-allow-dev-full.patch +264cbc4efe6983050b3043fb4df031c4d9b93d35eb3c02463bddf530f8701880 0001-lxc-alpine-enable-4-consoles-by-default.patch +eb5043672ef81cd5b20f25dc847bfad7e9e14b42a794856c3a8c8c1e4e408dfc 0001-lxc-alpine-enable-loopback-interface-by-default.patch +51bd2fc5f166499c8996d1b89f324168b0c1bbb6b2b79260591d442120098a34 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch 82d584e30b1963bd638b5a640b2788d8ac3757b480f61fd2ab55a09b9a6f4ccd lxc-fix-headers.patch -ec036b358ead871b03709cc9d3ebecafcc722be19808d4225029b7bd386726dd lxc.initd" +8bdb64ecf100b648396456f6765230aab8649665bfcf320baede529ce6c5484d lxc.initd" sha512sums="a96133660ca6ea45dc4b8d167267120328577339e933ff9510f03e9d368ca5db77031dc1e7e4529b3e506f63f79c2ce3f8f72571a7dfdbeb2a8799777782a606 lxc-0.9.0.tar.gz b8fe47af6b1341ca472b6337c304f52402c53d400fc1d13895f2f568dd4d81b9ff281efc70bc1ddc221ac457db3bed4a199491059a15f66755deddc93ce91bf1 bb-rm.patch 86df52e380a01d6d3f588ca395925e8f774529c72e5b4c8dcb701d79fad7697ed8800f0ff51fded2896b2d2af49faa7f26960234fc8c1a6b4bc8f42d85078e6d bb-shutdown.patch d10e25aeee0aba61a4c3420fe1b2bfd9213e7ef10f399ed5f0ba5d978a97a49fd23044b098f73f6d9651c23b1bb025f30d81deb6aec9edf4d2267afc22a09d60 alpine-template-backport.patch 0304aabfac3280cbc18347f1168b2289a98e03b9f6a3134770e43bb914978a64a108a0b0ec709856db161e98366c06c8a65d5a30e730add4cee2968718cdc93a 0001-lxc-alpine-create-dev-zero.patch d1860b5a47303762ec82d65c2f2c6feaac0115aeb2ddaaf6c052085e9b8dc1d8f6bd05af1c8596c7c978391af75cbe97b38f98f37dd036d61bd9cea9b81226dd 0002-lxc-alpine-add-arm.patch +55c2a67eff5c90721de5949b21afc5aa77bf28323616f551beb4404cacfd0ba38cbb7d5046ed54d685414b5fdbbd5b5f20df9cb0c8ee2c0c12e48bd35866e033 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch +dd686d8ce9cd73807b744163e6b20e41eca17f3ee618cef66f19488cb2527b56d38c04231d25177de6295f2df224cd567add90e257dfa9d6be7f9a50f5c7bf21 0001-lxc-alpine-allow-dev-full.patch +372490dc5a459778e97b75691ed48b2c070c0a9b16f08c7f5ef3a791ded64fe5f23ca1e145314fea355664a2b055eb572546dd0793560137baae0898184c9e19 0001-lxc-alpine-enable-4-consoles-by-default.patch +47d31ed9d0cdde58b0ee97b3f179db270534b73fe8c77fe72fdef1483a545e608a533d41e8b4041474493016cd445fe02751663ad0cbc7fc9af241b344454dea 0001-lxc-alpine-enable-loopback-interface-by-default.patch +75130578c4103586b973c6e9586833acfa89de8021f4dd320385905c4f9d3d1bf7a1e8d3cfe8704a3add00d41d19c30a371bce232a863e9c837a148e9066a0d6 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch 2c4138e57021714d66bd4d30cfedd768965a0ec11776363b83db7d4efa8c06901c42ee1ad13dff68fd8e3e6a1c34034c529c1f8995d9d3a57a318bc7023fbc05 lxc-fix-headers.patch -4712cf4f20c0fb6040a806fc7996f19953e96c56d90c43a1f4af2f9a5be8c7a76b16872fa6dad63d20152795413b73d8492d614f15e20ea3d6760fbbd6855e0f lxc.initd" +e3aa39c60db6ba73cbe3fcb27170dd83a03a0a175d8a28513f242a81eef5cb0e90b78dc63fc8da5c7160e60bc780111679fd6d0e401a0d6626e574c328c5afb0 lxc.initd" diff --git a/main/lxc/lxc.initd b/main/lxc/lxc.initd index 31bfbd44ca..ae844872a5 100644 --- a/main/lxc/lxc.initd +++ b/main/lxc/lxc.initd @@ -58,7 +58,7 @@ start() { rootpath=$(lxc_get_var lxc.rootfs) checkpath -d ${pidfile%/*} - ebegin "Starting ${CONTAINER}" + ebegin "Starting container ${CONTAINER}" start-stop-daemon --start $command \ --pidfile $pidfile \ --wait 500 \ @@ -75,20 +75,20 @@ start() { stop() { checkconfig || return 1 - ebegin "Shutting down system in ${CONTAINER}" + ebegin "Shutting down system in container ${CONTAINER}" start-stop-daemon --stop --pidfile ${pidfile} \ --retry ${POWEROFF_SIGNAL:-SIGUSR2}/${TIMEOUT:-30} \ --progress eend $? - ebegin "Stopping ${CONTAINER}" + ebegin "Stopping containter ${CONTAINER}" lxc-stop -n ${CONTAINER} eend $? } reboot() { checkconfig || return 1 - ebegin "Sending reboot signal to $CONTAINER" + ebegin "Sending reboot signal to container $CONTAINER" start-stop-daemon --signal ${RESTART_SIG:-SIGTERM} \ --pidfile ${pidfile} eend $? -- cgit v1.2.3