如何找出 apt 安装特定软件包的原因

如何找出 apt 安装特定软件包的原因

刚刚尝试在我的 Buster -monitoring-plugins-standard 中安装以下软件包,并注意到以下输出:

The following additional packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libarchive13 libassuan0 libavahi-client3 libavahi-common-data libavahi-common3
  libcups2 libdbi1 libgpgme11 libksba8 libldb1 libnet-snmp-perl libnpth0 libpq5 libradcli4 libsensors-config libsensors5 libsmbclient libsnmp-base libsnmp30 libtalloc2 libtdb1
  libtevent0 libtirpc-common libtirpc3 libwbclient0 pinentry-curses python-crypto python-gpg python-ldb python-samba python-talloc python-tdb rpcbind samba-common samba-common-bin
  samba-dsdb-modules samba-libs smbclient snmp

有人可以帮我理解为什么 apt 要安装 gnupg 吗?

看看推荐的套餐:

Recommends: bind9-host | host, dnsutils, libnet-snmp-perl, rpcbind, smbclient, snmp, sudo, libdbi1 (>= 0.8.4), libgnutls30 (>= 3.6.5), libldap-2.4-2 (>= 2.4.7), libmariadb3 (>= 3.0.0), libpq5, libradcli4, zlib1g (>= 1:1.1.4)

我不明白哪个确切的包强制安装 gnupg。有人可以以 gnupg 包为例向我解释附加包安装逻辑吗?谢谢。

答案1

aptitude可以告诉你:

$ aptitude why monitoring-plugins-standard gnupg
p   monitoring-plugins-standard Recommends smbclient
i A smbclient                   Depends    samba-common (= 2:4.9.5+dfsg-5+deb10u1)
i A samba-common                Recommends samba-common-bin
i A samba-common-bin            Recommends samba-dsdb-modules
i A samba-dsdb-modules          Depends    libgpgme11 (>= 1.2.0)
i A libgpgme11                  Recommends gpgsm
i A gpgsm                       Recommends gnupg (= 2.2.12-1+deb10u1)

即使没有安装任何软件包也可以工作。

答案2

斯蒂芬的回答告诉您如何找出原因。扩展一下,如果您不想gnupg安装,可以防止这种情况发生。

Debian 软件包知道多种依赖关系,其中包括:

  • a depends b:b必须安装软件包。
  • a recommends b:包b是可选的,但推荐使用。它们是默认安装的。
  • a suggests b:软件包b可能有用,但默认情况下不安装。

由于gnupg推荐(甚至在链中的几个点),你不安装它。您可以通过添加gnupg到安装命令中来告诉 apt 这一点,但附加一个-.或者,您可以使用--no-install-recommends(对于 aptitude: )跳过所有推荐的软件包--without-recommends

默认:

# apt install monitoring-plugins-standard
Suggested packages:
  dbus-user-session pinentry-gnome3 tor rblcheck parcimonie xloadimage scdaemon lrzip
  cups-common libcrypt-des-perl libdigest-hmac-perl libio-socket-inet6-perl lm-sensors
  snmp-mibs-downloader icinga | icinga2 fping qstat pinentry-doc python-crypto-doc
  heimdal-clients cifs-utils
The following NEW packages will be installed:
  dirmngr dnsutils gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libarchive13 libassuan0 libavahi-client3
  libavahi-common-data libavahi-common3 libcups2 libdbi1 libgpgme11 libirs161 libjansson4
  libksba8 libldb1 libnet-snmp-perl libnpth0 libpq5 libradcli4 libsensors-config
  libsensors5 libsmbclient libsnmp-base libsnmp30 libtalloc2 libtdb1 libtevent0
  libwbclient0 monitoring-plugins-basic monitoring-plugins-common
  monitoring-plugins-standard pinentry-curses python-crypto python-gpg python-ldb
  python-samba python-talloc python-tdb rpcbind samba-common samba-common-bin
  samba-dsdb-modules samba-libs smbclient snmp sudo
0 upgraded, 54 newly installed, 0 to remove and 1 not upgraded.
Need to get 25.7 MB of archives.
After this operation, 85.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]

不包括gnupg

# apt install monitoring-plugins-standard gnupg- 
Suggested packages:
  dbus-user-session pinentry-gnome3 tor rblcheck scdaemon lrzip cups-common
  libcrypt-des-perl libdigest-hmac-perl libio-socket-inet6-perl lm-sensors
  snmp-mibs-downloader icinga | icinga2 fping qstat pinentry-doc python-crypto-doc
  heimdal-clients cifs-utils
Recommended packages:
  gnupg
The following NEW packages will be installed:
  dirmngr dnsutils gpg gpg-agent gpg-wks-client gpgconf gpgsm libarchive13 libassuan0
  libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdbi1 libgpgme11
  libirs161 libjansson4 libksba8 libldb1 libnet-snmp-perl libnpth0 libpq5 libradcli4
  libsensors-config libsensors5 libsmbclient libsnmp-base libsnmp30 libtalloc2 libtdb1
  libtevent0 libwbclient0 monitoring-plugins-basic monitoring-plugins-common
  monitoring-plugins-standard pinentry-curses python-crypto python-gpg python-ldb
  python-samba python-talloc python-tdb rpcbind samba-common samba-common-bin
  samba-dsdb-modules samba-libs smbclient snmp sudo
0 upgraded, 50 newly installed, 0 to remove and 1 not upgraded.
Need to get 22.6 MB of archives.
After this operation, 77.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]

排除smbclient(这就是引入 的原因gnupg):

# apt install monitoring-plugins-standard smbclient-
Suggested packages:
  rblcheck libcrypt-des-perl libdigest-hmac-perl libio-socket-inet6-perl lm-sensors
  snmp-mibs-downloader icinga | icinga2 fping qstat
Recommended packages:
  smbclient
The following NEW packages will be installed:
  dnsutils libdbi1 libirs161 libnet-snmp-perl libpq5 libradcli4 libsensors-config
  libsensors5 libsnmp-base libsnmp30 monitoring-plugins-basic monitoring-plugins-common
  monitoring-plugins-standard rpcbind snmp sudo
0 upgraded, 16 newly installed, 0 to remove and 1 not upgraded.
Need to get 6,904 kB of archives.
After this operation, 17.5 MB of additional disk space will be used.
Do you want to continue? [Y/n]

排除所有推荐:

# apt install --no-install-recommends monitoring-plugins-standard 
Suggested packages:
  icinga | icinga2 fping qstat
Recommended packages:
  dnsutils libnet-snmp-perl rpcbind smbclient snmp sudo libdbi1 libpq5 libradcli4
The following NEW packages will be installed:
  monitoring-plugins-basic monitoring-plugins-common monitoring-plugins-standard
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
Need to get 522 kB of archives.
After this operation, 3,088 kB of additional disk space will be used.
Do you want to continue? [Y/n]

(为简洁起见,对 apt 输出进行了稍微编辑)

相关内容