为什么 apt 会隐式安装或卸载其他软件包?

为什么 apt 会隐式安装或卸载其他软件包?

这种情况经常发生在我身上,即在安装软件包的过程中package X,其他软件包被隐式安装或卸载。

这变得非常烦人,在您意识到之前,您的其他 3 个软件包已经消失了,就像那样。

更清楚地说,今天我想Grive2cmake.所以你想cmake先安装。

令我惊讶的是,运行 apt install cmake -s表明它将安装其他软件包,例如、php7.0ettercap等。rtorrentuget

root@XXXXX_XXXXCE:/home/bob/pythontr# apt install cmake -s
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 
coinor-libosi1v5 erlang-asn1
  erlang-base erlang-crypto erlang-mnesia erlang-public-key erlang-runtime-tools erlang-ssl 
fonts-opensymbol libabw-0.1-1
  libboost-date-time1.61.0 libboost-date-time1.62.0 libboost-filesystem1.62.0 libboost-
iostreams1.62.0
  libboost-locale1.62.0 libcdr-0.1-1 libclang-common-3.7-dev libclc-amdgcn libclc-dev 
libclc-r600 libclucene-contribs1v5
  libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 
libexttextcat-2.0-0
  libexttextcat-data libfreehand-0.1-1 libjs-jquery-form liblangtag-common liblangtag1 
libllvm3.7 libmspub-0.1-1
  libmwaw-0.3-3 libmythes-1.2-0 libodfgen-0.1-1 liborcus-0.13-0 libpagemaker-0.0-0 
libqxp-0.0-0 librevenge-0.0-0 libsctp1
  libstaroffice-0.0-0 libsuitesparseconfig4 libtorrent19 libvisio-0.1-1 libwpd-0.10-10 
libwpg-0.3-3 libwps-0.4-4 libxmlsec1
  libxmlsec1-nss libzmf-0.0-0 lp-solve mesa-opencl-icd ocl-icd-libopencl1 uno-libs3 ure
**Use 'apt autoremove' to remove them.**
The following additional packages will be installed:
  cmake-data dirb erlang-asn1 erlang-base erlang-crypto erlang-mnesia erlang-public-key 
erlang-runtime-tools erlang-ssl
  ettercap-common ettercap-graphical libafflib0v5 libapache2-mod-php7.0 libcppunit-1.14-0 
libcurl4 libncurses6 libncursesw6
  librhash0 libtinfo6 libtorrent20 libxmlrpc-core-c3 osslsigncode php7.0-bz2 php7.0-cli     
php7.0-common php7.0-curl
  php7.0-dev php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-opcache php7.0-
readline php7.0-xml php7.0-zip
  rtorrent ruby-ethon uget
Suggested packages:
  cmake-doc ninja-build erlang erlang-manpages erlang-doc erlang-tools erlang-inets
Recommended packages:
  erlang-syntax-tools
The following packages will be REMOVED:
  couchdb erlang-eunit erlang-inets erlang-os-mon erlang-snmp erlang-syntax-tools 
erlang-tools erlang-webtool erlang-xmerl
  libcurl3
The following NEW packages will be installed:
  cmake cmake-data libcppunit-1.14-0 libcurl4 libncurses6 librhash0 libtorrent20
The following packages will be upgraded:
  dirb erlang-asn1 erlang-base erlang-crypto erlang-mnesia erlang-public-key erlang-    
runtime-tools erlang-ssl
  ettercap-common ettercap-graphical libafflib0v5 libapache2-mod-php7.0 libncursesw6     
libtinfo6 libxmlrpc-core-c3
  osslsigncode php7.0-bz2 php7.0-cli php7.0-common php7.0-curl php7.0-dev php7.0-gd 
php7.0-json php7.0-mbstring
  php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml php7.0-zip rtorrent ruby-ethon     
uget

我确信这些额外的安装与cmake.

问题

有没有办法告诉apt只安装一个包 iecmake不是处理其他不相关的包?

[编辑]

根据 @Stephen Kitt 的要求,
运行apt install -f返回:-

root@XXXXX_XXXXCE:/home/bob/pythontr# apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer  
required:
  coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5
  coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1
  libboost-date-time1.61.0 libboost-date-time1.62.0 libboost-   
filesystem1.62.0
  libboost-iostreams1.62.0 libboost-locale1.62.0 libcdr-0.1-1
  libclang-common-3.7-dev libclc-amdgcn libclc-dev libclc-r600
  libclucene-contribs1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1     
libeot0
  libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data
  libfreehand-0.1-1 liblangtag-common liblangtag1 libllvm3.7 libmspub-   
0.1-1
  libmwaw-0.3-3 libmythes-1.2-0 libodfgen-0.1-1 liborcus-0.13-0
  libpagemaker-0.0-0 libqxp-0.0-0 librevenge-0.0-0 libstaroffice-0.0-0
  libsuitesparseconfig4 libvisio-0.1-1 libwpd-0.10-10 libwpg-0.3-3
  libwps-0.4-4 libxmlsec1 libxmlsec1-nss libzmf-0.0-0 lp-solve
  mesa-opencl-icd ocl-icd-libopencl1 uno-libs3 ure
Use 'apt autoremove' to remove them.

[编辑]

尝试cmake通过运行apt-cache depends cmake返回来列出依赖项:-

root@XXXXX_XXXXCE:/home/bob/pythontr# apt-cache depends cmake
cmake
  Depends: cmake-data
  Depends: procps
  Depends: libarchive13
  Depends: libc6
  Depends: libcurl4
  Depends: libexpat1
  Depends: libgcc1
  Depends: libjsoncpp1
  Depends: librhash0
  Depends: libstdc++6
  Depends: libuv1
  Depends: zlib1g
  Recommends: gcc
  Recommends: make
    make-guile
  Suggests: cmake-doc
  Suggests: ninja-build

答案1

由于已选择安装的包推荐或建议,其他一些包被作为依赖项拉取。推荐的软件包不是必需的,但需要完整的功能。推荐和建议的包之间关系的确切细节记录在Debian 政策

您可以使用--no-install-recommends以避免拉取推荐的包作为依赖项。

如果您不想自动安装推荐或建议的软件包,请创建一个配置文件 /etc/apt/apt.conf.d/90-no-recommends.conf

APT::Install-Recommends 0;
APT::Install-Suggests 0;

如果某个软件包作为自动依赖项自动安装,并且在升级后将其拉取为依赖项的原始软件包已被删除或不再需要它,则可以将其标记为稍后自动删除。

请注意,这不是一个完整的答案,正如 @StephenKitt 在评论中指出的那样,推荐和建议的依赖项并不能解释所有涉及的包。包含您提到的软件包还有其他一些原因。

答案2

一般来说,这些其他软件包是您的选择因某种原因而依赖的软件包。这是一件好事。证明每个包的合理性超出了我的回答范围,但有人花时间构建了依赖项数据库,并且通常运行良好。大多数安装程序(例如 apt)都可以选择忽略/不处理依赖项,但结果很可能不是您所期望的。 apt 的选项是 --nodeps。

相关内容