6

In the process of trying to have lxc container (host 16.04, lxc 14.04) share nvidia I run into this error when starting X in the container:

startx -- vt8

I get the following error:

xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)

also I get the following warning in /var/log/Xorg.0.log:

(WW) NVIDIA(0): Unable to get display device for DPI computation.

Any help will be appreciated. So far I have not been able to used lxc and nvidia graphics with 16.04 host. with 14.04 container I cannot get the graphics to start with 16.04 container I cannot get the keyboard/mouse to work.

user63726
  • 764

1 Answers1

1

I had the same problem, so here is the solution. The reason the keyboard/mouse don't work inside the ubuntu 16.04 LXC container is that the xserver-xorg-input-kbd package was dropped, so if you used something like

...
Driver "kbd"
...
Driver "mouse"
...

in your container's xorg configuration - it would not work on ubuntu 16.04.

Instead you should configure xorg inputs with evdev. Since the exact number of event* entries in the configuration file (e.g. /usr/share/X11/xorg.conf.d/10-lxc-input.conf) will depend on what is in your container's /dev/input/, you could use a script to generate one:

#!/bin/bash
cat >/usr/share/X11/xorg.conf.d/10-lxc-input.conf << _EOF_
Section "ServerFlags"
     Option "AutoAddDevices" "False"
EndSection
_EOF_

cd /dev/input
for input in event*
do
cat >> /usr/share/X11/xorg.conf.d/10-lxc-input.conf <<_EOF_
Section "InputDevice"
    Identifier "$input"
    Option "Device" "/dev/input/$input"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
_EOF_
done

Which results in something like: cat /usr/share/X11/xorg.conf.d/10-lxc-input.conf

Section "ServerFlags"
     Option "AutoAddDevices" "False"
EndSection
Section "InputDevice"
    Identifier "event0"
    Option "Device" "/dev/input/event0"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event1"
    Option "Device" "/dev/input/event1"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event10"
    Option "Device" "/dev/input/event10"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event11"
    Option "Device" "/dev/input/event11"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event12"
    Option "Device" "/dev/input/event12"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event13"
    Option "Device" "/dev/input/event13"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event14"
    Option "Device" "/dev/input/event14"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event2"
    Option "Device" "/dev/input/event2"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event3"
    Option "Device" "/dev/input/event3"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event4"
    Option "Device" "/dev/input/event4"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event5"
    Option "Device" "/dev/input/event5"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event6"
    Option "Device" "/dev/input/event6"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event7"
    Option "Device" "/dev/input/event7"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event8"
    Option "Device" "/dev/input/event8"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
Section "InputDevice"
    Identifier "event9"
    Option "Device" "/dev/input/event9"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection