个人工具

UbuntuHelp:BinaryDriverHowto/Nvidia/zh

来自Ubuntu中文

跳转至: 导航, 搜索


这是一份在一个有 NVIDIA 显卡的系统上安装 NVIDIA 驱动的指南。对于其他的显卡,请参考 UbuntuHelp:BinaryDriverHowto

需求

  • 运行命令 lspci | grep -i nvidia 有一行输出。
  • 您需要下面的一个和多个功能: 3D 硬件加速,TV-out 的支持,双头显示器的支持。

安装

7.04及以后的版本

对于 Ununtu 7.04(Feisty Fawn) 推荐的安装驱动的方式是使用 系统 -> 管理 ->受限驱动管理器"。这种方式将在 nvidia-glx-legacy(71xx 的驱动), nvidia-glx(96xx的驱动), nvidia-glx-new(在写这篇文章的时候还是 97xx 的驱动) 中自动选择您需要的正确的版本的驱动。(注: 受限驱动管理器可能在之前使用第三方工具比如 envy 安装驱动的机器上可能不能正常工作)。

安装之后的一个常见的问题是提供的屏幕分辨率比开源驱动提供的分辨率低了。Nvidia 的二进制驱动似乎在从监视器上探测这类信息的能力非常弱,它必须依靠 xorg.conf 中的额外信息来处理这个问题。在 Feisty 中这个信息默认没有写到 xorg.conf 中。请参考关于使用Nvidia 二进制驱动丢失分辨率信息的 bug 报告 还有 UbuntuHelp:FixVideoResolutionHowto 来得到进一步的信息和一些解决方式。

使用 GeForce Go 卡(或可能是其他的通过 DVI 连接的非笔记本专用卡)的笔记本用户常见的另一个问题是这个驱动有时会默认显示在外部的 CTR 套接字上。在笔记本黑屏的 lunchpad bug 报告中有描述,并且详细给出了修改 xorg.conf 的方法。通常您听到 ubuntu 的启动声但是看不到任何东西就暗示了您有这个问题。如果您没有听到启动声,那么几乎可以确定不是这个问题,因此,请不要在那个 bug 下面做新的注解。

如果上面的方法不能解决问题,试着检查本页尾部的 troubleshooting 疑难解决。如果这个方法仍然不能解决问题,或者您使用一个比 7.04 老的版本,或者您希望自己手工配置驱动,请看NVIDIA显卡支持列表 并继续读下去。

请注意: 非 Ubuntu 软件仓库的软件安装之后出现的任何问题都不应该在 lunchpad 的 bug 区报告。如果是从 NVIDIA 官方下载的驱动,那么请把问题提交到http://www.nvnews.net/vbulletin/forumdisplay.php?f=14 NVIDIA linux 论坛],这里是一个合适的地方,如果使用第三方工具,请联系第三方工具的官方获得支持。其他的驱动支持能够在 社区支持页面找到。

6.10 和更早的版本

允许restricted软件包

注意:如果您正在运行的是 Ubuntu 6.10 (Edgy Eft) 或以后版本,Restricted 软件库则已被允许。如果您正在运行 Kubuntu 的话,gedit 缺省是没有安装的,您可以使用 kate 来代替 gedit。

NVIDIA驱动位于Ubuntu软件仓库的 "restricted" 模块中.因此,在准备安装该驱动前,请在您的系统中允许 restricted 软件库.

  • 选择屏幕上方的系统菜单.
  • 选择系统管理, 新立得软件包管理器. 当提示消息时请输入密码.
  • 在软件包管理器中, 选择设置菜单,然后选择软件库.
  • 当出现软件源窗口时,点击添加按钮.
  • 在 编辑软件库 窗口中,请确保选择了 Restricted copyright 复选框,然后按下确定按钮.
  • 按下确定按钮以关闭软件源对话框, 当新立得软件包管理器问您是否重新加载软件源时,请选择 是 .

现在您可以添加很多额外的软件包了,NVIDIA驱动也包含在其中.

安装并启用驱动

在新立得软件包管理器中选择正确的NVIDIA驱动,并标注安装。

“注意!”

  • 点击“搜索”按钮搜索"linux-restricted-modules". 请确认restricted modules已经安装。
  • 找到与内核匹配的驱动模块。 比如, 如果系统使用的内核为“linux-image-amd64-k8” , 那么安装 “linux-restricted-modules-amd64-k8”。 然后找到并选择安装nvidia-kernel-common模块。(注意: 必须先选择restricted模块, 因为nvidia-glx软件包自动安装 一个i386架构版的 - 如果你使用generic kernel image的话,X当然也不会工作了!)
  • 点击“搜索”按钮,搜索“nvidia”。
  • 你将安装 nvidia-glx-legacynvidia-glx。如果你的显卡在显卡列表 的尾部(标记为legacy),你需要安装nvidia-glx-legacy。否则,就安装nvidia-glx
  • 如果你要编译3D程序,请安装nvidia-glx-dev
  • 如果你正在使用Hoary Hedgehog 或 Breezy Badger,那么安装 nvidia-settingsnvidia-xconfig绝对不要在Ubuntu 6.06 LTS中安装这两个软件包,因为它会删除 nvidia-glx。 这些程序现在在nvidia-glx里提供了。
  • 点击应用按钮,安装新软件包。
  • 一旦新立得完成应用,退出该程序。
  • 选择屏幕顶端应用程序菜单,依次选择附件终端
  • 在终端窗口中,如果你使用的是Ubuntu 6.10 Edgy,输入如下指令:
sudo nvidia-xconfig

如果你使用的是早期的版本,输入下面的指令:

sudo nvidia-glx-config enable
  • 关闭所有程序,然后按Ctrl-Alt-Backspace, 或者重启机器,重启X服务器。中如果你在按下Ctrl-Alt-Backspace后看到NVIDIA splashscreen,你的驱动已经正确安装了。

6.10中的Nvidia Legacy驱动

上述指令在我的Geforce 1上的Edgy中使用legacy驱动nvidia-glx-legacy时并不起作用。

我必须手动编辑/etc/X11/xorg.conf 修改

 Section "Device"
Identifier      "NVIDIA Corporation NV10DDR [GeForce 256 DDR]"
Driver          "nv"
BusID           "PCI:1:0:0"
EndSection 

 Section "Device"
Identifier      "NVIDIA Corporation NV10DDR [GeForce 256 DDR]"
Driver          "nvidia"
BusID           "PCI:1:0:0"
EndSection 

如果Driver "nvidia" 在xorg.conf中没有找到,那么尝试modprobe nvidia 会遇到错误信息(sudo nvidia-glx-config enable 将不会起作用)。修改之后,要让OpenGL运行,必须将下列代码添加到 /etc/X11/xorg.conf底部 :

 Section "Extensions"
Option  "Composite" "Disable"
EndSection

否则在运行GL程序如glxinfo时会显示如下错误:

Xlib: extension "GLX" missing on display ":0.0".

这在legacy驱动的任何地方都没有说明(如,在 /usr/share/doc/nvidia-glx-legacy/*没有提到这一点),但幸运的是在 /var/log/Xorg.0.log中会有如下警告:

(EE) GLX is not supported with the Composite extension

默认Composite是打开的,这使OpenGL无法正常运行──上面一段简单地将Composite关闭了。这些步骤只适用于 legacy 驱动。更多信息请参考 launchpad bug about GLX being disabled on legacy drivers

删除nVidia标识

如果你想去掉在登录屏幕出现之前的nVidia标识,你需要在Xorg配置文件中做些手动修改。

  • 选择屏幕顶端的应用程序菜单,依次选择附件终端
  • 输入下列命令:
gksudo gedit /etc/X11/xorg.conf

如果你使用Kubuntu则为:

kdesu kate /etc/X11/xorg.conf
  • 在Device部分找到Driver "nvidia"这一行
  • 在这一行后面,加上:
Option		"NoLogo"
  • 保存文件,退出。
  • 关闭所有程序,然后按Ctrl-Alt-Backspace重启X服务器。如果nVidia标识没有了,应该是起作用了。

Anchor(troubleshooting)

疑难排解

  • NVIDIA最近(2007年3月)修改了unified 驱动和legacy驱动支持的显卡。你可以在NVIDIA's web site找到版本注释。
  • 要使修改起作用,好像重启有时是必要的。如果3D加速无效,先试试这个。
  • 如果3D加速还不行,确认你安装了正确版本的linux-restricted-modules。它 必须与所使用内核的版本匹配。
  • 如果你已经安装了正确版本的linux-restricted-modules,3D加速还无法工作,用下面命令打开编辑文件 /etc/X11/xorg.conf
gksudo gedit /etc/X11/xorg.conf 或者,如果使用Kubuntu,则为 kdesu kate /etc/X11/xorg.conf

确定Section "Device"下的Driver项设置为 "nvidia".

  • You may need to activate the "kernel framebuffer device interface" in X server. Copy/paste the below command into the terminal. The terminal will then start stepping you through each configuration setting. Most of the settings can be left at their defaults by pressing the ENTER button, but when you get to "Select the desired X server driver" (question 2), make sure to select "nvidia" and NOT "nv". At question 7 ("Activate kernel framebuffer device interface?") select "yes". Finish the rest of the questions (the rest of the settings can be left at their defaults) and then restart X server (or just restart your computer). If, when you reboot, you can't see the login screen, but instead get a message saying "X server failed to start (etc. etc.)", you will start in text mode (white text on black background) and it will ask you to login. After logging you will still be in text mode. Retype the same command below (make sure to write it down!) and then the configuration sequence will start again. This time at the "Activate kernel framebuffer device interface?") select "no" then restart your computer and your login screen will be restored.
sudo dpkg-reconfigure xserver-xorg
  • If you get an error while loading NVIDIA module try to rebuild module dependencies by running depmod.
sudo depmod
  • If you're feeling frisky and decide to fiddle around with the X Server Options for your Device in /etc/X11/xorg.conf and Firefox refuses to load (returns segmentation fault when launched from a terminal), this line may be the culprit:
Option "NoRenderExtension" "On"
Either comment it out (using a # at the beginning the line) or set it to Off.
  • If you have problems with video playback, e.g. in mplayer, gxine, or mythtv frontend with a legacy card, it may be due to too high a color depth (e.g. using NT6 Vanta/Vanta LT nvidia driver, I experienced flickering vertical bars & blue screen flashing). To fix this, manually edit /etc/X11/xorg.conf and change DefaultDepth to 16.

See Also

Install Nvidia proprietary drivers, Howto @gwos

NvidiaMultiMonitors

Part of UserDocumentation