lxc nvidia 错误:xf86EnableIOPorts:无法为 I/O 设置 IOPL(不允许操作)

use*_*726 5 nvidia xorg evdev lxc

在尝试让 lxc 容器(主机 16.04,lxc 14.04)共享 nvidia 的过程中,我在容器中启动 X 时遇到了这个错误:

startx -- vt8

我收到以下错误:

xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)
Run Code Online (Sandbox Code Playgroud)

我还在 /var/log/Xorg.0.log 中收到以下警告:

(WW) NVIDIA(0): Unable to get display device for DPI computation.
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激。到目前为止,我还无法在 16.04 主机上使用 lxc 和 nvidia 图形。使用 14.04 容器时,我无法从 16.04 容器中获取图形 我无法使键盘/鼠标工作。

小智 1

我遇到了同样的问题,所以这是解决方案。键盘/鼠标在 ubuntu 16.04 LXC 容器内不起作用的原因是软件包xserver-xorg-input-kbd已被删除,所以如果您使用类似的东西

...
Driver "kbd"
...
Driver "mouse"
...
Run Code Online (Sandbox Code Playgroud)

在容器的 xorg 配置中 - 它在 ubuntu 16.04 上不起作用。

相反,您应该使用 evdev 配置 xorg 输入。由于event*配置文件中条目的确切数量(例如/usr/share/X11/xorg.conf.d/10-lxc-input.conf)将取决于容器中的内容/dev/input/,因此您可以使用脚本来生成一个:

#!/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
Run Code Online (Sandbox Code Playgroud)

结果如下: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
Run Code Online (Sandbox Code Playgroud)