[Lxc-users] lxc-execute works from command line, but fails in Supervisor with "failed to mount the console"
Brent Tubbs
brent.tubbs at yougov.com
Wed Nov 7 06:04:27 UTC 2012
Hello lxc users!
I'm working on an app deployment platform that uses Supervisor (http://supervisord.org/) to start/stop processes. I'd like to have apps run in lxc containers to limit their filesystem access (and in the future, other resource consumption). I've got a script to start an app in an lxc, and it works from a bash prompt , but when I run the same script from Supervisor I get this:
lxc-execute: failed to mount the console
lxc-execute: failed to setup the console for 'testlxc'
lxc-execute: failed to setup the container
(I get the same error whether using lxc-execute or lxc-start.)
Is it expected that some things that work from a console will fail when run non-interactively?
Here's a sample lxc config that exhibits the problem:
root at lucid64:/tmp# cat test.lxc
lxc.utsname = testlxc
lxc.mount.entry = /bin /tmp/testlxc/bin none bind 0 0
lxc.mount.entry = /dev /tmp/testlxc/dev none bind 0 0
lxc.mount.entry = /etc /tmp/testlxc/etc none bind 0 0
lxc.mount.entry = /lib /tmp/testlxc/lib none bind 0 0
lxc.mount.entry = /lib64 /tmp/testlxc/lib64 none bind 0 0
lxc.mount.entry = /opt /tmp/testlxc/opt none bind 0 0
lxc.mount.entry = /usr /tmp/testlxc/usr none bind 0 0
lxc.rootfs = /tmp/testlxc
This script works on the command line but fails in Supervisor:
root at lucid64:/tmp# cat start_ping.sh
#!/bin/bash
lxc-execute --name testlxc -f /tmp/test.lxc -- ping google.com
And in case it becomes relevant, here's the Supervisor "program" section that configures running the script:
[program:testlxc]
command=/tmp/start_ping.sh
autostart=true
autorestart=true
stdout_logfile=/tmp/ping.log
user=root
directory=/tmp/testlxc
redirect_stderr=true
Thank you for your help,
Brent
---------
Brent Tubbs
[cid:image88c9fa.png at d1801d38.13c9450e]
285 Hamilton Avenue
Suite #200
Palo Alto, CA 94301
brent.tubbs at yougov.com<mailto:brent.tubbs at yougov.com>
http://www.yougov.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20121107/e295f9da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image88c9fa.png at d1801d38.13c9450e
Type: image/png
Size: 12846 bytes
Desc: image88c9fa.png at d1801d38.13c9450e
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20121107/e295f9da/attachment.png>
More information about the lxc-users
mailing list