apt-get autoremove doesn't work the way it's advertised
I wanna ask about the abnormal behaviour of the auto-remove function in apt-get, which "should" remove the remaining automatically installed packages, that came as a dependency of the actually (manually) installed package(s). But it is not the case. The following output shows an example of this.
$ 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.
This was tested on "Trisquel 6.0 32-bit", "Ubuntu 12.04.3 32-bit", and "Debian 7.0 Gnome 32-bit". All of them was unable to fulfil the task of removing the automatically installed packages/dependencies.
My question is, where is the problem?
The problem is that you still have packages pending, apt-get tries to remove the less amount of packages possibles also if some other package has an "indirect" dependencies it will not work as you will be expecting. Some of them might even has circular dependencies that prevent them from being uninstalled. Also that repo seems doggy enough to don't trust it.
If you use aptitude instead and ask why
of each package you will detect where it's is the dependency holding the package.
I recommend you reading my other answer about how apt-get considers dependencies as required. You can also use apt-cache rdepends package
to find the reverse dependencies but aptitude seems more streamlined and easier to use.
- https://askubuntu.com/a/346097/169736