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 ?