
Is anyone using libvirt for lxc ? I am trying to do so and running into an issue. The system container starts fine with lxc tools and am able to connect to it. Here is the snippet of my xml file (rest is same as in http://libvirt.org/drvlxc.html) <devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/lxc/f12'/> <target dir='/'/> </filesystem> <interface type='bridge'> <mac address='52:54:00:82:87:64'/> <source bridge='br0'/> <target dev='tap0'/> </interface> <console type='pty'> <target port='0'/> </console> </devices> Am able to start the container but when I do console : virsh # console f12lxc Connected to domain f12lxc Escape character is ^] <<hangs here and I press enter, it destroys the domain>> virsh # Am running Fedora 12 with 2.6.32.10-90.fc12.i686. I changed target dev='tap0' to 'veth' and no change in the behavior. Please help. Thanks, Nirmal

Hi Nirmal, On Tue, Aug 3, 2010 at 10:30 AM, Nirmal Guhan <vavatutu@gmail.com> wrote:
Is anyone using libvirt for lxc ? I am trying to do so and running into an issue. The system container starts fine with lxc tools and am able to connect to it.
Here is the snippet of my xml file (rest is same as in http://libvirt.org/drvlxc.html)
<devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/lxc/f12'/> <target dir='/'/> </filesystem> <interface type='bridge'> <mac address='52:54:00:82:87:64'/> <source bridge='br0'/> <target dev='tap0'/> </interface> <console type='pty'> <target port='0'/> </console> </devices>
Am able to start the container but when I do console :
virsh # console f12lxc Connected to domain f12lxc Escape character is ^] <<hangs here and I press enter, it destroys the domain>> virsh #
Probably you set: <os> <type>exe</type> <init>/init</init> </os> right? If so, could you try "/bin/sh" instead of "/init"? ozaki-r
Am running Fedora 12 with 2.6.32.10-90.fc12.i686. I changed target dev='tap0' to 'veth' and no change in the behavior.
Please help.
Thanks, Nirmal
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On Tue, Aug 3, 2010 at 6:07 AM, Ryota Ozaki <ozaki.ryota@gmail.com> wrote:
Hi Nirmal,
On Tue, Aug 3, 2010 at 10:30 AM, Nirmal Guhan <vavatutu@gmail.com> wrote:
Is anyone using libvirt for lxc ? I am trying to do so and running into an issue. The system container starts fine with lxc tools and am able to connect to it.
Here is the snippet of my xml file (rest is same as in http://libvirt.org/drvlxc.html)
<devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/lxc/f12'/> <target dir='/'/> </filesystem> <interface type='bridge'> <mac address='52:54:00:82:87:64'/> <source bridge='br0'/> <target dev='tap0'/> </interface> <console type='pty'> <target port='0'/> </console> </devices>
Am able to start the container but when I do console :
virsh # console f12lxc Connected to domain f12lxc Escape character is ^] <<hangs here and I press enter, it destroys the domain>> virsh #
Probably you set: <os> <type>exe</type> <init>/init</init> </os> right? If so, could you try "/bin/sh" instead of "/init"?
Thanks. /bin/bash got me to console. But the init sequence for my container is different from the one started using lxc tools with /bin/bash. So I changed it to /sbin/init and now I can get the usual login prompt. Fun doesn't end there. Am prompted for login but the password is never accepted whereas I can login using the same password (as root) in the container started using lxc tools. So eventually am not able to login :-(
ozaki-r
Am running Fedora 12 with 2.6.32.10-90.fc12.i686. I changed target dev='tap0' to 'veth' and no change in the behavior.
Please help.
Thanks, Nirmal
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On Wed, Aug 4, 2010 at 2:28 AM, Nirmal Guhan <vavatutu@gmail.com> wrote:
On Tue, Aug 3, 2010 at 6:07 AM, Ryota Ozaki <ozaki.ryota@gmail.com> wrote:
Hi Nirmal,
On Tue, Aug 3, 2010 at 10:30 AM, Nirmal Guhan <vavatutu@gmail.com> wrote:
Is anyone using libvirt for lxc ? I am trying to do so and running into an issue. The system container starts fine with lxc tools and am able to connect to it.
Here is the snippet of my xml file (rest is same as in http://libvirt.org/drvlxc.html)
<devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/lxc/f12'/> <target dir='/'/> </filesystem> <interface type='bridge'> <mac address='52:54:00:82:87:64'/> <source bridge='br0'/> <target dev='tap0'/> </interface> <console type='pty'> <target port='0'/> </console> </devices>
Am able to start the container but when I do console :
virsh # console f12lxc Connected to domain f12lxc Escape character is ^] <<hangs here and I press enter, it destroys the domain>> virsh #
Probably you set: <os> <type>exe</type> <init>/init</init> </os> right? If so, could you try "/bin/sh" instead of "/init"?
Thanks. /bin/bash got me to console. But the init sequence for my container is different from the one started using lxc tools with /bin/bash. So I changed it to /sbin/init and now I can get the usual login prompt. Fun doesn't end there. Am prompted for login but the password is never accepted whereas I can login using the same password (as root) in the container started using lxc tools. So eventually am not able to login :-(
AFAIK libvirt still doesn't support /sbin/init as the init program. In my case, I write up and use a script of 'fake' init which sets up inside a container, e.g., assigning IP addresses, launching sshd, etc. The script eventually 'exec /bin/bash', then the shell is shown via virsh console. That's enough for my purpose. Note that libvirt lxc driver is a different implementation from lxc tools and doesn't use lxc tools internally. You may not be able to do what you are doing with lxc tools. Especially, the driver doesn't take aware of files and settings inside a container at all. You have to prepare them by yourself in advance. ozaki-r
ozaki-r
Am running Fedora 12 with 2.6.32.10-90.fc12.i686. I changed target dev='tap0' to 'veth' and no change in the behavior.
Please help.
Thanks, Nirmal
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

At Mon, 2 Aug 2010 18:30:03 -0700, Nirmal Guhan wrote:
Is anyone using libvirt for lxc ?
Yes, I am on, on F12. I have run into one or two issues though, so much so that I only boot with kernel 2.6.31.12-174.2.22.fc12.i686.PAE now. However, these issues may not affect you, and it's been a while so I can't remember what they were exactly.
Am able to start the container but when I do console :
virsh # console f12lxc Connected to domain f12lxc Escape character is ^] <<hangs here and I press enter, it destroys the domain>>
Hmm, when I had this issue I was not really able to get any useful diagnostic information from anywhere. I had to resort to starting with /bin/bash and bringing up everything manually - which is what I still do. Obviously, I hope this situation will be improved in the future! -- Robin

On Tue, Aug 3, 2010 at 7:17 AM, Robin Green <greenrd@greenrd.org> wrote:
At Mon, 2 Aug 2010 18:30:03 -0700, Nirmal Guhan wrote:
Is anyone using libvirt for lxc ?
Yes, I am on, on F12. I have run into one or two issues though, so much so that I only boot with kernel 2.6.31.12-174.2.22.fc12.i686.PAE now. However, these issues may not affect you, and it's been a while so I can't remember what they were exactly.
Am able to start the container but when I do console :
virsh # console f12lxc Connected to domain f12lxc Escape character is ^] <<hangs here and I press enter, it destroys the domain>>
Hmm, when I had this issue I was not really able to get any useful diagnostic information from anywhere. I had to resort to starting with /bin/bash and bringing up everything manually - which is what I still do. Obviously, I hope this situation will be improved in the future!
Hmm.. I can still get to login prompt (please see my other reply) but not beyond it yet. I was assuming libvirt for lxc uses lxc tools inturn. Is it not the case? How do I specify fstab mounts as I do using lxc tools? Please let me know.
-- Robin
participants (3)
-
Nirmal Guhan
-
Robin Green
-
Ryota Ozaki