我今天咬紧牙关,决定从 Ubuntu 20.04 升级到 20.10,但在最后收到了“失败”消息。
启动后,我进入终端,执行了sudo apt update
and sudo apt upgrade
,结果得到了以下信息,这对我来说意义不大。如果可能的话,我希望有一个解决方法,因为我的默认解决方案是简单地进行全新安装!
---------8< ----------------------------
Setting up openmpi-bin (4.0.3-6ubuntu2) ...
update-alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link s
ame as main link /usr/bin/mpicc
dpkg: error processing package openmpi-bin (--configure):
installed openmpi-bin package post-installation script subprocess returned erro
r exit status 2
dpkg: dependency problems prevent configuration of libcoarrays-openmpi-dev:amd64
:
libcoarrays-openmpi-dev:amd64 depends on openmpi-bin; however:
Package openmpi-bin is not configured yet.
dpkg: error processing package libcoarrays-openmpi-dev:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libopenmpi-dev:amd64:
libopenmpi-dev:amd64 depends on openmpi-bin (>= 3.0.0-1); however:
Package openmpi-bin is not configured yet.
dpkg: error processing package libopenmpi-dev:amd64 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up er
ror from a previous failure.
No apport report written because the error message i
ndicates it's a follow-up error from a previous failure.
Errors were encountered
while processing:
openmpi-bin
libcoarrays-openmpi-dev:amd64
libopenmpi-dev:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)
现在编辑并添加我现在已尝试运行 update-alternatives 的建议,但这给了我以下信息:
update-alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link same as main link /usr/bin/mpicc
还根据要求,'cat /var/lib/dpkg/alternatives/mpi' 的输出
---------8< ----------------------------
auto
/usr/bin/mpicc
libmpi++.so
/usr/lib/x86_64-linux-gnu/libmpi++.so
libmpi.so
/usr/lib/x86_64-linux-gnu/libmpi.so
mpi-c.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/mpi-c.pc
mpi-cxx.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/mpi-cxx.pc
mpi-fort.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/mpi-fort.pc
mpi.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/mpi.pc
mpiCC
/usr/bin/mpiCC
mpiCC.1.gz
/usr/share/man/man1/mpiCC.1.gz
mpic++
/usr/bin/mpic++
mpic++.1.gz
/usr/share/man/man1/mpic++.1.gz
mpicc
/usr/bin/mpicc
mpicc.1.gz
/usr/share/man/man1/mpicc.1.gz
mpicxx
/usr/bin/mpicxx
mpicxx.1.gz
/usr/share/man/man1/mpicxx.1.gz
mpif77
/usr/bin/mpif77
mpif77.1.gz
/usr/share/man/man1/mpif77.1.gz
mpif90
/usr/bin/mpif90
mpif90.1.gz
/usr/share/man/man1/mpif90.1.gz
mpifort
/usr/bin/mpifort
mpifort.1.gz
/usr/share/man/man1/mpifort.1.gz
/usr/bin/mpicc.openmpi
50
/usr/bin/mpic++.openmpi
/usr/share/man/man1/mpiCC.openmpi.1.gz
/usr/bin/mpic++.openmpi
/usr/share/man/man1/mpic++.openmpi.1.gz
/usr/share/man/man1/mpicc.openmpi.1.gz
/usr/bin/mpic++.openmpi
/usr/share/man/man1/mpicxx.openmpi.1.gz
/usr/bin/mpif77.openmpi
/usr/share/man/man1/mpif77.openmpi.1.gz
/usr/bin/mpif90.openmpi
/usr/share/man/man1/mpif90.openmpi.1.gz
/usr/bin/mpifort.openmpi
/usr/share/man/man1/mpifort.openmpi.1.gz
/usr/lib/x86_64-linux-gnu/openmpi/include
50
/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so
/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so
/usr/lib/x86_64-linux-gnu/pkgconfig/ompi-c.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/ompi-cxx.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/ompi-fort.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/ompi.pc
/usr/bin/mpic++.openmpi
/usr/share/man/man1/mpiCC.openmpi.1.gz
/usr/bin/mpic++.openmpi
/usr/share/man/man1/mpic++.openmpi.1.gz
/usr/bin/mpicc.openmpi
/usr/share/man/man1/mpicc.openmpi.1.gz
/usr/bin/mpic++.openmpi
/usr/share/man/man1/mpicxx.openmpi.1.gz
/usr/bin/mpif77.openmpi
/usr/share/man/man1/mpif77.openmpi.1.gz
/usr/bin/mpif90.openmpi
/usr/share/man/man1/mpif90.openmpi.1.gz
/usr/bin/mpifort.openmpi
/usr/share/man/man1/mpifort.openmpi.1.gz
答案1
我在从 20.04.5 升级到 22.04.1 时遇到了这个问题。解决方法:
sudo rm -f /etc/alternatives/mpi* /var/lib/dpkg/alternatives/mpi*
sudo apt install openmpi-bin
灵感来源于StackOverflow,参见:https://stackoverflow.com/questions/62464085/openmpi-bin-error-after-update-kubuntu-18-04-to-20-04