[lxc-devel] [PATCH] fix possible 100% cpu loop by fedora template

Michael Adam obnox at samba.org
Fri Jan 2 20:19:50 UTC 2015


Another patch to the fedora template.

My f21 containers ran into a 100% cpu loop for systemd-journald.

Here is the explanation:
https://lists.linuxcontainers.org/pipermail/lxc-users/2014-October/007907.html

I have made the change to set lxc.kmsg = 0 in the generated
config if the release is using systemd.

Thanks for consideration,

Michael

-------------- next part --------------
From df7ca9966936bfcf4aa52a46dd39d594e0709ce1 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 2 Jan 2015 21:12:21 +0100
Subject: [PATCH] lxc-fedora: when using systemd, set lxc.kmsg = 0 in the
 config

This is to prevent systemd-journald to enter a 100% cpu loop.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-fedora.in | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 2123e69..adfaab2 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -1117,13 +1117,22 @@ lxc.include = @LXCTEMPLATECONFIG@/fedora.common.conf
 " >> $config_path/config
     fi
 
+    if [ "x$have_systemd" = "x1" ]; then
+        cat <<EOF >> $config_path/config
+lxc.autodev = 1
+lxc.kmsg = 0
+EOF
+    else
+        cat <<EOF >> $config_path/config
+lxc.autodev = 0
+EOF
+    fi
+
     # Append things which require expansion here...
     cat <<EOF >> $config_path/config
 lxc.arch = $arch
 lxc.utsname = $utsname
 
-lxc.autodev = $auto_dev
-
 # When using LXC with apparmor, uncomment the next line to run unconfined:
 #lxc.aa_profile = unconfined
 
@@ -1337,12 +1346,12 @@ if [ -z "$release" ]; then
     fi
 fi
 
-# Fedora 15 and above run systemd.  We need autodev enabled to keep
+# Fedora 15 and above run systemd.We need autodev enabled to keep
 # systemd from causing problems.
+# Also, kmsg must not be mapped to prevent a 100% cpu loop
+# in systemd-journald.
 if [ $release -gt 14 ]; then
-    auto_dev="1"
-else
-    auto_dev="0"
+    have_systemd="1"
 fi
 
 if [ "$(id -u)" != "0" ]; then
-- 
2.1.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150102/d4b2f3b0/attachment.sig>


More information about the lxc-devel mailing list