apt-get autoremove 无法像宣传的那样工作

apt-get autoremove 无法像宣传的那样工作

我想问一下 apt-get 中自动删除功能的异常行为,它“应该”删除剩余的自动安装的软件包,这些软件包是实际(手动)安装的软件包的依赖项。但事实并非如此。以下输出显示了一个示例。

$ sudo apt-get --no-install-recommends install equivs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  binutils debhelper dh-apparmor dpkg-dev fakeroot gettext html2text intltool-debian libdpkg-perl libgettextpo0 libunistring0 make po-debconf
Suggested packages:
  binutils-doc dh-make debian-keyring gettext-doc make-doc libmail-box-perl
Recommended packages:
  gcc c-compiler build-essential libalgorithm-merge-perl libmail-sendmail-perl
The following NEW packages will be installed:
  binutils debhelper dh-apparmor dpkg-dev equivs fakeroot gettext html2text intltool-debian libdpkg-perl libgettextpo0 libunistring0 make
  po-debconf
0 upgraded, 14 newly installed, 0 to remove and 299 not upgraded.
Need to get 6,841 kB of archives.
After this operation, 17.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://es.archive.trisquel.info/trisquel/ toutatis/main libunistring0 i386 0.9.3-5 [432 kB]
Get:2 http://es.archive.trisquel.info/trisquel/ toutatis/main libgettextpo0 i386 0.18.1.1-5ubuntu3 [118 kB]
Get:3 http://es.archive.trisquel.info/trisquel/ toutatis-updates/main binutils i386 2.22-6ubuntu1.1 [2,387 kB]
Get:4 http://es.archive.trisquel.info/trisquel/ toutatis/main libdpkg-perl all 1.16.1.2ubuntu7.1+6.0trisquel2 [653 kB]
Get:5 http://es.archive.trisquel.info/trisquel/ toutatis-updates/main make i386 3.81-8.1ubuntu1.1 [116 kB]
Get:6 http://es.archive.trisquel.info/trisquel/ toutatis/main dpkg-dev all 1.16.1.2ubuntu7.1+6.0trisquel2 [939 kB]
Get:7 http://es.archive.trisquel.info/trisquel/ toutatis/main html2text i386 1.3.2a-15 [101 kB]
Get:8 http://es.archive.trisquel.info/trisquel/ toutatis/main gettext i386 0.18.1.1-5ubuntu3 [1,122 kB]
Get:9 http://es.archive.trisquel.info/trisquel/ toutatis/main intltool-debian all 0.35.0+20060710.1 [31.6 kB]
Get:10 http://es.archive.trisquel.info/trisquel/ toutatis/main po-debconf all 1.0.16+nmu2ubuntu1 [210 kB]
Get:11 http://es.archive.trisquel.info/trisquel/ toutatis-updates/main dh-apparmor all 2.7.102-0ubuntu3.9 [8,950 B]
Get:12 http://es.archive.trisquel.info/trisquel/ toutatis/main debhelper all 9.20120115ubuntu3 [616 kB]
Get:13 http://es.archive.trisquel.info/trisquel/ toutatis/main fakeroot i386 1.18.2-1 [87.9 kB]
Get:14 http://es.archive.trisquel.info/trisquel/ toutatis/main equivs all 2.0.9 [18.5 kB]
Fetched 6,841 kB in 2s (2,734 kB/s)
Selecting previously unselected package libunistring0.
(Reading database ... 131645 files and directories currently installed.)
Unpacking libunistring0 (from .../libunistring0_0.9.3-5_i386.deb) ...
Selecting previously unselected package libgettextpo0.
Unpacking libgettextpo0 (from .../libgettextpo0_0.18.1.1-5ubuntu3_i386.deb) ...
Selecting previously unselected package binutils.
Unpacking binutils (from .../binutils_2.22-6ubuntu1.1_i386.deb) ...
Selecting previously unselected package libdpkg-perl.
Unpacking libdpkg-perl (from .../libdpkg-perl_1.16.1.2ubuntu7.1+6.0trisquel2_all.deb) ...
Selecting previously unselected package make.
Unpacking make (from .../make_3.81-8.1ubuntu1.1_i386.deb) ...
Selecting previously unselected package dpkg-dev.
Unpacking dpkg-dev (from .../dpkg-dev_1.16.1.2ubuntu7.1+6.0trisquel2_all.deb) ...
Selecting previously unselected package html2text.
Unpacking html2text (from .../html2text_1.3.2a-15_i386.deb) ...
Selecting previously unselected package gettext.
Unpacking gettext (from .../gettext_0.18.1.1-5ubuntu3_i386.deb) ...
Selecting previously unselected package intltool-debian.
Unpacking intltool-debian (from .../intltool-debian_0.35.0+20060710.1_all.deb) ...
Selecting previously unselected package po-debconf.
Unpacking po-debconf (from .../po-debconf_1.0.16+nmu2ubuntu1_all.deb) ...
Selecting previously unselected package dh-apparmor.
Unpacking dh-apparmor (from .../dh-apparmor_2.7.102-0ubuntu3.9_all.deb) ...
Selecting previously unselected package debhelper.
Unpacking debhelper (from .../debhelper_9.20120115ubuntu3_all.deb) ...
Selecting previously unselected package fakeroot.
Unpacking fakeroot (from .../fakeroot_1.18.2-1_i386.deb) ...
Selecting previously unselected package equivs.
Unpacking equivs (from .../archives/equivs_2.0.9_all.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Setting up libunistring0 (0.9.3-5) ...
Setting up libgettextpo0 (0.18.1.1-5ubuntu3) ...
Setting up binutils (2.22-6ubuntu1.1) ...
Setting up libdpkg-perl (1.16.1.2ubuntu7.1+6.0trisquel2) ...
Setting up make (3.81-8.1ubuntu1.1) ...
Setting up dpkg-dev (1.16.1.2ubuntu7.1+6.0trisquel2) ...
Setting up html2text (1.3.2a-15) ...
Setting up gettext (0.18.1.1-5ubuntu3) ...
Setting up intltool-debian (0.35.0+20060710.1) ...
Setting up po-debconf (1.0.16+nmu2ubuntu1) ...
Setting up dh-apparmor (2.7.102-0ubuntu3.9) ...
Setting up debhelper (9.20120115ubuntu3) ...
Setting up fakeroot (1.18.2-1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode.
Setting up equivs (2.0.9) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

$ sudo apt-get autoremove equivs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  equivs
0 upgraded, 0 newly installed, 1 to remove and 299 not upgraded.
After this operation, 87.0 kB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.

$ sudo apt-get remove equivs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  equivs
0 upgraded, 0 newly installed, 1 to remove and 299 not upgraded.
After this operation, 87.0 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 132810 files and directories currently installed.)
Removing equivs ...
Processing triggers for man-db ...

$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 299 not upgraded.

已在“Trisquel 6.0 32 位”、“Ubuntu 12.04.3 32 位”和“Debian 7.0 Gnome 32 位”上进行了测试。它们均无法完成删除自动安装的软件包/依赖项的任务。

我的问题是,问题出在哪里?

答案1

问题是您仍有待处理的软件包,apt-get 会尝试删除尽可能少的软件包,如果其他软件包具有“间接”依赖关系,它将无法按预期工作。其中一些甚至可能具有循环依赖关系,从而阻止它们被卸载。此外,该存储库似乎很不可靠,因此不要信任它。

如果您使用 aptitude 并询问why每个软件包,您将检测到该软件包的依赖关系在哪里。

我建议您阅读我的其他答案,了解 apt-get 如何根据需要考虑依赖项。您也可以使用它apt-cache rdepends package来查找反向依赖项,但 aptitude 似乎更精简且更易于使用。

相关内容