Bootstrap

Ubuntu安装NVIDIA驱动


软硬件环境

  • 系统版本:Ubuntu Desktop 18.04 LST
  • 显卡型号:NVIDIA TITAN RTX
  • 驱动版本:440.44

NVIDIA驱动官方下载地址
Ubuntu安装CUDA+cuDNN


1 禁用nouveau

因为 NVIDIA的官方驱动和系统自带的nouveau驱动冲突,所以需要先禁用。

创建文件

sudo vim /etc/modprobe.d/blacklist-nouveau.conf

在文件内插入以下内容

blacklist nouveau
options nouveau modeset=0

执行以下命令使禁用生效并且重启

sudo update-initramfs -u
# 重启
sudo reboot

重启后验证是否生效, 执行命令,若没有输出,则禁用生效

lsmod | grep nouveau

2 安装驱动

下载好驱动,执行命令进行安装。

sudo sh NVIDIA-Linux-x86_64-440.44-titan_rtx.run

可能会遇到错误,具体解决方法请看本文后面的第3小节。 选择Continue installation继续安装,可以查看具体错误。


如果没有错误,进入下一步,会出现警告,意思是缺少32位相关的兼容库,不用管,回车进入下一步

 WARNING: Unable to find a suitable destination to install 32-bit
          compatibility libraries. Your system may not be set up for 32-bit
          compatibility. 32-bit compatibility files will not be installed; if 
          you wish to install them, re-run the installation and set a valid
          directory with the --compat32-libdir option.  


意思是发现现在的libglvnd不是完整的,问你要不要安装完整版的libglvnd,可以装也可以不装,我这里选择不装Don't install

An incomplete installation of libglvnd was found. All of the essential       
libglvnd libraries are present, but one or more optional components are      
missing. Do you want to install a full copy of libglvnd? This will overwrite 
any existing libglvnd libraries.


上一步没安装libglvnd,所以出现警告,忽略,回车进入下一步

 WARNING: Unable to determine the path to install the libglvnd EGL vendor     
          library config files. Check that you have pkg-config and the        
          libglvnd development libraries installed, or specify a path with    
          --glvnd-egl-config-path.


问你要不要用nvidia-xconfig工具自动更新NVIDIA X的配置文件,不知道有啥用,选No,下一步

Would you like to run the nvidia-xconfig utility to automatically update
your X configuration file so that the NVIDIA X driver will be used when you
restart X?  Any pre-existing X configuration file will be backed up.   


OK,回车,安装完成


输入命令nvidia-smi,验证是否安装成功,如果安装成功,会出现显卡的相关信息


3 可能会遇到的错误


原因:NVIDIA的官方驱动和系统自带的nouveau驱动冲突
解决:参照第1小节,禁用nouveau


ERROR: Unable to find the development tool `cc` in your path; please make    
       sure that you have the package 'gcc' installed.  If gcc is installed  
       on your system, then please check that `cc` is in your PATH.


原因:缺少gcc
解决:安装 sudo apt-get install gcc


 ERROR: Unable to find the development tool `make` in your path; please make  
        sure that you have the package 'make' installed.  If make is          
        installed on your system, then please check that `make` is in your    
        PATH.


原因:缺少make
解决:安装 sudo apt-get install make


记录,分享,交流。

;