slow game graphics in lxc container

I have a privileged lxc container running on Ubuntu 16.0.4 LTS.

I have noticed that the graphics of our game are very sluggish in container compared to when running on host directly.

Could anyone point a reference as to what could be the cause ?

So I ran glxgears application inside the container. Though the application ran fine but I saw the following info + errors on console:

libGL error: failed to open drm device: Permission denied
libGL error: failed to load driver: nouveau
4057 frames in 5.0 seconds = 811.356 FPS
4238 frames in 5.0 seconds = 847.557 FPS
4251 frames in 5.0 seconds = 850.081 FPS
4254 frames in 5.0 seconds = 850.743 FPS
4253 frames in 5.0 seconds = 850.431 FPS
4255 frames in 5.0 seconds = 850.949 FPS
4253 frames in 5.0 seconds = 850.450 FPS
4254 frames in 5.0 seconds = 850.733 FPS
4250 frames in 5.0 seconds = 849.960 FPS
4247 frames in 5.0 seconds = 849.254 FPS
4246 frames in 5.0 seconds = 849.129 FPS

1 Answer

I got it fixed. First, we have to make sure that the user inside lxc container belongs to the group video. To do this, do the following: ( assuming user is named ubuntu )

sudo usermod -a -G video ubuntu

Then, add the following in the container config file i.e. /var/lib/lxc/mk7i_container/config. My container name is mk7i_container.

#Video DRI
lxc.cgroup.devices.allow = c 226:* rwm
##/dev/dri mounts
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir

Now, restart the container. And the graphics should work fine.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like