I was able to fix it and run glxgears in root mode. The problem was with
the xauth.

The host system already had xauth.The idea is to use the key of the already
trusted user, which in my case was manik on the host system.

Using command xauth list on host gave me the following output:

manik/unix:0  MIT-MAGIC-COOKIE-1  a4f6256398303725763c5595f404afbb

I am going to use the key in hex(right-most most entry above) in my root
user account inside container.

I installed xauth package in the container:

sudo apt-get install xauth

Inside root user prompt in container:

export DISPLAY=":0"
xauth add $DISPLAY . a4f6256398303725763c5595f404afbb

And now glxgears works fine in root mode.

> ---------- Forwarded message ----------
> From: Marat Khalili <m...@rqc.ru>
> To: lxc-users@lists.linuxcontainers.org
> Cc:
> Date: Thu, 22 Sep 2016 10:38:01 +0300
> Subject: Re: [lxc-users] can't run “glxgears” in root on lxc 2.0 container
> On 19/09/16 21:40, manik sheeri wrote:
>> However, after that I enter root mode via `sudo su` command.
>> And try to run glxgears, but I get the following error:
>>     No protocol specified
>>     Error: couldn't open display :0.0
>> Not sure why this error is coming. If user `ubuntu` runs x apps fine , I
>> expected root to do the same.
>> I saw this kind of error on a non-containerized machine. Try running
> glxgears the following way:
>> HOME=/home/Ubuntu glxgears
> Replace /home/Ubuntu with home directory of a user for which it is
> working. I don't know the proper fix, but it works as a workaround for me.
> Probably something related to X server authorization.
> --
> With Best Regards,
> Marat Khalili
> _______________________________________________
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
lxc-users mailing list

Reply via email to