John Y.
2016-Jul-26 08:58 UTC
[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
Daniel P. Berrange
2016-Jul-26 09:04 UTC
Re: [libvirt-users] How can I run command in containers on the host?
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 :|
Daniel P. Berrange
2016-Jul-26 10:20 UTC
Re: [libvirt-users] How can I run command in containers on the host?
On Tue, Jul 26, 2016 at 05:19:22PM +0800, John Y. wrote:> Hi Daniel, > > I forgot to tell you that I using mips64 fedora. Has any effect on this > case? > 2016-07-26 09:05:59.634+0000: 16406: debug : virDomainLxcEnterNamespace:131 > : dom=0xaaad4067c0, (VM: name=fedora2, > uuid=42b97e4d-54dc-41b4-b009-2321a1477a9a), nfdlist=0, fdlist=0xaaad4007c0, > noldfdlist=(nil), oldfdlist=(nil), flags=0 > libvirt: error : Expected at least one file descriptor > error: internal error: Child process (16406) unexpected exit status 125This is shows nfdlist=0, whicih means that virDomainLxcOpenNamespace didn't provide any file descriptors. This in turn seems to suggest that /proc/$PID/ns didn't contain any files. Is this perhaps a misconfiguration of the mips kernel. 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 :|