[lxc-devel] [PATCH 2/2] Set kmsg to 0 by default
Serge Hallyn
serge.hallyn at ubuntu.com
Wed Jan 21 00:21:30 UTC 2015
Quoting Stéphane Graber (stgraber at ubuntu.com):
> It's now been proven over and over again that the symlink from /dev/kmsg
> to /dev/console is harmful for everything but upstart systems. As Ubuntu
> is now switching over to systemd too, lets switch the default.
>
> Upstart users wishing to see boot messages can always set lxc.kmsg = 1
> manually in their config (so long as they don't expect to then
> dist-upgrade the container to systemd succesfuly).
>
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> config/templates/archlinux.common.conf.in | 3 ---
> doc/lxc.container.conf.sgml.in | 4 ++--
> src/lxc/conf.c | 2 +-
> templates/lxc-debian.in | 6 ------
> templates/lxc-fedora.in | 14 --------------
> templates/lxc-oracle.in | 5 -----
> templates/lxc-sshd.in | 1 -
> 7 files changed, 3 insertions(+), 32 deletions(-)
>
> diff --git a/config/templates/archlinux.common.conf.in b/config/templates/archlinux.common.conf.in
> index 8dea976..693f2f4 100644
> --- a/config/templates/archlinux.common.conf.in
> +++ b/config/templates/archlinux.common.conf.in
> @@ -4,9 +4,6 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf
> # Allow for 6 tty devices by default
> lxc.tty = 6
>
> -# Disable kmsg
> -lxc.kmsg = 0
> -
> # Set the halt/stop signals
> lxc.haltsignal=SIGRTMIN+4
> lxc.stopsignal=SIGRTMIN+14
> diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in
> index 96d574f..a86b1e5 100644
> --- a/doc/lxc.container.conf.sgml.in
> +++ b/doc/lxc.container.conf.sgml.in
> @@ -674,7 +674,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> <refsect2>
> <title>Enable kmsg symlink</title>
> <para>
> - Enable creating /dev/kmsg as symlink to /dev/console. This defaults to 1.
> + Enable creating /dev/kmsg as symlink to /dev/console. This defaults to 0.
> </para>
> <variablelist>
> <varlistentry>
> @@ -683,7 +683,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> </term>
> <listitem>
> <para>
> - Set this to 0 to disable /dev/kmsg symlinking.
> + Set this to 1 to enable /dev/kmsg symlinking.
> </para>
> </listitem>
> </varlistentry>
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index f0b2242..10582ae 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -2523,7 +2523,7 @@ struct lxc_conf *lxc_conf_init(void)
> free(new);
> return NULL;
> }
> - new->kmsg = 1;
> + new->kmsg = 0;
> lxc_list_init(&new->cgroup);
> lxc_list_init(&new->network);
> lxc_list_init(&new->mount_list);
> diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
> index 0a3c402..8955363 100644
> --- a/templates/lxc-debian.in
> +++ b/templates/lxc-debian.in
> @@ -188,12 +188,6 @@ configure_debian_systemd()
> path=$1
> rootfs=$2
>
> - init="$(chroot ${rootfs} dpkg-query --search /sbin/init | cut -d : -f 1)"
> - if [ "$init" = "systemd-sysv" ]; then
> - # only appropriate when systemd is PID 1
> - echo 'lxc.kmsg = 0' >> "$path/config"
> - fi
> -
> # this only works if we have getty at .service to manipulate
> if [ -f ${rootfs}/lib/systemd/system/getty\@.service ]; then
> sed -e 's/^ConditionPathExists=/# ConditionPathExists=/' \
> diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
> index 36d22c5..5e7de80 100644
> --- a/templates/lxc-fedora.in
> +++ b/templates/lxc-fedora.in
> @@ -1117,12 +1117,6 @@ lxc.include = @LXCTEMPLATECONFIG@/fedora.common.conf
> " >> $config_path/config
> fi
>
> - if [ "x$have_systemd" = "x1" ]; then
> - cat <<EOF >> $config_path/config
> -lxc.kmsg = 0
> -EOF
> - fi
> -
> # Append things which require expansion here...
> cat <<EOF >> $config_path/config
> lxc.arch = $arch
> @@ -1344,14 +1338,6 @@ if [ -z "$release" ]; then
> fi
> fi
>
> -# 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
> - have_systemd="1"
> -fi
> -
> if [ "$(id -u)" != "0" ]; then
> echo "This script should be run as 'root'"
> exit 1
> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
> index 8ec02da..c35ac40 100644
> --- a/templates/lxc-oracle.in
> +++ b/templates/lxc-oracle.in
> @@ -480,11 +480,6 @@ EOF
> echo "lxc.cap.drop = setfcap setpcap" >>$cfg_dir/config
> fi
>
> - # don't create kmsg symlink as it causes journald to use 100% cpu
> - if [ $container_release_major = "7" ]; then
> - echo "lxc.kmsg = 0" >>$cfg_dir/config
> - fi
> -
> echo "# Networking" >>$cfg_dir/config
> # see if the network settings were already specified
> lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
> diff --git a/templates/lxc-sshd.in b/templates/lxc-sshd.in
> index 949c2ad..aa45c1d 100644
> --- a/templates/lxc-sshd.in
> +++ b/templates/lxc-sshd.in
> @@ -129,7 +129,6 @@ copy_configuration()
> cat <<EOF >> $path/config
> lxc.utsname = $name
> lxc.pts = 1024
> -lxc.kmsg = 0
> lxc.cap.drop = sys_module mac_admin mac_override sys_time
>
> # When using LXC with apparmor, uncomment the next line to run unconfined:
> --
> 1.9.1
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list