[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:45:51 UTC 2012


Doh.  I was using the lxc tools that came with my Ubuntu Lucid 'apt-get install lxc'.  After sending my email I tried cloning the git repo from sourceforge, compiling from there, and now it just works.

From: Brent Tubbs <brent.tubbs at yougov.com<mailto:brent.tubbs at yougov.com>>
Date: Wed, 7 Nov 2012 06:04:27 +0000
To: "lxc-users at lists.sourceforge.net<mailto:lxc-users at lists.sourceforge.net>" <lxc-users at lists.sourceforge.net<mailto:lxc-users at lists.sourceforge.net>>
Subject: lxc-execute works from command line, but fails in Supervisor with "failed to mount the console"

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:imageb77dcd.png at e5c4ceeb.cd24419c]

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/7de1af02/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imageb77dcd.png at e5c4ceeb.cd24419c
Type: image/png
Size: 12846 bytes
Desc: imageb77dcd.png at e5c4ceeb.cd24419c
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20121107/7de1af02/attachment.png>


More information about the lxc-users mailing list