apt がすべてを台無しにした後、nVidia CUDA ドライバーを有効にする方法

apt がすべてを台無しにした後、nVidia CUDA ドライバーを有効にする方法

nVidia のダウンロードを使用して CUDA をインストールしました。特定のバージョンの nVidia ドライバーがインストールされました。すべて正常に動作していました。

その後、私は愚かにも Ubuntu のソフトウェア更新要求に同意しました (15.04 を実行しています)。新しいカーネルか何かがあったのだと思います。とにかく、再起動したところ、「追加ドライバー」プログラムで nVidia が選択されているにもかかわらず、オンボードの Intel グラフィックスだけが動作するようになりました。

これを修正またはデバッグする方法をご存知の方はいらっしゃいますか? (私は数年間 Linux を使用していないので、Xorg の設定などに少し慣れていません。また、まだ動作がひどいのは残念ですが、驚くことではありません。)

答え1

cuda少しは進展がありました。基本的には、Synaptic でパッケージの依存関係を調べ、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 にリセットしました。再起動して動作するか確認します。

編集: はい、うまくいきました。

関連情報