[Lxc-users] Running XOrg in a container

Daniel Lezcano daniel.lezcano at free.fr
Mon Aug 23 13:27:15 UTC 2010


On 08/23/2010 03:01 PM, lxc at jelmail.com wrote:
>    
>>>
>>>        
>>>> 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).
>>>
>>> It should be adequate for what I want to do. I can already run multiple X
>>> servers on the host and switch between them (e.g. Alt-F7, Alt-F8). This
>>> works fine with no problems.
>>>
>>>        
>> Interesting, do you have any pointer explaining how to setup this ?
>>      
> Of the top of my head, the below should work, I’ll double check it tonight
> though.
>
> Log on to VT1 (Alt-F1)
>    $ startx -- vt7
>
> Log on to VT2 (Alt-F2)
>    $ startx -- vt8
>
> Access first desktop on vt7 (Alt-F7)
> Access second desktop on vt8 (Alt-F8)
>    


Thanks for info.

>>> What's stopping me doing that right now is the inability to configure
>>> access to /dev/mem which I think the container needs.
>>>
>>>        
>> Is it possible to copy the content of the host's /dev directory to the
>> container's /dev ?
>>
>> eg. cp -a /dev /var/lib/lxc/<name>/rootfs/dev
>>
>> and then run the container.
>>      
> I will try that tonight but I think cgroup device allow is needed to make
> such device files valid anyway. The problem I have right now is that a
> container will not start if either of the following two lines are present
> in its configuration file:
>
> lxc.cgroup.devices.allow = c 1:1   rwm  # dev/mem
> lxc.cgroup.devices.allow = c 13:63  rwm # dev/input/mice
>
> Is this some restriction imposed by LXC and/or the kernel (i.e. you can’t
> have /dev/mem in a cgroup) or is there something else that I am missing ?
>
> It would be good if someone can try adding the above to a working
> container’s configuration and confirm whether it stops working. It would be
> good to confirm it isn’t due to an error or omission that I have made.
>    
Ok, checked that your configuration lines have too many spaces in the 
fields and the kernel does not like this.
I suppose, the kernel should trim the spaces but anyway, that can be 
fixed in userspace ...

If you remove the extra spaces between dev minor:major and "rwm" that 
should work.

lxc.cgroup.devices.allow = c 1:1 rwm # dev/mem
lxc.cgroup.devices.allow = c 13:63 rwm # dev/input/mice

Thanks
-- Daniel







More information about the lxc-users mailing list