Libpulse 依赖错误 – 无法在 Ubuntu 中重新安装 Pulseaudio

这个简短的指南解释了如何修复 libpulse 依赖错误在 Ubuntu 中重新安装 Pulseaudio 及其衍生产品,如 Linux Mint 和 Pop OS。

今天,我不小心在我的 Ubuntu 18.04 桌面上删除了 Pulseaudio。 当我尝试使用以下命令重新安装 Puslseaudio 时:

$ sudo apt install pulseaudio

我遇到了以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 pulseaudio : Depends: libpulse0 (= 1:11.1-1ubuntu7.4) but 1:12.2-9~bionic1 is to be installed
              Depends: pulseaudio-utils but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

修复 libpulse 依赖错误并在 Ubuntu 中重新安装 Pulseaudio

我运行以下命令来修复丢失的依赖项。

$ sudo apt install -f

它没有解决错误,因为没有丢失的包。

我尝试使用命令更新所有软件包:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade

它也没有帮助。 我的 Ubuntu 系统已经是最新的了!

我尽我所能,运行了各种 Ubuntu 论坛和博客中建议的所有步骤。 他们都没有帮助! 我每次都遇到同样的错误。 我几乎放弃了安装 Pulseaudio 的想法。 我决定最后一次强制重新安装 libpulse 包 有效!! 如果您在 Ubuntu 上重新安装 Pulseaudio 时遇到 libpulse 依赖问题,请尝试以下解决方法。

修复 libpulse 依赖错误并在 Ubuntu 中重新安装 pulseaudio

首先,使用以下命令强制安装 libpulse0 包:

$ sudo dpkg -P --force-depends libpulse0
$ sudo dpkg -P --force-depends libpulse-mainloop-glib0
$ sudo apt install libpulse0/bionic-updates

然后,使用命令安装损坏的依赖项:

$ sudo apt --fix-broken install

最后,使用命令重新安装 Pulseaudio 包:

$ sudo apt install pulseaudio

Pulseaudio 现在应该安装。

如果您仍然无法安装 Pulseaudio,请尝试以下命令:

$ sudo dpkg --force-depends -r libpulse0
$ sudo apt-get -f install
$ sudo apt install pulseaudio

希望这可以帮助。