[libvirt-users] How can I run command in containers on the host?

How can I run command in containers on the host? Just like the lxc command lxc-attach. I run : virsh -c lxc:/// lxc-enter-namespace fedora2 --noseclabel /bin/ls but get error: libvirt: error : Expected at least one file descriptor error: internal error: Child process (14930) unexpected exit status 125 Here is my libvirt.xml <domain type='lxc'> <name>fedora2</name> <memory>190000</memory> <vcpu>2</vcpu> <cputune> <shares>1000</shares> </cputune> <os> <features> <privnet/> <capabilities policy='allow'> </capabilities> </features> <type>exe</type> <init>/sbin/init</init> </os> <devices> <filesystem type="mount"> <source dir="/home/lxc-fedora"></source> <target dir="/"></target> </filesystem> <console type='pty'/> <interface type='bridge'> <mac address='52:54:00:e8:96:88'/> <source bridge='virbr0'/> <target dev='vnet0'/> <guest dev='eth0'/> </interface> </devices> </domain> version of libvirt: Compiled against library: libvirt 1.2.9 Using library: libvirt 1.2.9 Using API: QEMU 1.2.9 Running hypervisor: QEMU 2.1.2 Is there any mistake? Thanks, John

On Tue, Jul 26, 2016 at 04:58:40PM +0800, John Y. wrote:
How can I run command in containers on the host? Just like the lxc command lxc-attach. I run : virsh -c lxc:/// lxc-enter-namespace fedora2 --noseclabel /bin/ls
but get error: libvirt: error : Expected at least one file descriptor error: internal error: Child process (14930) unexpected exit status 125
[snip]
Is there any mistake?
No, your example is correct. Can you try with LIBVIRT_DEBUG=1 virsh -c lxc:/// lxc-enter-namespace fedora2 --noseclabel /bin/ls so we can see if we get more useful debug info Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
John Y.