[lxc-devel] [lxc/master] Fixes for SystemD in Arch Linux containers.
drkh5h on Github
lxc-bot at linuxcontainers.org
Sun May 8 19:53:21 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 632 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160508/1b842d7a/attachment.bin>
-------------- next part --------------
From ba03bd20a63ae83be377203c6a6c09b5453f524f Mon Sep 17 00:00:00 2001
From: "Aaron Marcher (drkhsh)" <info at nulltime.net>
Date: Sun, 8 May 2016 21:44:00 +0200
Subject: [PATCH] Fixes for SystemD in Arch Linux containers.
- Automatic disabling of SystemD services in Arch Linux containers which
do not work in containers (udev and mounting of /proc/sys/fs/binfmt_misc).
- Enabled autodev mode for Arch Linux containers to avoid conflicts of
SystemD and LXC in the /dev tree.
Signed-off-by: Aaron Marcher (drkhsh) <info [at] nulltime [dot] net>
---
config/templates/archlinux.common.conf.in | 6 ++++++
templates/lxc-archlinux.in | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/config/templates/archlinux.common.conf.in b/config/templates/archlinux.common.conf.in
index f869491..ceda82e 100644
--- a/config/templates/archlinux.common.conf.in
+++ b/config/templates/archlinux.common.conf.in
@@ -30,3 +30,9 @@ lxc.stopsignal=SIGRTMIN+14
# lxc.cap.drop = setpcap # big big login delays in Fedora 20 systemd
#
lxc.cap.drop = setfcap sys_nice sys_pacct sys_rawio
+
+# fixes for systemd in lxc containers
+lxc.autodev = 1
+lxc.pts = 1024
+lxc.kmsg = 0
+lxc.hook.autodev = /var/lib/lxc/${name}/autodev
diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in
index 8aa1d8d..818905c 100644
--- a/templates/lxc-archlinux.in
+++ b/templates/lxc-archlinux.in
@@ -10,6 +10,7 @@
# Authors:
# Alexander Vladimirov <alexander.idkfa.vladimirov at gmail.com>
# John Lane <lxc at jelmail.com>
+# Aaron Marcher (drkhsh) <info [at] nulltime [dot] net>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -107,6 +108,11 @@ sed -e 's/^ConditionPathExists=/# ConditionPathExists=/' \
sed -e 's/^ConditionPathIsReadWrite=\/proc\/sys\/$/ConditionPathIsReadWrite=\/proc\/sys\/net\//' \
-e 's/^ExecStart=\/usr\/lib\/systemd\/systemd-sysctl$/ExecStart=\/usr\/lib\/systemd\/systemd-sysctl --prefix net/' \
-i /usr/lib/systemd/system/systemd-sysctl.service
+# fixes for systemd in lxc container
+ln -s /dev/null /etc/systemd/system/systemd-udevd.service
+ln -s /dev/null /etc/systemd/system/systemd-udevd-control.socket
+ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket
+ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount
# initialize pacman keyring
pacman-key --init
pacman-key --populate archlinux
@@ -132,6 +138,15 @@ EOF
[ ${nttys:-0} -gt 6 ] && echo \
"You may want to modify container's /etc/securetty \
file to allow root logins on tty7 and higher"
+ # fixes for systemd in lxc container
+ cat << EOF > /var/lib/lxc/${name}/autodev
+#!/bin/bash
+cd ${LXC_ROOTFS_MOUNT}/dev
+mkdir net
+mknod net/tun c 10 200
+chmod 0666 net/tun
+EOF
+ chmod +x /var/lib/lxc/${name}/autodev
return 0
}
More information about the lxc-devel
mailing list