Ubuntu服务器的NVIDIA驱动自动更新所引起的问题及解决方法m

来源:互联网 发布:阿里云视频点播 编辑:程序博客网 时间:2024/06/05 15:00

问题描述:

    服务器为Ubuntu14.04,NVIDIA驱动由352.39自动升级到352.63,导致显卡不能使用,错误为:运行nvidia-smi指令,得到的信息为“Failed to initialize NVML: GPU access blocked by the operating sestem”。

    系统:Ubuntu14.04

    cuda:7.5

 解决方案:

1. 首先关闭系统包括的所有更新

sudo vim /etc/apt/apt.conf.d/50unattended-upgrades

(注释掉其中的更新部分)

参考链接:http://www.linuxdiyf.com/linux/15997.html


2. 卸载cuda驱动并重新安装

(1)彻底卸载

sudo apt-get remove --purge nvidia*

sudo apt-get autoremove

sudo apt-get clean

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P 

参考链接:

https://devtalk.nvidia.com/default/topic/900899/cuda-setup-and-installation/unable-to-detect-cuda-capable-device-after-automatic-forced-nvidia-updated/

http://zhidao.baidu.com/link?url=smwXar3NPdAi1WxnZJ2_sARCEPoNcxLwB0RwmEnDPiqyrbdz64aVCoabN9azod-AQrJP0OjeiL8-y8mFRHZDma


(2)重装cuda

    由于之前系统Ubuntu14.04在配置好caffe环境后,编译matlab接口时将gcc由4.8降级为4.7。若直接安装cuda,会提示错误,“Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed.If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.”.如果按照此条路径思索,在尝试添加了“--kernel-source-path”之后,仍存在问题。继续往下走,会提示给系统内核降级。

    考虑到之前曾对系统的gcc降级,这导致了上述错误,对gcc升级。

sudo apt-get install gcc-4.7

cd /usr/bin

sudo mv gcc gcc.bak

sudo ln -s gcc-4.7 gcc
sudo mv g++ g++.bak
sudo ln -s g++-4.7 g++

参考链接:http://www.mamicode.com/info-detail-876185.html


    然后按照常规方法重装cuda驱动即可解决问题。



0 0
原创粉丝点击