删除使用 dpkg 安装的软件包及其依赖项

删除使用 dpkg 安装的软件包及其依赖项

我有几个版本的 libseccomp2:

$ apt list -a libseccomp2
Listing... Done
libseccomp2/now 2.5.1-1 armhf [installed,local]
libseccomp2/buster-backports 2.4.4-1~bpo10+1 armhf
libseccomp2/bionic-updates,bionic-security 2.4.3-1ubuntu3.18.04.3 armhf
libseccomp2/bionic 2.3.1-2.1ubuntu4 armhf

我需要删除使用 dpkg 安装的 libseccomp2/now 2.5.1-1 armhf。但是,每当我尝试使用 dpkg 或 apt 删除它时,都无法删除,因为依赖项:

软件包:

$ sudo dpkg -r libseccomp2
dpkg: dependency problems prevent removal of libseccomp2:armhf:
 man-db depends on libseccomp2 (>= 2.1.0).
 apt depends on libseccomp2 (>= 1.0.1).
 systemd depends on libseccomp2 (>= 2.3.1).
 containerd depends on libseccomp2 (>= 2.4.0).
 runc depends on libseccomp2 (>= 2.4.0).
 docker.io depends on libseccomp2 (>= 2.1.0).

dpkg: error processing package libseccomp2:armhf (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 libseccomp2:armhf

易于:

The following packages will be REMOVED:
  apt apt-transport-https apt-utils colord containerd dbus-user-session docker.io init libnss-systemd libpam-systemd
  libseccomp2 man-db netplan.io network-manager network-manager-pptp nplan policykit-1 runc snapd systemd systemd-sysv
  ubuntu-minimal
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt libseccomp2 (due to apt) init systemd-sysv (due to init)
0 upgraded, 0 newly installed, 22 to remove and 0 not upgraded.

我怎样才能删除该软件包而不删除所有必需的软件包(例如 apt)?

答案1

如果不破坏你的系统,你就不能完全删除它libseccomp2,因为许多基本软件包都依赖于它。

但是你可以切换到它的另一个版本,例如2.4.3-1ubuntu3.18.04.3通过运行:

sudo apt install libseccomp2=2.4.3-1ubuntu3.18.04.3

相关内容