[lxc-users] lxc-execute

Serge Hallyn serge.hallyn at ubuntu.com
Mon Feb 8 03:10:21 UTC 2016


Quoting Király, István (laking at d250.hu):
> Hello list, ..
> 
> I thought I understand lxc-execute, but I could use some clarification.
> 
> So I run a command, like /bin/bash or /bin/mc ... and get some errors.
> 
> lxc-execute: utils.c: open_without_symlink: 1626 No such file or directory
> - Error examining fuse in /usr/lib64/lxc/rootfs/sys/fs/fuse/connections
> init.lxc: initutils.c: mount_fs: 36 failed to mount /proc : Device or
> resource busy
> init.lxc: initutils.c: mount_fs: 36 failed to mount /dev/shm : No such file
> or directory
> 
> From a question on github:
> 
> It's expected that the command in question be able to act as an init system
> 
> I thought I can just execute commands on a stopped container, lxc-init
> creates an init process which sets up the minimal container process
> environment and then executes a command, and the processes it spawns. ...
> 
> So my question is what commands qualify for lxc-execute?
> 
> What is the purpose of lxc-execute?
> 
> Can I run a command eg, apache or mc so that I only run the processes it
> needs and not the full container OS?

In general yes.  lxc-execute as you said should run it under lxc-init,
and it should be mounting /proc for your containerized task.  However
if the rootfs in the container depends on the distribution init to
mount things for the application,  that of course won't get done. 

Your specific errors come from the fact that your container config is
sourcing things like /usr/share/lxc/config/common.conf which set things
up which you don't need anyway, but which are needed for full container
boot.  You should be able to work around these by customizing your
container configuration (perhaps keeping a second container config
specificaly for use with 'lxc-execute -f <custom-conf> -n container -- /bin/bash'


More information about the lxc-users mailing list