LoginSignup
36
28

More than 3 years have passed since last update.

sudo apt --fix-broken install時のエラー

Posted at

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:
 libhdf5-openmpi-dev : Depends: libopenmpi-dev but it is not installed
 mpi-default-bin : Depends: openmpi-bin but it is not installed
 mpi-default-dev : Depends: libopenmpi-dev but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

言われたとおりapt --fix-broken installを実行してみる。

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libopenmpi-dev openmpi-bin
Suggested packages:
  openmpi-doc gfortran
The following NEW packages will be installed:
  libopenmpi-dev openmpi-bin
0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded.
8 not fully installed or removed.
Need to get 0 B/1013 kB of archives.
After this operation, 5607 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Preparing to unpack .../libopenmpi-dev_2.1.1-8_amd64.deb ...
Unpacking libopenmpi-dev (2.1.1-8) ...
dpkg: error processing archive /var/cache/apt/archives/libopenmpi-dev_2.1.1-8_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/opal_wrapper', which is also in package openmpi 4.0.0-2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../openmpi-bin_2.1.1-8_amd64.deb ...
Unpacking openmpi-bin (2.1.1-8) ...
dpkg: error processing archive /var/cache/apt/archives/openmpi-bin_2.1.1-8_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/ompi_info', which is also in package openmpi 4.0.0-2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libopenmpi-dev_2.1.1-8_amd64.deb
 /var/cache/apt/archives/openmpi-bin_2.1.1-8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

エラーが出て実行できない...

解決策

上記のエラーの最後に書いてある.debファイルをエラーを強制的に無視してインストール。

$ sudo dpkg --force-all -i /var/cache/apt/archives/libopenmpi-dev_2.1.1-8_amd64.deb
$ sudo dpkg --force-all -i /var/cache/apt/archives/openmpi-bin_2.1.1-8_amd64.deb
36
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
36
28