如何在 apt 搞砸一切後啟用 nVidia CUDA 驅動程式

如何在 apt 搞砸一切後啟用 nVidia CUDA 驅動程式

我使用 nVidia 的下載安裝了 CUDA。它安裝了特定版本的 nVidia 驅動程式。一切都工作正常。

然後我愚蠢地同意了Ubuntu更新其軟體的請求(我運行的是15.04)。我認為有一個新的核心或其他東西。不管怎樣,我重新啟動,現在只有板載英特爾顯示卡可以工作,儘管在「附加驅動程式」程式中選擇了 nVidia。

有人知道如何解決這個問題或調試它嗎? (我已經好幾年沒有使用 Linux 了,所以我對 Xorg 配置等有點生疏。而且,事情仍然如此糟糕,這令人失望和不足為奇。)

答案1

我取得了一些進步。基本上,我查看了 Synaptic 中軟體包的依賴關係cuda,發現它取決於nvidia-352哪個聽起來可能有實際的驅動程式。所以我執行了以下用戶友好的簡單命令:

sudo apt-get install --reinstall nvidia-352

這會產生以下用戶友好的錯誤:

ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-352.0.crash'
Error! Bad return status for module build on kernel: 4.2.0-35-generic (x86_64)
Consult /var/lib/dkms/nvidia-352/352.79/build/make.log for more information.

查閱該文件,在接近尾聲時,您會看到這條易於初學者理解的訊息:

Compiler version check failed:

The major and minor number of the compiler used to
compile the kernel:

gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) 

does not match the compiler used here:

cc (Ubuntu 4.9.3-5ubuntu1) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


It is recommended to set the CC environment variable
to the compiler that was used to compile the kernel.

The compiler version check can be disabled by setting
the IGNORE_CC_MISMATCH environment variable to "1".
However, mixing compiler versions between the kernel
and kernel modules can result in subtle bugs that are
difficult to diagnose.

*** Failed CC version check. Bailing out! ***

所以實際情況是 CUDA 實際上只支援 GCC 4.9,顯然核心是用 GCC 5.2 建構的。我已經安裝了這兩個版本,因此我使用這些 Windows 上易於使用的命令將路徑重設為 5.2:

sudo update-alternatives --config gcc # And choose gcc-5
sudo update-alternatives --config g++ # And choose g++-5

重試重新安裝。這次成功了。然後我將編譯器重置回 4.9。重新啟動看看它是否有效。

編輯:是的,有效。

相關內容