apt-get purge 会删除反向依赖吗?

apt-get purge 会删除反向依赖吗?

假设我们sudo apt-get purge mypackage。如果mypackage(它的依赖项yourpackage)在我们清除 时也安装了mypackagemypackage那么 也会被删除吗?

答案1

一个简单的测试将回答你:

$ apt-cache depends vim
vim
  Depends: vim-common
  Depends: vim-runtime
  Depends: libacl1
  Depends: libc6
      ......

现在你可以看到,vim 包依赖于 vim-common。因此,让我们尝试删除该包vim-common

$ sudo apt-get remove vim-common 
Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following packages will be REMOVED:
  ubuntu-minimal vim vim-common vim-tiny
0 upgraded, 0 newly installed, 4 to remove and 2 not upgraded.
After this operation, 3,268 kB disk space will be freed.
Do you want to continue [Y/n]? 

看一下这一行:

The following packages will be REMOVED:
   ubuntu-minimal vim vim-common vim-tiny

因此,总而言之,删除一个包将导致所有依赖于它的包也被删除。

答案2

最好使用--dry-run检查会发生什么,以防止意外损坏。

apt purge vim-common --dry-run

相关内容