有事没事领个红包

ubuntu14.4安装gtx970显卡驱动的艰辛历程

1 说明:
本人机器说明,显卡gtx970,内存4G,原来系统是win7 64的.最近要学习机器学习的一些算法,需要安装ubuntu。不过安装环境这一条道路真的很曲折,来来回回弄了好久。以下说一下配置环境的过程中遇到的问题把。


2 机器上已经有集成显卡了,我想要使用硬盘再安装ubuntu14.4 64位系统,双系统。安装双系统的过程请看之前的随笔。windows系统安装ubuntu双系统但是安装过程中,如果独立显卡在机器上,总是在登陆界面出不来,然后就是黑屏,查资料显示这是因为bios设置了开机启动时会默认使用独立显卡作为显示输出。所以想要在显卡在机器上安装双系统,首先需要在开机启动时进入bios设置开机启动默认显示设备是集成显卡。具体的设置步骤请自行百度。好像是在外设那一栏吧。

 

3 安装独立显卡驱动的步骤:一种是在线安装;一种是离线安装,需要你自己现在对应的安装包

  1)彻底卸载已安装的显卡驱动程序,执行以下步骤

sudo apt-get remove --purge nvidia-*
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf
echo 'nouveau' | sudo tee -a /etc/modules

若之前未安装过Nvidia显卡驱动程序,执行这些命令可能会提示找不到目录或文件,这个可以忽略。  

  2)重启电脑,在登录页面按Ctrl+Alt+F1进入tty, 关闭lightdm。

sudo service lightdm stop

  

  3)添加驱动源

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

 

  4)重新安装驱动

   I)在线版:安装340版驱动:sudo apt-get install nvidia-340

    II)离线版:sudo sh NVIDIA-Linux-x86_64-367.57.run

  安装过程中按提示操作就可以了,一般选择yes或ok就好。

  

  5)安装结束之后,使用以下命令重新启动电脑:

  sudo reboot


  如果已经能正常进入桌面则不用理会后面的步骤

  6)这时进入系统后,可能分辨率不对,执行下列命令查看现在采用的驱动
prime-select query

如果显示采用的是Nvidia,则进行下一步;否则执行以下命令来配置驱动:

sudo update-alternatives --config i386-linux-gnu_gl_conf

在显示的显卡列表中选择安装的Nvidia:

sudo prime-select nvidia

使用以下命令更新系统驱动

sudo ldconfig -n
sudo update-initramfs -u

重新启动电脑,桌面显示正常了,可以通过prime-select query来查看当前使用的显卡是否是Nvidia。

 

4 安装过程中出现了error

  

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most
       frequently when this kernel module was built against the wrong or
       improperly configured kernel sources, with a version of gcc that differs
       from the one used to build the target kernel, or if a driver such as
       rivafb/nvidiafb is present and prevents the NVIDIA kernel module from
       obtaining ownership of the NVIDIA graphics device(s), or NVIDIA GPU
       installed in this system is not supported by this NVIDIA Linux graphics
       driver release.

找到老外的解决办法

1) Download Newest Nvidia drivers from their website
2) Open module blacklist as admin: (i use gedit for text file editing)

Code:
sudo gedit /etc/modprobe.d/blacklist.conf

3) Add these lines and save: 

Code:
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

4) Uninstall any previously installed Nvidia drivers: 

Code:
sudo apt-get --purge remove nvidia-*

5) Reboot your computer
6) When an error message pops up saying that Ubuntu cannot load Nvidia drivers, choose Exit to terminal (Exit to console)
7) Login and cd to the directory where you saved your file
8) Install drivers

Code:
sudo sh NVIDIA-Linux-x86_64-195.36.24-pkg2.run

9) Start GDM

Code:
sudo service gdm start

    

5 如果是双显卡的话可能不能成功安装,此时的解决办法安装Bumblebee参考官方文档

  出现的问题就是一直在登录界面进不去 。此时需要查看上面的官方文档的处理办法。

 

posted @ 2016-10-28 00:02  crazyCodeLove  阅读(20150)  评论(2编辑  收藏  举报