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

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

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

启动x -- vt8

我收到以下错误:

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

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

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

任何帮助都将不胜感激。到目前为止,我还无法在 16.04 主机上使用 lxc 和 nvidia 显卡。使用 14.04 容器时,我无法启动显卡;使用 16.04 容器时,我无法让键盘/鼠标工作。

答案1

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

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

在您的容器的 xorg 配置中 - 它不适用于 ubuntu 16.04。

event*相反,您应该使用 evdev 配置 xorg 输入。由于配置文件中的确切条目数(例如/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

结果是这样的: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

相关内容