'apt-get autoremove' leaves many unneeded dependencies

apt
18-04-bionic

#1

I installed java-package to create a .deb for an old version of java. It had a lot of dependencies:

Commandline: apt-get install java-package
Requested-By: testing (1000)
Install: libgcc-7-dev:amd64 (7.3.0-27ubuntu1~18.04, automatic), libmpx2:amd64 (8.2.0-1ubuntu2~18.04, automatic), libltdl-dev:amd64 (2.4.6-2, automatic), autotools-dev:amd64 (20180224.1, automatic), libmail-sendmail-perl:amd64 (0.80-1, automatic), m4:amd64 (1.4.18-1, automatic), linux-libc-dev:amd64 (4.15.0-45.48, automatic), libfakeroot:amd64 (1.22-2ubuntu1, automatic), libc6-dev:amd64 (2.27-3ubuntu1, automatic), libarchive-cpio-perl:amd64 (0.10-1, automatic), libalgorithm-diff-perl:amd64 (1.19.03-1, automatic), libalgorithm-merge-perl:amd64 (0.08-3, automatic), libitm1:amd64 (8.2.0-1ubuntu2~18.04, automatic), dh-autoreconf:amd64 (17, automatic), g++:amd64 (4:7.3.0-3ubuntu2.1, automatic), automake:amd64 (1:1.15.1-3ubuntu2, automatic), gcc:amd64 (4:7.3.0-3ubuntu2.1, automatic), libcilkrts5:amd64 (7.3.0-27ubuntu1~18.04, automatic), libasan4:amd64 (7.3.0-27ubuntu1~18.04, automatic), libquadmath0:amd64 (8.2.0-1ubuntu2~18.04, automatic), dh-strip-nondeterminism:amd64 (0.040-1.1~build1, automatic), build-essential:amd64 (12.4ubuntu1, automatic), libfile-stripnondeterminism-perl:amd64 (0.040-1.1~build1, automatic), po-debconf:amd64 (1.0.20, automatic), libstdc++-7-dev:amd64 (7.3.0-27ubuntu1~18.04, automatic), autoconf:amd64 (2.69-11, automatic), libtsan0:amd64 (8.2.0-1ubuntu2~18.04, automatic), libubsan0:amd64 (7.3.0-27ubuntu1~18.04, automatic), g++-7:amd64 (7.3.0-27ubuntu1~18.04, automatic), make:amd64 (4.1-9.1ubuntu1, automatic), fakeroot:amd64 (1.22-2ubuntu1, automatic), gcc-7:amd64 (7.3.0-27ubuntu1~18.04, automatic), liblsan0:amd64 (8.2.0-1ubuntu2~18.04, automatic), debhelper:amd64 (11.1.6ubuntu2, automatic), manpages-dev:amd64 (4.15-1, automatic), libc-dev-bin:amd64 (2.27-3ubuntu1, automatic), java-package:amd64 (0.62), autopoint:amd64 (0.19.8.1-6ubuntu0.1, automatic), libatomic1:amd64 (8.2.0-1ubuntu2~18.04, automatic), libalgorithm-diff-xs-perl:amd64 (0.04-5, automatic), libsys-hostname-long-perl:amd64 (1.5-1, automatic), libtool:amd64 (2.4.6-2, automatic), dpkg-dev:amd64 (1.19.0.5ubuntu2.1, automatic)

After creating and installing the package, I uninstalled java-package then ran 'apt-get autoremove' but only a small number of the dependencies were removed:

Commandline: apt-get autoremove
Requested-By: testing (1000)
Remove: libmail-sendmail-perl:amd64 (0.80-1), libarchive-cpio-perl:amd64 (0.10-1), dh-autoreconf:amd64 (17), dh-strip-nondeterminism:amd64 (0.040-1.1~build1), libfile-stripnondeterminism-perl:amd64 (0.040-1.1~build1), po-debconf:amd64 (1.0.20), debhelper:amd64 (11.1.6ubuntu2), libsys-hostname-long-perl:amd64 (1.5-1)

I tried to manually remove some of the leftover unneeded dependencies, and there were no errors. But I thought the whole point of autoremove was that I shouldn't need to do that.


#2

Yeah that seems annoying. I've found that sometimes I need to run deborphan (install with apt install deborphan) and apt autoremove a few times in alternating fashion to actually clean up any stray dependencies...


#3

OK, thanks for the suggestion.