如何安装Nvidia驱动程序?

我刚订购了Nvidia GTX卡。 不过,我陷入了两难境地。 我应该继续使用Ubuntu中“附加驱动程序”中提供的驱动程序,还是应该从Nvidia站点安装驱动程序?

哪个司机最适合我?

更新日期 – 2018年9月18日

快捷方式:

在添加此PPA之前,请阅读PPA在其页面上的说明,其中提到了有关使用它的重要信息,哪个版本适用于您的Nvidia卡等等。 这适用于需要最新版驱动程序或最后支持的驱动程序的桌面用户。

使用18.04+要安装,请运行以下命令:

sudo add-apt-repository ppa:graphics-drivers/ppa 

这将自动更新存储库,然后您可以运行以下行:

 sudo apt install nvidia-driver-396 

如果在安装相应的驱动程序后未加载桌面,请执行以下操作:

 sudo nano /etc/gdm3/custom.conf 

然后从显示的行中删除注释(#符号)

 # WaylandEnable=false 

并保存。 然后重启。 如果这仍然不起作用,请禁用安全启动,因为您实际上可能正在使用UEFI。

关于Nvidia的常见问题:

  • 1.我可以在较旧版本的Ubuntu上使用最新的驱动程序吗?
  • 2.video卡和驱动程序之间的区别:官方的Nvidia网站,Ubuntu的默认,PPA和Nouveau?
  • 3.使用任何video卡时推荐哪些PPA?
  • 4.如何知道要安装哪个驱动程序或软件包?
  • 5.如何安装驱动程序?
  • 6.专有驱动程序的区别?
  • 7.如何知道Ubuntu是否支持我的video卡?

有关Nvidia问题或超频设置的疑难解答,请参阅此答案 ,其中包括:

  • 1.使用最新驱动程序解决了哪些常见错误?
  • 2.我的video卡没有安装(安装问题)
  • 3.通过video卡进行调整和调整
  • 4.快速设置默认屏幕分辨率的方法

有关video卡的热门问题:

1.我可以在较旧版本的Ubuntu上使用最新的驱动程序吗?

自12.04+以来,video驱动程序的维护和更新频率更高。 它更容易处理和解决旧的问题。 除非您拥有最新的Nvidia卡,否则您很可能不需要额外的PPA。

2.video卡和驱动程序之间的区别:官方Nvidia网站,Ubuntu默认,PPA和Nouveau

我根据发现的问题按照以下顺序推荐它们,最终用户的“开箱即用”体验,它们的兼容性,更新,安装或移除的容易程度以及获得后的感受建立:

Nvidia PPA – 出色的表现。 通过使用PPA中包含的驱动程序,它可以开箱即用(对于每一代Nvidia显卡都不同)。

Ubuntu默认推荐驱动程序 – 根据您使用的卡,Ubuntu在确定您需要哪种Nvidia驱动程序方面做得非常出色。

Nouveau – 这是Nvidia驱动程序的开源实现。 他们也做得非常出色,虽然他们与官方车手或PPA中的车手不相上下(使用最新的Nvidia牌更是如此),他们每周所做的发展速度,承诺,奉献精神和进步,确信这实际上是一个拥有和促进的选择。

Nvidia官方网站 – 这是官方驱动程序(与PPA中的驱动程序相同),关键区别在于它们不会自动升级,在更新,卸载和安装时会出现一些问题(非常罕见,但它会发生)。

差异可以归纳为以下几点:

– 官方网站 –

  • 提供最新的驱动程序
  • 安装是通过终端
  • 出现更新时,您必须手动下载新包
  • 它比任何其他方法(特别是Nvidia)有更多的问题

– PPA存储库 –

  • 在官方发布后提供最新的司机小时/天
  • 通过终端或GUI进行安装
  • 如果您以前安装了驱动程序,它将自动更新程序包
  • 当出现更新时,将通知您使用Update Manager进行更新
  • 它比官方的更稳定和测试
  • 它比使用任何其他方法的问题少(所有video卡的问题少)
  • 这是Nvidia Cards的首选推荐方式。

– 默认Ubuntu驱动程序 –

  • 对于每个新版本,驱动程序都会越来越好
  • 获取更新的频率低于PPA
  • 在大多数情况下,司机将开箱即用(Nouveau for Nvidia)
  • 与官方网站或PPA相比,不是最新的
  • 到目前为止,在Ubuntu中测试比其他任何方式(PPA或官方)更多
  • 更容易更新

4.如何知道要安装哪个驱动程序或软件包?

根据您拥有的video卡数量以及它们是否集成,安装方法和安装包将从上面提到的用于单卡的PPA更改。

具有混合模式的两个video卡的计算机

从Nvidia 319.xx开始,Nvidia Optimus和普通PCIe驱动程序都集成在一起,因此如果您安装Nvidia-319软件包或更新版本,您将获得集成Nvidia卡和PCI硬盘的驱动程序。

混合卡有两种解决方案:第一种是称为bumblebee的包,它可以针对不同的应用使用不同的配置。 要安装它,请运行:

 sudo apt install bumblebee linux-headers-generic 

第二个是名为nvidia-prime的官方NVIDIA软件包,它与nvidia-355软件包一起自动安装。 它能够决定在配置文件级别使用哪张卡,即用户登录时。此决定可在NVIDIA X服务器设置控制面板上调整。 请注意, nvidia-primebumblebee不兼容:如果安装了bumblebee ,则nvidia-prime将无法正常运行,并且其选项将不会显示在NVIDIA X服务器设置控制面板上。 你必须1.删除bumblebee 2. 重新安装 nvidia-355 ,以使其再次工作。

在此之后,建议关闭计算机 ,然后重新打开。

安装了nvidia-prime应该看到下图,但是当安装了bumblebee时也不一定如此。

具有SLI设置的计算机

如果您在SLI模式下有2个或更多video卡,则可以执行以下操作:

  • 对于NVidia卡,在创建Xorg.conf将以下内容添加到该行:

     sudo nvidia-xconfig --sli=On 

最后,Ubuntu有一个简洁的方法来推荐使用哪种驱动程序,具体取决于您的video卡和驱动程序(这也是我建议首先添加PPA的原因)。 只需输入:

 ubuntu-drivers devices 

它应该显示可用于您的硬件的驱动程序包列表,包括但不限于video卡。 如果您希望查看推荐用于video卡的驱动程序,请输入以下内容:

 ubuntu-drivers devices | grep recommended 

5.如何安装驱动程序?

使用的方法取决于您拥有的video卡数量以及您使用的video卡类型。 以下是安装Nvidiavideo卡的一些方法:

NVIDIA(需要标题的旧驱动程序)

对于Nvidia,很多时候您需要首先安装当时正在使用的内核版本的头文件,以便驱动程序正确安装。 所以你首先需要执行以下行:

 sudo apt-get install linux-headers-generic 

然后安装与驱动程序相关的软件包(nvidia *用于Nvidia cardss)。 在其他情况下,您可能需要更进一步并安装源和特定头文件,例如:

 sudo apt install linux-source linux-headers-3.5.0-16-generic 

这将安装linux-source包和特定的头文件,假设您在这种情况下具有3.5.0-16-generic内核版本。

要检查在任何给定时间您拥有的版本,请键入uname -r ,它应该为您提供正在使用的特定内核版本。

对于Nvidia,它取决于它所需的video卡和包,对于最新的video卡,并假设你添加了上面提到的PPA,终端线将是:

 sudo apt install nvidia-driver-396 

最终的数字会根据您的video卡的年龄或新的数量而变化(某些版本可用的是304,340,355和370)。

对于GeForce 8和9系列GPU,请使用nvidia-340
对于GeForce 6和7系列GPU,使用nvidia-304

最新版本为最新的Nvidia显卡带来了更多修复和与图形损坏,HDMI支持,热支持等相关的正确问题。 通常,更新video驱动程序可以解决许多问题。

请注意,在nvidia-settings应用程序中找不到的Fan Control和任何其他Nvidiafunction与Ubuntu无关,但与Nvidia相关。 我建议,在官方的Nvidia论坛上询问Nvidia开发人员你想要包含的function(风扇控制,超频function等……)

对于CUDA,您可以按照此链接在Ubuntu 14.04中安装和测试CUDA

对于Bumblebee(NVIDIA Optimus),您可以使用以下PPA(Ubuntu 15.04+用户可以选择不这样做,因为它已经包含在内):

  sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update sudo apt-get install bumblebee linux-headers-generic 

6.专有驱动程序的区别?

有关专有驱动程序的更多信息,请访问其他驱动程序(Nvidia)之间的区别 。

7.如何知道Ubuntu是否支持我的video卡?

以下是一些提示,以了解Ubuntu是否支持您的video卡:

  • 如果在您使用的Ubuntu版本发布之前存在video卡,则它将支持99%的更改。

  • 如果你使用的Ubuntu版本发布不到6个月出现了video卡,并且你保持Ubuntu版本的更新,那么你很有可能会得到支持。

  • 如果您添加了我上面提到的PPA之一,那么您有99.99%的可能性支持它。

  • 检查Nvidia站点或PPA以获得支持可能会得到更快的答案,但在几乎100%的情况下,您的video卡将由开源驱动程序或专有驱动程序支持。

  • 使用最新的Ubuntu版本还可以提高您支持最新video卡的机会。

一般来说,我制定了一条经验法则,如果您拥有最新的video卡或几乎最新的video卡,您将需要最新的驱动程序。 因此,如果您拥有最新的Nvidia卡,请始终通过PPA或Ubuntu附带的软件源安装最新的驱动程序。

– Ubuntu可能会在“关于此计算机”的“图形”选项中显示值“ 未知” 。 如果发生这种情况,请安装mesa-utils软件包。

这个答案是针对解决常见的Nvidia错误(黑屏,驱动程序不通常工作,低FPS等…)

  • 1.使用最新驱动程序解决了哪些常见错误?
  • 2.我的video卡没有安装(安装问题)
  • 3.通过video卡进行调整和调整
  • 4.快速设置默认屏幕分辨率的方法

1.使用最新驱动程序解决了哪些常见错误?

所有video卡共享的常见错误包括:

  • 缺少Unity启动器或面板
  • 缺少Nvidia设置中的选项
  • 桌面不显示(黑屏)
  • 屏幕的顶部/底部被切掉
  • video看起来像碎片
  • 更高的分辨率不可用(未找到)
  • video显示VGA但不支持HDMI(和反之亦然)
  • 关闭盖子时暂停不在笔记本电脑上工作
  • 风扇速度会产生很多噪音,或者始终处于全速状态
  • 热问题
  • nvidia-xconfig没有正确创建xorg.conf

如果你碰巧有这些,最好添加一个PPA并将你的video驱动程序更新到他们可以管理的最新版本。 几乎在所有情况下,更新和重新启动后问题都解决了。 对于这种情况,我还建议使用图形驱动程序PPA。

我还邀请您看一些相关问题:

适用于Unity的ATI / AMD,英特尔或NVIDIA显卡?

直接从AMD安装专有ATI Catalystvideo驱动程序(fglrx)的正确方法是什么?

如何在Unity 3D中正确启用Desktop Cube?

为Nvidia卡启用HDMI音频

如何启用桌面视觉效果?

NVIDIA驱动程序升级后无法正常工作。 为什么我只能看到终端?

我安装nvidia驱动程序时桌面不显示!

启动LightDM / Ubuntu时,最新Nvidia / Ati卡上的黑屏

HDMI / VGA连接可切割屏幕边框或创建模糊文本

/etc/X11/xorg.conf不存在?

从Xorg PPA安装最新的Nvidia会出现黑屏

现在我想提一些指示:

  • 对于NVIDIA卡,它还有助于使用nvidia-xconfig命令行创建xorg.conf文件。 只需进入终端键入以下内容然后重新启动:

     sudo nvidia-xconfig 

    要知道如果nvidia-xconfig抛出以下错误之一,您很可能需要先删除现有的xorg.conf文件,然后再次执行nvidia-xconfig命令:

    • validation错误 – 它可以提到缺少的部分,部分中的错误信息,不是封闭部分或仅需要至少1个部分继续。

    • 警告 – 它可以提及有关在节中找到的任何参数的值中的多个错误,例如未明确指定参数的值。

    • 致命服务器错误 – 在运行nvidia-xconfig您可以在小情况下获得“无屏幕发现”错误,这很可能意味着上面提到的建议(如安装PPA)未首先应用或可能的模块仍在运行(要么是nouveau)正在使用来自nvidia站点的Nvidia驱动程序包加载或安装nvidia驱动程序。

    • 错误 – 如果您执行不带sudo的nvidia-xconfig命令,您将收到类似于Unable to write to directory '/etc/X11'的错误。 如果错误通过nvidia-settings持续存在,则需要先删除xorg.conf文件。

    对于需要删除xorg.conf文件的所有情况,请确保在删除之前备份所做的任何更改。

  • 重新安装驱动程序解决了几个问题。 例如,如果您使用的是nvidia-graphics-drivers-355驱动程序包,请执行以下操作以重新安装它:

     sudo apt-get install --reinstall nvidia-graphics-drivers-355 
  • 在其他情况下重新安装Xorg也有帮助:

    1. 使用以下命令删除现有的xorg

       sudo apt-get remove --purge xserver-xorg 
    2. 使用以下命令安装xorg

       sudo apt-get install xserver-xorg 
    3. 使用以下命令重新配置xorg

       sudo dpkg-reconfigure xserver-xorg 
    4. 在此之后,如果您使用如上所述的Nvidia或ATI,建议重新安装video驱动程序。

我必须补充一点,如果您在从PPA安装Nvidia驱动程序并重新启动后遭受黑屏(并且您没有混合系统),那么您的问题可能是需要删除bumblebee包以及bumblebee.conf文件。 按照从Xorg PPA安装最新Nvidia中提供的步骤为此提供黑屏或只需运行以下行:

 sudo apt-get purge bumblebee primus sudo rm -fr /etc/modprobe.d/bumblebee.conf sudo reboot 

2.我的video卡安装不正确(安装问题)

与ATI或Nvidia相关的大多数安装问题可以通过遵循无法安装Nvidia驱动程序中提供的步骤来解决,但简而言之,我可以在以下步骤中总结一下,假设您遇到以下问题之一:

  • 安装了官方的Nvidia驱动程序,并在更新或删除它们时遇到问题
  • 屏幕看起来错误/已损坏
  • Unity加载失败无法加载
  • 无法访问GUI环境

如果您已安装官方Nvidia驱动程序,请在恢复模式下启动Ubuntu后执行以下所有步骤。 如果没有,请跳到第2步:

  1. 如果您从Nvidia站点安装了Nvidia驱动程序或从官方AMD站点安装了ATI驱动程序,则在终端上键入以下内容(在此示例中假设您具有带有304.51版本Nvidia的Ubuntu 64Bit):

     sudo sh NVIDIA-Linux-x86_64-304.51.run --uninstall 
  2. 如果您安装了任何nvidia软件包,如nvidia-currentnvidia-current-updates请将其删除。 ATI驱动程序也是如此。 sudo apt-get remove nvidia-current例如。

  3. 例如,您将Nvidia / ATI驱动程序列入黑名单的任何更改,或者应该撤消与Nvidia / ATI驱动程序相关的任何其他文件的更改。 这是为了以防万一你开始编辑就像疯了一样(我知道^^)。

  4. 删除或备份/移动xorg.conf文件。 您现在不需要此文件。

  5. 完成上述所有步骤后,重新启动PC并确保它与Nouveau一起加载,而不是Nvidia案件或ATI驱动程序的任何Nvidia驱动程序,而不是用于Ati / AMD案例的fglrx。

  6. 如果你现在知道你正在使用Nouveau驱动程序运行Unity(或者ATI开源驱动程序),或者你刚刚遇到video错误,或者它只是无法正确加载LightDM,请不要担心,所有3个选项都将结束同样的方式。 重新启动时,在GRUB菜单中,选择“恢复模式”。 恢复模式显示恢复选项后,选择选项或Failsafe X选项。 在此模式下以及完成所有先前步骤之后,使用上面提到的PPA安装Nvidia / ATI驱动程序。 如果你有一个最近的video卡,总是尝试安装最新的驱动程序: sudo apt-get install nvidia-313用于Nvidia卡或sudo apt-get install fglrx用于最新的Ati / AMD卡。 请记住,在进行Nvidia / ATI驱动程序之前,不应该安装任何东西(显然除了Nouveau驱动程序)。

  7. 现在重新启动,所有应该工作。

注意 – 在步骤6中,如果PC看起来好像卡住了,只需按CTRL + ALT + F1进入TTY1终端并从那里执行步骤6。

其他常见的安装问题涉及解决。 您可以通过以下方式检查并更改终端的分辨率:

  1. 打开终端并键入xrandr这将显示所有可能支持的分辨率(这取决于您的video卡和显示器/电视)。 记下它们列出的顺序。 显示分辨率的第一行是第1行,下一行是2,依此类推,支持所有分辨率。 实际设置分辨率后,值为0会将分辨率重置为默认值。

  2. 输入xrandr -s X ,其中X是如上所述的行号。 所以它看起来像: xrandr -s 1

    最后,对于在更新内核和/或Nvidia版本后报告未看到Unity Launcher / Panel的用户,首先要做的是检查Unity插件是否已启用。 为此,请转到Compiz配置设置管理器(假设它已经安装)并转到Unity插件。 检查是否已激活其复选框。 如果没有,请激活此选项并按照屏幕上的建议操作。

3.调整和调整我的video卡

对于Nvidiavideo卡,请按照以下步骤操作:

  1. 在终端类型: sudo nano /etc/X11/xorg.conf

  2. 找到设备部分并添加以下行:

      Option "Coolbits" "4" 

它应该看起来像这样:

  Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" Option "Coolbits" "4" EndSection 

现在保存并重启。 您现在应该看到(取决于您的video卡型号)关于风扇速度的新选项,如下所示:

CoolBits的简要说明:

CoolBits支持各种不受支持的function,例如支持NV-CONTROL X扩展中的GPU时钟操作。 此选项接受要启用的function的位掩码 。 这意味着值为0,1,2或4。

CoolBits = 1 – 当“Coolbits”选项值中设置为“1”(位0)时,nvidia-settings实用程序将包含一个标记为“Clock Frequencies”的页面,通过该页面可以操作时钟设置。 “Coolbits”仅适用于GeForce FX及Above。

CoolBits = 2 – 当设置为“2”(位1)时,当使用具有不同video内存量的GPU时,它将尝试初始化SLI。

CoolBits = 4 – 当设置“4”(位2)时,Thermal Monitor页面将允许在具有可编程风扇function的图形卡上配置GPU风扇速度。

默认选项为0(禁用不支持的function)。

从Nvidia 337.XX开始,可以使用以下选项:

CoolBits = 8 – 当设置“8”(位3)时,nvidia-settings控制面板中的PowerMizer页面将显示一个表,该表允许设置每个时钟域和每个性能级别的偏移量以应用于时钟值。 这在GeForce GTX 400系列及更高版本的某些GeForce GPU上是允许的。 并非所有时钟域或性能级别都可以修改。

CoolBits = 12 – 当“12”(位3 + 2)时,这将与激活Coolbits 8 + Coolbits 4的效果相同。因此,您将获得新的超频function和风扇控制。

也可以通过发出以下命令来激活此选项:

 nvidia-xconfig --cool-bits=4 

警告:这可能会导致系统损坏和无效保修。

我还想补充一点,专有驱动程序的信息通常保存在主文件夹中。 例如, nvidia-settings保存的信息存储在~/.nvidia-settings-rc ,您可以通过键入以下内容来访问:

 nano ~/.nvidia-settings-rc 

我提到这个是因为如果没有使用xorg.conf ,那么ATI或Nvidia的设置是如何工作的。 原因是X可以自动检测和配置xorg.conf的许多选项,如输入/输出设备和video卡。 这不会自动发生,但自2010年以来,X可以处理许多选项并检测它们而没有任何问题或需要为它们配置文件。

请注意,其中许多仍然存在但在/usr/share/X11/xorg.conf.d/分为更具体的文件

例如,除非存在xorg.conf否则某些video卡不会显示Unity Launcher或顶部面板。 在其他情况下,想要调整其video卡的用户可能需要添加到xorg.conf的Coolbits选项。 这就是nvidia-xconfig存在的原因。 在X未检测到或提供video卡的所有选项的情况下提供额外级别的支持。

另一个技巧是运行update-pciids以便更新PCI Id List。 在极少数情况下,video卡(实际上任何PCI设备)都找不到或检测不到ID,因此这将有助于解决与之相关的任何问题。

在某些情况下,它还有助于在Compiz配置设置管理器中的OpenGL插件中将纹理filter值更改为快速

最后,在某些情况下,在Nvidia设置面板的OpenGL设置中将图像设置选项更改为“高性能”可能会有所帮助。

4.快速设置默认屏幕分辨率的方法

我已经阅读并完成了一些关于使用xrandr或编辑xorg.conf文件的提示,但我发现的最快的方法是编辑~/.config/monitors.xml文件并更改第15到18行的分辨率(提到宽度,高度和速率的那些。 因此,设置正确的宽度,高度和速率,然后重新启动以测试它。 这仅用于设置计算机启动后您希望看到的默认分辨率。

首先,您应该识别您的NVIDIA图形硬件 – 所以打开一个终端并执行:

 lspci -k | grep -EA2 'VGA|3D' 

不应该采取以下选择。
当你达到你想要达到的目标时停下来。
数字越大,解决方案越复杂(也越不稳定)。

选项1 – 检查官方Ubuntu存储库中提供的NVIDIA驱动程序:

 apt-cache search nvidia 

选项2.1 – 检查Launchpad上可用的NVIDIA驱动程序:

专有的GPU驱动程序PPA

选项2.2 – 要包含最新的NVIDIA驱动程序 – 将存储库添加到软件源:

 sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update 

搜索驱动程序…您将看到驱动程序列表…底部的版本是最新版本:

 apt-cache search nvidia | grep -oE "nvidia-[0-9]{1,3}" 

选项3 – 搜索NVIDIA网站上提供的驱动程序:

NVIDIA GPU驱动程序发布

然后按照下列步骤操作

步骤1.1 – 选择要使用的NVIDIA驱动程序并执行:

 sudo apt-get install nvidia- 

步骤1.2 – 如果NVIDIA GPU具有Optimus支持,则执行:

 sudo apt-get install nvidia-prime 

第2步 – 完成驱动程序安装过程执行:

 sudo reboot 

附加信息:

支持的NVIDIA GPU产品

NVIDIA GPU驱动程序发布信息

NVIDIA支持传统GPU版本的时间范围

安装驱动程序:

 sudo apt-get update sudo apt-get install nvidia-current sudo apt-get update 

安装mesa-utils以显示图形信息:

 sudo apt-get install mesa-utils glxinfo | grep OpenGL 

重启电脑:

 sudo shutdown -r now 

解决问题:

配置/etc/X11/xorg.conf文件以获取所有分辨率。 有关配置xorg.conf的信息 使用gtf创建模式行

创建一个名为xorg.conf的文件并将其放在/etc/X11 。 X将读取配置文件并尝试接受您的语句。 然后它将自动配置您没有明确说出的任何内容。

运行nvidia-xconfig会创建一个基本配置的鱼骨。 可能存在其他二进制驱动程序的类似命令

 sudo service lightdm stop sudo X -configure sudo mv xorg.conf.new /etc/X11/xorg.conf sudo start lightdm 

这将在您当前的目录中创建xorg.conf.new文件。 现在你应该做以下事情:

  1. 杀死x服务器
  2. 生成一个新的xorg.conf文件
  3. 重命名并移动
  4. 返回GUI

用于操作分辨率等的更好的GUI(arandr):

 sudo apt-get update sudo apt-get install arandr 

建议的方法是从Ubuntu存储库安装驱动程序。

现在,Ubuntu存储库中包含的驱动程序支持所有Nvidia适配器。 但情况并非总是如此,并且将来会出现一些Ubuntu官方驱动程序暂时不支持的新适配器。

在大多数情况下,系统会选择正确的驱动程序

系统设置 – >软件和更新 – >其他驱动程序。

首先,您需要找到GPU的模型。

在终端lspci -k | grep -EA2 'VGA|3D'运行 lspci -k | grep -EA2 'VGA|3D' ,你会得到类似的东西

 01:00.0 VGA compatible controller: NVIDIA Corporation GF116 [GeForce GTX 550 Ti] (rev a1) Subsystem: Gigabyte Technology Co., Ltd Device 351a Kernel driver in use: nvidia 

因此,该型号是GeForce GTX 550 Ti并安装了一些Nvidia专有驱动程序。

如果正在使用开源驱动程序,您将看到

 Kernel driver in use: nouveau 

要检查安装了哪个专有驱动程序,请执

 dpkg -l | grep nvidia 

标有ii的包装已安装。

您可以检查哪个驱动程序版本支持此适配器

Nvidia司机网站

例如,我的卡由340,346,349,352和355主要版本支持。

现在,Ubuntu存储库为此适配器提供了340和352个驱动程序版本。 安装352是有意义的。

它可以通过如上所述的GUI或通过运行来完成

 sudo apt-get install nvidia-352 

如果官方存储库中的任何驱动程序不支持您的适配器,或者您想尝试最新的驱动程序,则可以从ppa安装驱动程序。

Hybryd图形

如果您的笔记本电脑配有Intel CPU,在大多数情况下,您还将拥有一个内置CPU的Intel适配器。

在这种情况下,您还必须安装nvidia-prime软件包。 但是,如果从官方存储库安装,它将自动安装。

然后,您将能够在Nvidia X Server Settings (PRIME配置文件)中切换适配器。

在此处输入图像描述 在此处输入图像描述

或者你可以在终端做到。

  • sudo prime-select nvidia将切换到Nvidia适配器。

  • sudo prime-select intel将切换到Intel适配器。

  • prime-select query将显示当前状态。

您需要注销并登录才能应用该设置。

nouveau驱动程序不支持的新适配器

您可能面临一种情况,即您有一个非常新的Nvidia适配器,开源新手驱动程序支持不当。

在这种情况下,您的系统可能无法启动到GUI。

您可以参考此答案并使用nomodeset参数启动。 从LiveUSB启动,然后安装Ubuntu时,您必须以这种方式启动系统。

安装Ubuntu后,您需要再次使用nomodeset启动并安装正确的Nvidia驱动程序。

在UEFI模式下启动时,不会显示该F6选项。 在这种情况下,您需要进入grub菜单,按e并手动输入nomodeset

您不需要使用命令行或软件中心来安装NVIDIA驱动程序(也最好不要以这种方式安装它,因为有时您可能会启动到黑屏。)。

Ubuntu附带预配置 (但未安装)的NVIDIA驱动程序,您只需要做的就是:

  1. 打开破折号

  2. 搜索并启动其他驱动程序 ,等待其搜索,然后选择要安装的驱动程序。 它配备了2个驱动程序,一个是开源Nouveau,专有来自NVIDIA。

  3. 选择驱动程序,按Apply Changes并等待。 它可能需要一些时间和互联网连接才能下载并安装它。

  4. 现在重启。

在此处输入图像描述

我选择了专有的驱动程序

这是一个详细的asnwer如何完成它。 它将列出在Ubuntu 12.10到14.04上安装最新Nvidia驱动程序的两种方法。 如果您的系统上安装了synaptic,那将是最好的,因为您需要它来安装一些文件。 如果未安装,只需按键盘上的Ctrl + Alt + T即可打开终端。 打开时,运行以下命令:

 sudo apt-get install synaptic 

列出的所有步骤都需要使用终端。 要打开它,只需按键盘上的Ctrl + Alt + T.

第一种方式:

首先要做的是更新你的Ubuntu发行版

 sudo apt-get update && sudo apt-get dist-upgrade 

如果需要,重新启动。

从Nvidia下载最新的驱动程序

Install linux-source + linux-headers-generic + dkms (Using Synaptic Package Manager)

在此处输入图像描述在此处输入图像描述在此处输入图像描述

Install Build Essentilas, gcc and g++

 sudo apt-get install build-essential gcc g++ 

Reboot your system at this point.

Once system is backup and running, edit /etc/modprobe.d/blacklist.conf , and add the following lines to the end of the file

 blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv 

Save and exit the file.

Remove any current Nvidia drivers

 sudo apt-get remove --purge nvidia* 

Remove any xserver-xorg-video-nouveau drivers

 sudo apt-get --purge remove xserver-xorg-video-nouveau 

Edit grub file

 sudo nano /etc/default/grub 

From the line that has GRUB_CMDLINE_LINUX remove "quiet splash" and replace it with "text"

Update grub using the following commands

 sudo update-grub sudo update-initramfs -u 

Reboot your system at this point. Once system reboots, it will be in text mode. Login to your system, and then do

 sudo su 

(enter your password)

 cd Downloads 

(providing that the Nvidia downloaded file was savwe there)

 sh xxx.run 

(where xxx is the Nvidia file name) Click OK If a message comes up regarding the driver, click on yes (its very important that you click yes) Wait for the installation to finish, then

 sudo nano /etc/default/grub 

From the line that has GRUB_CMDLINE_LINUX remove "test" and replace it with "quiet splash" then do

Ctrl + xyenter to save the file and exit.

Update grub using the following commands

 sudo update-grub/ sudo update-initramfs -u 

Reboot, and you’re set.

The second way:

Just press Ctrl + Alt + T on your keyboard to open Terminal. When it opens, run the command(s) below:

 sudo add-apt-repository ppa:xorg-edgers/ppa sudo apt-get update sudo apt-get install nvidia-340 

在此处输入图像描述

Both methods have been tested with Nvidia Driver Version 340, and they both work OK. Many updates have been done after the fact, and everything works OK.

Wanted to throw my caveat out there on the subject after spending last 2 days with this.

I’ve been using Ubuntu for years. Last week I retired my old quad core AMD 940 based pc and built a new AMD 8350 8 core with asus mobo and for a video card since I don’t play games I bought a new GTX 650 gpu card.

After installing the GTX 650.. it worked fine with the Noveau driver but I wanted to use the video cards HDMI port and for whatever reason that didn’t work w/my HP w2207h monitor.

 NOTE: I'd actually never tried the hdmi port on that monitor before so I don't know if it ever worked as that monitor is now nearly 4 years old. 

So I first installed the Ubuntu NVIDIA “Current Proprietary” tested.

Still no HDMI but the unity desktop etc all still worked ok.

Thinking maybe I should try the linux driver directly from NVIDIA I went to their driver section, searched for the linux GTX 650 card and downloaded that .run file – where is going to be some long driver name.

Next step for those new to ubuntu/unity

Press ctrl + alt + F1 puts me in a terminal

Next before you will be able to apply the NVIDIA driver you have to kill the LIGHTDM that is still running in the background.

  $ sudo service lightdm stop 

Once lightdm is stopped you have to change the .run file to be executable:

  $ sudo chmod +x ./.run 

then finally execute the new driver install program.

  $ sudo ./.run 

this will start and ask you multiple questions you will have to answer.

when its done you reboot.

Now my warning.

Before you start doing all of the above you should either have a 2nd computer/laptop available so you can look up how to reverse the above if you have problems -or- you should have printed out all the info you need INCLUDING:

the command line you would need to “purge” the new Nvidia driver

  $ sudo ./.run --uninstall 

once done you must install some video driver BEFORE you reboot unless you left the Noveau driver installed (re you didn’t remove it — which most say is not required to have tried the above NVIDIA proprietary driver).

Next… make sure you know the command line required to reinstall the Noveau driver if you have to.

So why did I post this?

I was quite careful installing the NVIDIA websites latest driver for the GTX 650 card.

However, after a reboot my Ubuntu 12.10 Unity desktop was crazy with various problems.

  1. I use synaptic but couldn’t use it because launching it would just minimize it to the Unity tool bar on the left from which I couldn’t make it appear on screen
  2. I couldn’t launch the “System Settings” from desktop or from cli. It did the same thing as synaptic
  3. I found my mouse might or might not appear on the screen when I logged in. If not I’d have to do a shutdown … not a reboot… to get it bac

Because I had not taken the time to prepare myself with how to remove that driver and reinstall a working one from the command line (remember I couldn’t use the System Settings tool ?? … it was a real pain to get back to my previously working system.

So do as the Boy Scout model says “be prepared” before you start down this road.

Worst of all for me… Even with NVIDIA’s latest driver installed I could NOT get the HDMI port on the GTX 650 to display to my monitor. To double check I attached the HDMI cable to a 2nd much newer HDMI capable Monitor and still got NO SIGNAL with that.

So I am back to square one still trying to get my HDMI port to work BUT… glass 1/2 full I did learn alot in the process.

Hope this helps others.

A simple command-line installation method (a text-based variant of the answer by @edwardtorvalds):

  1. Run the command

     ubuntu-drivers devices 

    ( /usr/bin/ubuntu-drivers is provided by ubuntu-drivers-common , which is included as a package since 14.04 , and available as an app in earlier releases.)

  2. After a few seconds, you should get output that looks like this:

     == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == modalias : pci:v000010DEd00000DE1sv000019DAsd00001167bc03sc00i00 model : GF108 [GeForce GT 430] vendor : NVIDIA Corporation driver : nvidia-346-updates - distro non-free driver : nvidia-340-updates - distro non-free driver : nvidia-304-updates - distro non-free driver : nvidia-340 - distro non-free driver : xserver-xorg-video-nouveau - distro free builtin driver : nvidia-304 - distro non-free driver : nvidia-346 - distro non-free recommended 

    The recommended driver is nvidia-346 , so run

     sudo apt-get install nvidia-346 

    (Since nVidia drivers are non-free software, you’ll need to first ensure that the multiverse repository is enabled .)

The problem you’re running into is that you don’t have the linux source, so you can install the nvidia driver. I believe what you want is the linux headers for your kernel version.

sudo apt-get install linux-headers-generic should install the correct headers, which then will allow you to continue from where you left off.

It got easier with 346.72, at least with Lubuntu and MATE 14.04. I hit Ctrl+Alt+F1 and it took 5 commands. Steps that worked for me are as follows:

  1. Download from NVidia site.
  2. Hit Ctrl+Alt+F1 to go to the tty and log in.
  3. sudo service lightdm stop
  4. cd /path/to/file
  5. sudo chmod +x NVIDIA-Linux-(asterisk)-346.72.run && sudo sh NVIDIA-Linux-(asterisk)-346.72.run
  6. Everything goes off without a hitch with 64 bit. The pre-install script failed but I told it to install anyway. From there, it was basically “yes, yes, yes”.
  7. sudo service lightdm start or some variation of this command. They were slightly different for Lubuntu and MATE.

No need to generate an xorg.conf because it did that when I answered yes during the installation. Also, no need to blacklist nouveau before installing. The only hitch I encountered was when I installed the same driver for a 32 bit OS. It told me that it needed a gcc+ package which I got on my first google.

Its available in Default Repositories.

From now on, Nvidia drivers are available on default repositories. So no need of any ppa.

Execute :

 sudo apt-get update sudo apt-get install nvidia-361 

As of now, nvidia-361 is the most recent version available on default repositories. You might want to make it sure by searching all the available drivers by apt-cache search nvidia

There are a lot of solutions out there but here is what actually worked for me (suppose you have a fresh installation of Ubuntu 16.04 and nvidia binary driver downloaded)

  1. If you have dual boot, go to your BIOS settings and turn the secure boot option to “other OS”;

  2. Press Ctrl + Alt + F1 in the login session to enter the TTY-1 and do the following:

     sudo apt-get install linux-source sudo apt-get install linux-headers 
  3. Before install the driver, stop the lightdm by:

     sudo service lightdm stop 
  4. Run the NVIDIA script

     sudo ./NVIDIA-Linux-x86_64-378.09.run 

During the installation you may receive a warning saying “Distribution provided script failed”, just ignore it.

  • Download the driver and place it in your home directory

Download for 64bit: http://www.nvidia.com/object/linux-display-amd64-295.53-driver.html

Download for 32bit: http://www.nvidia.com/object/linux-display-ia32-295.53-driver.html

  • Do: ctrl + alt + F6 (Warning: This will switch you to a TTY, no GUI)
  • Login using your username and password
  • Type: sudo service lightdm stop
  • Type: sudo ./NVIDIA*
  • Type: sudo reboot

The driver should work with no problem now (I just did this with my GTX 570)

Test the driver by opening a terminal: ( ctrl + alt + T )

  • Type: glxinfo | grep direct It should report back: direct rendering: Yes
  • To adjust your NVIDIA settings Type: nvidia-settings

NOTE: The script should blacklist the nouveau driver by default. If the NVIDIA driver isn’t working, try to do this manually:

  • Type: sudoedit /etc/modprobe.d/blacklist.conf

Append the following lines:

 blacklist nouveau options nouveau modeset=0 
  • Type: sudo reboot