[lxc-devel] ignore lxc.rootfs when using lxc-execute
Dwight Engen
dwight.engen at oracle.com
Mon Dec 17 20:34:15 UTC 2012
If you start a container with lxc-execute and you do specify a
configuration with lxc.rootfs set, then lxc attempts to open a console
for you and in so doing messes up the termio on /dev/tty. This leads to
the characters being typed not being echoed, and the error message
"lxc-execute: Input/output error - failed to read". For example:
lxc-execute -s lxc.rootfs=/ -n bashtest /bin/bash
The question is, is there a valid use case for lxc-execute + specifying
a rootfs? It seems like this is not really an intended use, and if not
I think the following patch should be considered. There is some
discussion in the bug mentioned below.
---
Subject: [PATCH] ignore lxc.rootfs when using lxc-execute
If lxc.rootfs is specified, lxc_create_console() will create a console for
the container and set its termio -echo expecting console_handler() to write
the characters. In the lxc-execute case, these writes fail with EPERM
(see https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/986956).
This change implements the last part of (2) from comment 6 of that bug,
namely to ignore the lxc.rootfs option when using lxc-execute. This makes it
so that lxc will not attempt to open the console, and thus not change
the termio of /dev/tty.
Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
src/lxc/execute.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/lxc/execute.c b/src/lxc/execute.c
index 99800d0..d84baae 100644
--- a/src/lxc/execute.c
+++ b/src/lxc/execute.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <stdlib.h>
+#include "conf.h"
#include "log.h"
#include "start.h"
@@ -137,5 +138,11 @@ int lxc_execute(const char *name, char *const argv[], int quiet,
if (lxc_check_inherited(conf, -1))
return -1;
+ if (conf->rootfs.path) {
+ WARN("rootfs not valid with lxc_execute, ignoring");
+ free(conf->rootfs.path);
+ conf->rootfs.path = NULL;
+ }
+
return __lxc_start(name, conf, &execute_start_ops, &args);
}
--
1.7.12.3
More information about the lxc-devel
mailing list