[Lxc-users] GUI container

Christoph Willing c.willing at uq.edu.au
Thu Dec 16 23:17:29 UTC 2010


On 17/12/2010, at 6:06 AM, Nirmal Guhan wrote:

> On Fri, Dec 10, 2010 at 2:40 PM, Christoph Willing <c.willing at uq.edu.au 
> > wrote:
>>
>> On 11/12/2010, at 1:04 AM, Matto Fransen wrote:
>>
>>> Hi,
>>>
>>> On Thu, Dec 09, 2010 at 10:21:49PM -0800, Nirmal Guhan wrote:
>>>
>>>> Has anyone tried running a GUI app (firefox for instance) inside a
>>>> container or as an application container? Just want to know if this
>>>> requires any special steps before I tread that path. Am using  
>>>> Fedora
>>>> 12 for both host and container.
>>>>
>>>
>>> It is no problem to run GUI apps in a container.
>>> I have set up one of my containers as an X-server. From an
>>> old laptop I do "X -query <ip-number> and run the window-manager
>>> that is installed on the container.
>>>
>>> You can use ssh -X to log in into the container and start
>>> your X-app.
>>
>>
>> Most of my containers are without X (run level 3). When I have one  
>> that
>> needs a X environment I start an Xvfb with a simple window manager  
>> (mwm)
>> using a boot script. When I need gui type access to it, I run  
>> x11vnc in the
>> container and access that environment from anywhere with vncviewer.
>>
>
> Do I need to start container with X (level 5?).

No need for that since we're starting our own Xvfb


> I tried these steps :
> 1. Start container in level 3.
> 2.  lxc-console into container
> 3. Run Xvfb (that returned error as)
> #Xvfb :0 -screen 0 1024x768x16 -ac &
> SELinux: Invalid object class mapping, disabling SELinux support.
> (EE) AIGLX error: dlopen of /usr/lib/dri/swrast_dri.so failed
> (/usr/lib/dri/swrast_dri.so: cannot open shared object file: No such
> file or directory)
> (EE) GLX: could not load software renderer
> 4. Run mwm
> # mwm
> Error: Can't open display: 0.0

If Xvfb hasn't started (as above) then mwm can't run. - there is no  
display to open.


> I have set display to 0.0
>
> If I start Xvfb with no options I still get the above errors.
>
> Any idea on what I am missing?


I don't have SELinux to contend with; you'll have to fix that first.

Here is the script I use which runs at boot time. The apps are all run  
as an ordinary user "ag". I use display :1 out of habit (after testing  
on machines where there is already an existing :0) but you can choose  
anything reasonable.


# Commands to provide display environment for AGServiceManager & vic
#
su -c '/usr/bin/Xvfb :1 -screen 0 1024x768x24' ag &
su -c '/usr/bin/mwm -display :1' ag &

# Run the service manager as user 'ag'
#
su -c 'DISPLAY=:1 /usr/bin/AGServiceManager3.py -d' ag &


Thats enough to run what I need in that container without further  
input from me. If I do want to use that X environment remotely for  
some reason, I ssh as user ag (or lxc-console and su - ag) into the  
container and run:
     x11vnc -rfbauth /home/ag/.vnc/passwd -display :1 &
(assumes you've previously set up a vnc password)
and then from a remote machine, run:
     vncviewer conatiner_ip_addr:0


chris


Christoph Willing                       +61 7 3365 8316
QCIF Access Grid Manager
University of Queensland





More information about the lxc-users mailing list