[lxc-users] can't run “glxgears” in root on lxc 2.0 container

manik sheeri sheeri185adidam at gmail.com
Mon Sep 19 18:40:41 UTC 2016


Hi,

Pardon me if the syntax of the email is incorrect. I am a newbie here.
Hope to learn from you experts.

I am facing some issues running glxgears app in root mode on lxc2.0
privileged container.

I am running lxc2.0 container(privileged) on Ubuntu 16.0.4LTS 32-bit.

Inside the container I installed `mesa-utils` that has the `glxgears` app.

my container config file `/var/lib/lxc/mk7i_container/config` is:

     Template used to create this container:
/usr/share/lxc/templates/lxc-download
    # Parameters passed to the template: --no-validate
    # For additional config options, please look at lxc.container.conf(5)

    # Uncomment the following line to support nesting containers:
    #lxc.include = /usr/share/lxc/config/nesting.conf
    # (Be aware this has security implications)


    # Distribution configuration
    lxc.include = /usr/share/lxc/config/ubuntu.common.conf
    lxc.arch = x86

    lxc.cgroup.devices.allow = c 1:1 rwm

    lxc.cgroup.devices.allow = c 130:* rwm
    lxc.cgroup.devices.allow = c 124:* rwm
    lxc.cgroup.devices.allow = c 122:* rwm
    lxc.cgroup.devices.allow = c 123:* rwm
    lxc.cgroup.devices.allow = c 126:* rwm
    lxc.cgroup.devices.allow = c 127:0 rwm
    lxc.cgroup.devices.allow = c 120:0 rwm

    # Container specific configuration
    lxc.rootfs = /var/lib/lxc/mk7i_container/rootfs
    lxc.rootfs.backend = dir
    lxc.utsname = mk7i_container

    # Network configuration
    lxc.network.type = veth
    lxc.network.link = lxcbr0
    lxc.network.flags = up
    lxc.network.hwaddr = 00:16:3e:c8:fd:1e

    #mounts for XServer DISPLAY
    lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
    lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none
bind,optional,create=dir
    lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file


To log in into the container as user 'Ubuntu', I am using the following
command:

    sudo lxc-console -n mk7i_container

After login, I set the `DISPLAY` env variable as:

    export DISPLAY=":0.0"

And run `glxgears` and it runs fine. I can see the Xwindow with gears
moving in it.

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.

Anyone know what's wrong here ?


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20160919/f9c1e8f4/attachment-0001.html>


More information about the lxc-users mailing list