I think that after upgrading Ubuntu to version 22.04 my openmpi was broken in my system.
TLDR:
I get errors related to openmpi-bin. For example:
>sudo dpkg --configure openmpi-bin
dpkg: error processing package openmpi-bin (--configure):
package openmpi-bin is already installed and configured
Errors were encountered while processing:
openmpi-bin
When I try to remove openmpi to reinstall it I also get an error that is related to the libhdf5-openmpi-dev package.
>sudo apt-get remove --auto-remove openmpi-bin
...
(Reading database ... 865790 files and directories currently installed.)
Removing libhdf5-openmpi-dev (1.10.7+repack-4ubuntu2) ...
update-alternatives: priority must be an integer
Use 'update-alternatives --help' for program usage information.
dpkg: error processing package libhdf5-openmpi-dev (--remove):
installed libhdf5-openmpi-dev package pre-removal script subprocess returned error exit status 2
dpkg: too many errors, stopping
update-alternatives: using /usr/bin/h5pcc.openmpi to provide /usr/bin/h5pcc (h5pcc) in auto mode
update-alternatives: priority must be an integer
Use 'update-alternatives --help' for program usage information.
dpkg: error while cleaning up:
installed libhdf5-openmpi-dev package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
libhdf5-openmpi-dev
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
Long story: In order to safe space I included on most of what I did so far in the code box below.
###############################################################
I noticed that after the upgrade some programs such as inkscape would stop responding at startup and crash.
Therefore I ran sudo apt update; sudo apt upgrade inkscape to update it.
This however produced errors
###############################################################
>sudo apt update
sudo apt upgrade inkscape
Setting up openmpi-bin (4.1.2-2ubuntu1) ...
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 mpi-default-bin:
mpi-default-bin depends on openmpi-bin; however:
Package openmpi-bin is not configured yet.
dpkg: error processing package mpi-default-bin (--configure):
dependency problems - leaving unconfigured
Setting up ghostscript-x (9.55.0~dfsg1-0ubuntu5.5) ...
No apport report written because the error message indicates its a followup erro
r from a previous failure.
dpkg: dependency problems prevent configuration of pyt
hon3-mpi4py:
python3-mpi4py depends on mpi-default-bin; however:
Package mpi-default-bin is not configured yet.
dpkg: error processing package python3-mpi4py (--configure):
dependency problems - leaving unconfigured
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
No apport report written because the error message indicates its a followup erro
r from a previous failure.
No apport report written because MaxReports is reached
already
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
dpkg: dependency problems prevent configuration of libhdf5-openmpi-dev:
libhdf5-openmpi-dev depends on libopenmpi-dev; however:
Package libopenmpi-dev:amd64 is not configured yet.
No apport report written because MaxReports is reached already
No apport report w
ritten because MaxReports is reached already
...(and many similar errors, which I can't include due to the size limit of the post)
###################################################################################
I next ran sudo dpkg --audit
###################################################################################
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
libboost-all-dev Boost C++ Libraries development files (ALL) (default vers
libboost-mpi-dev C++ interface to the Message Passing Interface (MPI) (def
libboost-mpi-python-dev C++ interface to the Message Passing Interface (MPI),
libboost-mpi-python1.74-dev C++ interface to the Message Passing Interface (MP
libboost-mpi-python1.74.0 C++ interface to the Message Passing Interface (MPI)
libboost-mpi1.74-dev C++ interface to the Message Passing Interface (MPI)
libcoarrays-openmpi-dev:amd64 Co-Array Fortran libraries - development files (OpenM
libhdf5-openmpi-dev HDF5 - development files - OpenMPI version
libmumps-5.4:amd64 Direct linear systems solver - parallel shared libraries
libmumps-dev:amd64 Direct linear systems solver - parallel development files
libopenmpi-dev:amd64 high performance message passing library -- header files
libscalapack-mpi-dev:amd64 Scalable Linear Algebra Package - Dev files for MPI
libscalapack-openmpi-dev:amd64 Scalable Linear Algebra Package - Dev files for OpenM
libscalapack-openmpi2.1:amd64 Scalable Linear Algebra Package - Shared libs for Open
libtrilinos-amesos-13.2:amd64 direct sparse solver package - runtime files
libtrilinos-amesos-dev:amd64 direct sparse solver package - development files
libtrilinos-amesos2-13.2:amd64 next generation direct sparse solver package - runtim
libtrilinos-amesos2-dev:amd64 next generation direct sparse solver package - develop
libtrilinos-epetraext-dev:amd64 extensions to the Epetra toolkit - development files
libtrilinos-ifpack-13.2:amd64 algebraic preconditioners - runtime files
libtrilinos-ifpack-dev:amd64 algebraic preconditioners - development files
libtrilinos-ifpack2-13.2:amd64 next generation algebraic preconditioners - runtime f
libtrilinos-ifpack2-dev:amd64 next generation algebraic preconditioners - developmen
libtrilinos-ml-13.2:amd64 multigrid preconditioning - runtime files
libtrilinos-ml-dev:amd64 multigrid preconditioning - development files
libtrilinos-moertel-13.2:amd64 mortar methods package - runtime files
libtrilinos-moertel-dev:amd64 mortar methods package - development files
libtrilinos-muelu-13.2:amd64 next generation multilevel preconditioner capabilities
libtrilinos-muelu-dev:amd64 next generation multilevel preconditioner capabilities -
libtrilinos-nox-13.2:amd64 robust solution of nonlinear equations - runtime files
libtrilinos-nox-dev:amd64 robust solution of nonlinear equations - development file
libtrilinos-piro-13.2:amd64 embedded nonlinear analysis package - runtime files
libtrilinos-piro-dev:amd64 embedded nonlinear analysis package - development files
libtrilinos-stokhos-13.2:amd64 Trilinos uncertainty quantification package - runtime
libtrilinos-stokhos-dev:amd64 Trilinos uncertainty quantification package - developm
libtrilinos-stratimikos-13.2:amd64 wrappers for linear solvers and preconditioners -
libtrilinos-stratimikos-dev:amd64 wrappers for linear solvers and preconditioners -
libtrilinos-teko-13.2:amd64 block preconditioners - runtime files
libtrilinos-teko-dev:amd64 block preconditioners - development files
libtrilinos-trilinoscouplings-13.2:amd64 combining Trilinos packages - runtime files
libtrilinos-trilinoscouplings-dev:amd64 combining Trilinos packages - development fi
mpi-default-bin Standard MPI runtime programs (metapackage)
mpi-default-dev Standard MPI development files (metapackage)
paraview Parallel Visualization Application
python3-mpi4py bindings of the Message Passing Interface (MPI) standard
python3-paraview Parallel Visualization Application. python-support
trilinos-all-dev:amd64 object-oriented framework for large-scale problems - deve
The following packages are only half configured, probably due to problems
configuring them the first time. The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
openmpi-bin high performance message passing library -- binaries
######################################################################################
After trying a bit around I figured that the source of the problem was probably openmpi.
######################################################################################
>sudo dpkg --configure openmpi-bin
Setting up openmpi-bin (4.1.2-2ubuntu1) ...
update-alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link same as main link /usr/bin/mpicc
dpkg: error processing package openmpi-bin (--configure):
installed openmpi-bin package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
openmpi-bin
#################################################################################
I next tried to remove openmpi in order to reinstall it
#################################################################################
>sudo apt-get remove --auto-remove openmpi-bin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
base58 binutils-dev gdal-data libarmadillo10 libarpack2 libblosc1 libboost-atomic-dev libboost-chrono-dev libboost-container-dev libboost-context-dev libboost-coroutine-dev libboost-date-time-dev
libboost-exception-dev libboost-fiber-dev libboost-filesystem-dev libboost-graph-dev libboost-graph-parallel-dev libboost-iostreams-dev libboost-locale-dev libboost-log-dev libboost-math-dev
libboost-nowide-dev libboost-numpy-dev libboost-program-options-dev libboost-python-dev libboost-random-dev libboost-regex-dev libboost-serialization-dev libboost-stacktrace-dev libboost-system-dev
libboost-test-dev libboost-thread-dev libboost-timer-dev libboost-tools-dev libboost-type-erasure-dev libboost-wave-dev libcaf-openmpi-3 libcfitsio9 libcharls2 libdraco4 libevent-dev libevent-extra-2.1-7
libevent-openssl-2.1-7 libfreexl1 libfyba0 libgdal30 libgeos-c1v5 libgeos3.10.2 libgeotiff5 libhdf4-0-alt libhdf5-openmpi-103-1 libhdf5-openmpi-cpp-103-1 libhdf5-openmpi-dev libhdf5-openmpi-fortran-102
libhdf5-openmpi-hl-100 libhdf5-openmpi-hl-cpp-100 libhdf5-openmpi-hl-fortran-100 libhwloc-dev libiberty-dev libibverbs-dev libkmlbase1 libkmldom1 libkmlengine1 liblaszip8 libmumps-5.4 libmumps-dev
libmumps-headers-dev libnetcdf19 libnl-3-dev libnl-route-3-dev libnuma-dev libodbcinst2 libogdi4.1 libopenmpi-dev libpdal-base13 libpdal-plugin-draco libpdal-plugin-e57 libpdal-plugin-faux libpdal-plugin-hdf
libpdal-plugin-i3s libpdal-plugin-icebridge libpdal-plugin-pgpointcloud libpdal-plugins libpdal-util13 libpmix-dev libpq5 libproj22 libptscotch-6.1 librttopo1 libscalapack-mpi-dev libscalapack-openmpi-dev
libscalapack-openmpi2.1 libscotch-6.1 libspatialite7 libsuperlu5 libtbb2 libtbb2-dev libtbbmalloc2 libtrilinos-amesos-13.2 libtrilinos-amesos-dev libtrilinos-amesos2-13.2 libtrilinos-amesos2-dev
libtrilinos-anasazi-13.2 libtrilinos-anasazi-dev libtrilinos-aztecoo-13.2 libtrilinos-aztecoo-dev libtrilinos-belos-13.2 libtrilinos-belos-dev libtrilinos-epetraext-13.2 libtrilinos-galeri-13.2
libtrilinos-galeri-dev libtrilinos-globipack-13.2 libtrilinos-globipack-dev libtrilinos-ifpack-13.2 libtrilinos-ifpack-dev libtrilinos-ifpack2-13.2 libtrilinos-ifpack2-dev libtrilinos-intrepid-13.2
libtrilinos-intrepid-dev libtrilinos-intrepid2-13.2 libtrilinos-intrepid2-dev libtrilinos-isorropia-13.2 libtrilinos-isorropia-dev libtrilinos-kokkos-dev libtrilinos-kokkos-kernels-13.2
libtrilinos-kokkos-kernels-dev libtrilinos-komplex-13.2 libtrilinos-komplex-dev libtrilinos-ml-13.2 libtrilinos-ml-dev libtrilinos-moertel-13.2 libtrilinos-moertel-dev libtrilinos-muelu-13.2
libtrilinos-muelu-dev libtrilinos-nox-13.2 libtrilinos-nox-dev libtrilinos-optipack-13.2 libtrilinos-optipack-dev libtrilinos-pamgen-13.2 libtrilinos-pamgen-dev libtrilinos-phalanx-13.2
libtrilinos-phalanx-dev libtrilinos-pike-13.2 libtrilinos-pike-dev libtrilinos-piro-13.2 libtrilinos-piro-dev libtrilinos-pliris-13.2 libtrilinos-pliris-dev libtrilinos-rol-13.2 libtrilinos-rol-dev
libtrilinos-rtop-13.2 libtrilinos-rtop-dev libtrilinos-rythmos-13.2 libtrilinos-rythmos-dev libtrilinos-sacado-13.2 libtrilinos-sacado-dev libtrilinos-shards-13.2 libtrilinos-shards-dev
libtrilinos-shylu-13.2 libtrilinos-shylu-dev libtrilinos-stokhos-13.2 libtrilinos-stokhos-dev libtrilinos-stratimikos-13.2 libtrilinos-stratimikos-dev libtrilinos-teko-13.2 libtrilinos-teko-dev
libtrilinos-teuchos-dev libtrilinos-thyra-13.2 libtrilinos-thyra-dev libtrilinos-tpetra-13.2 libtrilinos-tpetra-dev libtrilinos-trilinoscouplings-13.2 libtrilinos-trilinoscouplings-dev
libtrilinos-trilinosss-13.2 libtrilinos-trilinosss-dev libtrilinos-triutils-13.2 libtrilinos-triutils-dev libtrilinos-xpetra-13.2 libtrilinos-xpetra-dev libtrilinos-zoltan-13.2 libtrilinos-zoltan-dev
libtrilinos-zoltan2-13.2 libtrilinos-zoltan2-dev liburiparser1 libxerces-c3.2 mpi-default-bin mpi-default-dev openmpi-bin paraview paraview-doc proj-bin proj-data python3-autobahn python3-base58 python3-cbor
python3-cffi python3-ecdsa python3-flatbuffers python3-mnemonic python3-mpi4py python3-msgpack python3-paraview python3-passlib python3-png python3-pycparser python3-pyqrcode python3-snappy python3-trie
python3-txaio python3-u-msgpack python3-ubjson python3-wsaccel unixodbc-common
0 upgraded, 0 newly installed, 213 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 701 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 877673 files and directories currently installed.)
Removing libhdf5-openmpi-dev (1.10.7+repack-4ubuntu2) ...
update-alternatives: error: no alternatives for mpi
dpkg: error processing package libhdf5-openmpi-dev (--remove):
installed libhdf5-openmpi-dev package pre-removal script subprocess returned error exit status 2
dpkg: too many errors, stopping
Errors were encountered while processing:
libhdf5-openmpi-dev
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
##########################################################################################
The error seems to be related to libhdf5-openmpi-dev. I nevertheless tried to install it (sudo apt install openmpi-bin) and got the same error for package libhdf5-openmpi-dev.
But if I now ran sudo apt update it would not give me an error anymore and the configurations seem to work now.
On the other hand openmpi still seems broken and I can't upgrade inkscape.
##########################################################################################
>sudo apt upgrade inkscape
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
inkscape is already the newest version (1.1.2-3ubuntu1).
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
libvlc5 libimage-magick-perl python3-jupyter-core vlc-data libvlccore9
imagemagick libiperf0 libjs-jquery-ui libmaven3-core-java libavdevice58
ffmpeg libopenexr25 libmagick++-6.q16-8 python3-scipy libpostproc55
libmagickcore-6.q16-6-extra libavcodec58 libimage-magick-q16-perl iperf3
libmagickwand-6.q16-6 libpython2.7 jupyter-core libavutil56
imagemagick-6.q16 libswscale5 libmagickcore-6.q16-6 libswresample3
imagemagick-6-common vlc-plugin-video-output libavformat58 libpmix-dev
libpython2.7-minimal libpmix2 libvlc-bin libpython2.7-stdlib vlc-plugin-base
libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
#
# Canonical released microcode updates for both Intel (CVE-2022-40982) and AMD
# (CVE-2023-20593). ‘Unattended upgrades’ provide security updates by default.
# Ensure it remains enabled to always get all updates as they become available.
#
The following packages have been kept back:
irqbalance
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libhdf5-openmpi-dev (1.10.7+repack-4ubuntu2) ...
update-alternatives: priority must be an integer
Use 'update-alternatives --help' for program usage information.
dpkg: error processing package libhdf5-openmpi-dev (--configure):
installed libhdf5-openmpi-dev package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
libhdf5-openmpi-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)
The cause of the error in my case was a "corrupt" file:
$ sudo dpkg --configure openmpi-bin
Setting up openmpi-bin (4.1.2-2ubuntu1) ...
update-alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link same as main link /usr/bin/mpicc
dpkg: error processing package openmpi-bin (--configure):
installed openmpi-bin package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
openmpi-bin
Delete and recreate the file
$ mv /var/lib/dpkg/alternatives/mpi /var/lib/dpkg/alternatives/mpi.corrupt
sudo dpkg --configure openmpi-bin
Setting up openmpi-bin (4.1.2-2ubuntu1) ...
update-alternatives: warning: /etc/alternatives/mpi has been changed (manually or by a script); switching to manual updates only
update-alternatives: using /usr/bin/mpicc.openmpi to provide /usr/bin/mpicc (mpi) in auto mode
Now it is possible to complete the install of the problematic package.