我有 2 个 VGA 选项:
lspci | grep VGA
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 VGA compatible controller: NVIDIA Corporation GK104GL [GRID K520] (rev a1)
这是在 Amazon EC2 上运行的 Ubuntu 实例。
当我打开 xserver 时,我收到以下消息:
(WW) CIRRUS: More than one matching Device section found: Autoconfigured Video Device cirrus
事实上,X 服务器已打开并且正常工作。但是有了“Cirrus Logic”的资源。我希望能够在打开 X 服务器时选择我想要的 VGA。我该怎么做?
PS:这里的最终目标是使用 NVIDIA 的 OpenGL。这是在 Amazon AWS 上运行的 Ubuntu。它有 GPU,所以我应该有办法在其上使用 OpenGL。
PS2:禁用 Cirrus VGA 也是非常受欢迎的。有办法吗?
答案1
因此,我让所有东西都在 Amazon 提供的 Ubuntu 14.04 AMI ubuntu-trusty-14.04-amd64 上运行。下面是我的设置代码。我还将旧答案附在下面,以便人们在 Google 上查找。
# setup kernel
sudo apt-get update
sudo apt-get install -y gcc make linux-generic
# install X server and OpenGL tools
sudo apt-get install -y xserver-xorg mesa-utils
# disable Nouveau
# via http://altinukshini.wordpress.com/2011/07/28/how-to-install-nvidia-drivers-in-ubuntu-linux/
sudo echo 'blacklist nouveau' >> /etc/modprobe.d/blacklist.conf
sudo echo 'options nouveau modeset=0' >> /etc/modprobe.d/blacklist.conf
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
# reboot to get kernel update and nouveau disabling activated
sudo reboot now
# install NVIDIA drivers
# version was chosen because was "Latest Long Lived Branch version", which sounds stable
# resources:
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html
# http://www.nvidia.com/object/unix.html
# http://us.download.nvidia.com/XFree86/Linux-x86_64/340.46/README/index.html
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/340.46/NVIDIA-Linux-x86_64-340.46.run
sudo /bin/bash ./NVIDIA-Linux-x86_64-340.46.run --accept-license --no-questions --ui=none
sudo reboot now
# setup xorg.conf
# via https://stackoverflow.com/questions/19856192/run-opengl-on-aws-gpu-instances-with-centos
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
# add missing BusID
sudo sed -i 's/ BoardName "GRID K520"/ BoardName "GRID K520"\n BusID "0:3:0"/g' /etc/X11/xorg.conf
# run x server and glxgears as test application
sudo /usr/bin/X &
DISPLAY=:0 glxgears
旧帖
遗憾的是,我自己还没有找到答案,但是这里有一些线索:
我安装了 NVIDIA 驱动程序
# from aws docs http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html
sudo apt-get update
sudo apt-get install -y linux-generic
sudo reboot now
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/343.22/NVIDIA-Linux-x86_64-343.22.run
sudo /bin/bash ./NVIDIA-Linux-x86_64-343.22.run
sudo reboot now
(如果由于 nouveau 驱动程序而出现错误,请检查这里)
接下来安装XServer
sudo apt-get install -y xserver-xorg
并生成 xconfig(按照其他堆栈溢出问题)
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
奇怪的是,这会在 /etc/X11/XF86Config 中生成一个文件,所以我将其复制到 /etc/X11/xorg.conf,以便 X 能够获取它。
现在运行 Xserver 出现以下错误:
sudo /usr/bin/X :0 &
(WW) CIRRUS: No matching Device section for instance (BusID PCI:0@0:2:0) found
其中一个答案堆栈溢出问题说选择总线,这导致了这个错误:
error setting MTRR (base = 0xe8000000, size = 0x00100000, type = 1) Invalid argument (22)
无论这意味着什么。回顾日志显示,显然 NVIDIA 驱动程序根本没有加载(尽管尝试过):
cat /var/log/Xorg.0.log
...
[ 3136.163] Loading extension GLX
...
[ 3136.163] (II) LoadModule: "nvidia"
[ 3136.164] (WW) Warning, couldn't open module nvidia
[ 3136.164] (II) UnloadModule: "nvidia"
[ 3136.164] (II) Unloading nvidia
[ 3136.164] (EE) Failed to load module "nvidia" (module does not exist, 0)
现在这个帖子建议在conf中手动设置模块路径:
# find the path (maybe)
sudo find / | grep nvidia | grep modules
...
usr/X11R6/lib/modules/
...
# put it into the conf file
vim /etc/X11/xorg.conf
...
Section "Files"
ModulePath "/usr/X11R6/lib/modules"
EndSection
无论如何,这似乎实际上加载了驱动程序模块,然后崩溃:
sudo /usr/bin/X :0 &
...
Loading extension GLX
(EE)
(EE) Backtrace:
(EE) 0: /usr/bin/X (xorg_backtrace+0x48) [0x7f65c7ea9d28]
(EE) 1: /usr/bin/X (0x7f65c7d01000+0x1aca19) [0x7f65c7eada19]
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f65c6dfe000+0x10340) [0x7f65c6e0e340]
(EE) 3: /usr/X11R6/lib/modules/drivers/nvidia_drv.so (0x7f65bf75b000+0x88cb5) [0x7f65bf7e3cb5]
(EE) 4: /usr/X11R6/lib/modules/drivers/nvidia_drv.so (0x7f65bf75b000+0x69272) [0x7f65bf7c4272]
(EE) 5: /usr/X11R6/lib/modules/drivers/nvidia_drv.so (0x7f65bf75b000+0x55e43a) [0x7f65bfcb943a]
(EE) 6: /usr/bin/X (0x7f65c7d01000+0xaf67b) [0x7f65c7db067b]
(EE) 7: /usr/bin/X (xf86CallDriverProbe+0x5e) [0x7f65c7d89a5e]
(EE) 8: /usr/bin/X (xf86BusConfig+0x46) [0x7f65c7d8a3d6]
(EE) 9: /usr/bin/X (InitOutput+0x993) [0x7f65c7d982b3]
(EE) 10: /usr/bin/X (0x7f65c7d01000+0x596bb) [0x7f65c7d5a6bb]
(EE) 11: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xf5) [0x7f65c583dec5]
(EE) 12: /usr/bin/X (0x7f65c7d01000+0x44dde) [0x7f65c7d45dde]