[libvirt-users] How to give access to /dev/tty

Hello, First I apologize because I sent this email on the lxc-users mailing by error. So sorry for the double message. I'm trying to run an X server inside a container. I was able to achieve this with lxc-tools (and that is why I mixed myself between the 2 lists) by setting the option lxc.tty = 4 that allows access to 4 tty. Now I want to use libvirt because my final goal is to create a container with GPU capabilities from Openstack (that uses libvirt). When I start an X server with "startx -- :1" in a container I have the error: Fatal server error: xf86OpenConsole: Cannot open /dev/tty0 (No such file or directory) I also tried with :2 and :3 but I still have the same error (except that the name of the log file changed between Xorg.{1,2,3}.log. I copied the xml file of my container at the end of the email. Thus my question is how can I give an access to /dev/tty0 to the container? Or maybe it is not the right way to start an X server in the container. Best regards, Guillaume <domain type='lxc' id='28247'> <name>lxcvm1</name> <uuid>d4014dfc-f4db-5791-c0d2-817547921ce1</uuid> <memory unit='KiB'>1048576</memory> <currentMemory unit='KiB'>1048576</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='x86_64'>exe</type> <init>/sbin/init</init> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/lib/libvirt/libvirt_lxc</emulator> <filesystem type='mount' accessmode='passthrough'> <source dir='/home/thouveng/virtualization/lxc/lxcvm1/rootfs'/> <target dir='/'/> </filesystem> <interface type='network'> <mac address='00:16:3e:3e:06:4d'/> <source network='default'/> <target dev='veth0'/> </interface> <console type='pty' tty='/dev/pts/2'> <source path='/dev/pts/2'/> <target type='lxc' port='0'/> <alias name='console0'/> </console> <console type='pty'> <source path='/dev/pts/6'/> <target type='lxc' port='1'/> <alias name='console1'/> </console> <console type='pty'> <source path='/dev/pts/7'/> <target type='lxc' port='2'/> <alias name='console2'/> </console> </devices> <seclabel type='none'/> </domain>

I made some others tests. To start the X server in the container I'm now using the command: $ xinit -- /usr/bin/X vt1 In my xorg.conf file I put the minimum to run the X server headless. I copied it at the end of this email. In the xml file of the container I have: <console type='pty'> <target type='lxc' port='0'/> </console> <console type='pty'> <target type='lxc' port='1'/> </console> So the error now is: Fatal server error: xf86OpenConsole: VT_ACTIVATE failed: Invalid argument This error occurs because the X server tried to do an ioctl(/dev/tty1, VT_ACTIVATE) on /dev/tty1 that is not a tty, it's a link to /dev/pts/0. I tried to reply type='lxc' by type='serial' but I got the same error. I think that if I can provide an access to the real /dev/tty1 I will be able to run the X server in the container... Can someone confirm me if it is possible to do it (I mean give an access to /dev/tty1 to the container) or if I'm going in the wrong direction to achieve my goal (that is to start a X server in the container (headless or not)? Thanks for your help, Regards, Guillaume

Guillaume Thouvenin <guillaume.thouvenin@polymtl.ca> a écrit :
Can someone confirm me if it is possible to do it (I mean give an access to /dev/tty1 to the container) or if I'm going in the wrong direction to achieve my goal (that is to start a X server in the container (headless or not)?
I'm still stuck on this problem. Does it make sense to add this feature in libvirt library? Thanks for your help, Regards, Guillaume

Hi Guillaume. I'm sure that if ou give 5 cents of exactly what do you want to achieve somebody can provide a solution: connect from the hypervisor to the VM through console? Administer the VM through a GUI? ... Regards. Javier El 02/04/2013 10:21, "Guillaume Thouvenin" <guillaume.thouvenin@polymtl.ca> escribió:
Guillaume Thouvenin <guillaume.thouvenin@polymtl.**ca<guillaume.thouvenin@polymtl.ca>> a écrit :
Can someone confirm me if it is possible to do it (I mean give an access
to /dev/tty1 to the container) or if I'm going in the wrong direction to achieve my goal (that is to start a X server in the container (headless or not)?
I'm still stuck on this problem. Does it make sense to add this feature in libvirt library?
Thanks for your help, Regards,
Guillaume
______________________________**_________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/**mailman/listinfo/libvirt-users<https://www.redhat.com/mailman/listinfo/libvirt-users>

Javi Legido <javi@legido.com> a écrit :
I'm sure that if ou give 5 cents of exactly what do you want to achieve somebody can provide a solution: connect from the hypervisor to the VM through console? Administer the VM through a GUI? ...
Hi Javi, I'd like to run an X server in the container. My GPU card has two GPUs so I'd like run run one container with access to /dev/nvidia0 and the other one with access to /dev/nvidia1. As I want to use X rendering I need to start an X server in the container and I will access to this server through TurboVNC/VirtualGL. The problem is that if I start an X server within the container by using xinit command I get the error: Fatal server error: xf86OpenConsole: VT_ACTIVATE failed: Invalid argument I think that I have this error because with libvirt, /dev/ttyX is a link to /dev/pts/X. Currently I only try to start X server on /dev/tty1 on my laptop without GPU but my final goal is to do it on a machine that has GPU. I hope that I give a more clear picture of my goal :) Regards, Guillaume

Guillaume Thouvenin <guillaume.thouvenin@polymtl.ca> a écrit :
I hope that I give a more clear picture of my goal :) Regards,
And one example of usage is that two people can connect to my machine (each of them on a container) and play a game like extreme tuxracer on their laptop. Regards, Guillaume

On 2013/04/02 17:38, Guillaume Thouvenin wrote:
Javi Legido <javi@legido.com> a écrit :
I'm sure that if ou give 5 cents of exactly what do you want to achieve somebody can provide a solution: connect from the hypervisor to the VM through console? Administer the VM through a GUI? ...
Hi Javi,
I'd like to run an X server in the container. My GPU card has two GPUs so I'd like run run one container with access to /dev/nvidia0 and the other one with access to /dev/nvidia1. As I want to use X rendering I need to start an X server in the container and I will access to this server through TurboVNC/VirtualGL.
The problem is that if I start an X server within the container by using xinit command I get the error:
Fatal server error: xf86OpenConsole: VT_ACTIVATE failed: Invalid argument
I think that I have this error because with libvirt, /dev/ttyX is a link to /dev/pts/X. Currently I only try to start X server on /dev/tty1 on my laptop without GPU but my final goal is to do it on a machine that has GPU.
I hope that I give a more clear picture of my goal :) Regards, Guillaume
I haven't used x windows in my container. If you want use /dev/tty of host in container. Please have a try as below cat device.xml <hostdev mode='capabilities' type='misc'> <source> <char>/dev/tty</char> </source> </hostdev> You can use virsh cmd "attach-device domainname device.xml" to hot plug this tty device to the container. You can add the xml into configure file too.

On Fri, Mar 29, 2013 at 11:04:25AM +0100, Guillaume Thouvenin wrote:
I made some others tests. To start the X server in the container I'm now using the command:
$ xinit -- /usr/bin/X vt1
In my xorg.conf file I put the minimum to run the X server headless. I copied it at the end of this email. In the xml file of the container I have:
<console type='pty'> <target type='lxc' port='0'/> </console> <console type='pty'> <target type='lxc' port='1'/> </console>
So the error now is:
Fatal server error: xf86OpenConsole: VT_ACTIVATE failed: Invalid argument
This error occurs because the X server tried to do an ioctl(/dev/tty1, VT_ACTIVATE) on /dev/tty1 that is not a tty, it's a link to /dev/pts/0.
From your later posts, you'd also need to use this syntax to pass
Yep, the consoles you get available inside a container are not real Linux virtual consoles, so X is not going to be happy with them. Instead of using a <console> element, you'll need to pass through the real console device using: <hostdev mode='capabilities' type='misc'> <source> <char>/dev/tty1</char> </source> </hostdev> NB, this requires libvirt >= 1.0.1 to work through /dev/nvidida1 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 (4)
-
Daniel P. Berrange
-
Gao feng
-
Guillaume Thouvenin
-
Javi Legido