[Lxc-users] Running XOrg in a container

Daniel Lezcano daniel.lezcano at free.fr
Mon Aug 23 02:05:12 UTC 2010


On 08/22/2010 09:44 PM, lxc at jelmail.com wrote:
> Hello, this is my first post here so please bear with me. I have been
> evaluating LXC over the past week and I am trying to set up a desktop
> environment inside a container that uses the host's hardware devices.
>
> Is what I am trying to do possible?
>    

With some tweaks that maybe possible, but IMHO it is not adequate.
Lxc is not like QEMU/KVM or Virtualbox, the hardware is not virtualized, 
so you may have conflicts with the differents X server because they will 
share the same hardware (eg. different resolutions in different containers).

I use ssh with X forwarding and that works like a charm.

Another solution, maybe to use a ltsp server within a container, so the 
different client will have their own desktop environment (these ones 
have to be diskless).

> I have read various things via google on the subject and believe that the
> container needs access to the graphics hardware device (in my case,
> /dev/nvidia0), /dev/input/mice and /dev/mem.
>
> I have been unable to set up access to the latter two via cgroups in the
> container configuration file and I have been unable to create device files
> in the container for them.
>
> lxc.cgroup.devices.allow = c 195:* rwm # dev/nvidia*
> lxc.cgroup.devices.allow = c 1:1   rwm # dev/mem
> lxc.cgroup.devices.allow = c 13:63  rwm # dev/input/mice
>
> If the last two are present, the container will not start. If I remove them
> then the container starts but I can't create the device files.
>
> $mknod /dev/mem c 1 1
> mknod: `/dev/mem': Operation not permitted
>
> Any advice of how to get X up and running from inside a container would be
> most welcome.
>    

You can try by commenting lxc.cgroup.* in your configuration file that 
will let you to create any devices within the container.

Hope that helps ...

   -- Daniel




More information about the lxc-users mailing list