web-dev-qa-db-ja.com

libglx-mesa0およびNvidiaドライバーが関与するapt-upgrade問題に対処する方法

Ubuntu 18.04、Nvidiaドライバー396.37、CUDA 9.0、そしてTensorFlowとKerasが実行されているNvidia 1070システムがあります。

Sudo apt updateを実行した後、Sudo apt upgradeを実行すると、次のようになります。

$ Sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 libglx-mesa0 : Depends: libglapi-mesa (= 18.0.5-0ubuntu0~18.04.1) but 18.2.8-0ubuntu0~18.04.2 is installed
                Breaks: libglx-mesa0:i386 (!= 18.0.5-0ubuntu0~18.04.1) but 18.2.8-0ubuntu0~18.04.2 is installed
 libglx-mesa0:i386 : Breaks: libglx-mesa0 (!= 18.2.8-0ubuntu0~18.04.2) but 18.0.5-0ubuntu0~18.04.1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

提案されたSudo apt --fix-broken installを試すと、次のように表示されます。

$ Sudo apt --fix-broken installReading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libllvm6.0 libllvm6.0:i386 x11proto-dri2-dev x11proto-gl-dev
Use 'Sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libglx-mesa0
The following packages will be upgraded:
  libglx-mesa0
1 to upgrade, 0 to newly install, 0 to remove and 256 not to upgrade.
155 not fully installed or removed.
Need to get 0 B/135 kB of archives.
After this operation, 9216 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 591832 files and directories currently installed.)
Preparing to unpack .../libglx-mesa0_18.2.8-0ubuntu0~18.04.2_AMD64.deb ...
Unpacking libglx-mesa0:AMD64 (18.2.8-0ubuntu0~18.04.2) over (18.0.5-0ubuntu0~18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libglx-mesa0_18.2.8-0ubuntu0~18.04.2_AMD64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package nvidia-396 396.37-0ubuntu1
Errors were encountered while processing:
 /var/cache/apt/archives/libglx-mesa0_18.2.8-0ubuntu0~18.04.2_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

これを調査した結果、次のコマンドを実行するように this および this で求められます。

Sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken

しかし、私は本当にセットアップを台無しにしたくないので(CUDA、TensorFlow、Kerasなどの互換バージョンをまったく機能させるのが難しいため)、これが安全なアプローチであるかどうかについての評価を重視します。


編集:@Josによって この提案 に従って、/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0のバックアップを作成し、--force-overwriteアプローチを続行しました。これに続いて、TensorFlow、Kerasなどのインフラストラクチャはすべて正常に機能しているようです。

$ Sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libllvm6.0 libllvm6.0:i386 x11proto-dri2-dev x11proto-gl-dev
Use 'Sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libglx-mesa0
The following packages will be upgraded:
  libglx-mesa0
1 to upgrade, 0 to newly install, 0 to remove and 256 not to upgrade.
155 not fully installed or removed.
Need to get 0 B/135 kB of archives.
After this operation, 9216 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 591832 files and directories currently installed.)
Preparing to unpack .../libglx-mesa0_18.2.8-0ubuntu0~18.04.2_AMD64.deb ...
Unpacking libglx-mesa0:AMD64 (18.2.8-0ubuntu0~18.04.2) over (18.0.5-0ubuntu0~18.04.1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package nvidia-396 396.37-0ubuntu1
6

TL; DR

以下のソリューションでは--force-overwrite、警告が付属します。

@Josコメントから:

Sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken

UbuntuでのNvidiaドライバー、CUDA、およびlibglxパッケージの競合は常に非常に厄介です-_- |||

4
alvas