In general, apt-get autoremove
removes packages that have been installed as a dependency of some other package which is now no longer installed. I noticed that my list of orphaned packages includes things like emacs24
and tmux
, which I definitely want to keep. Is it possible to find out which other (now missing) package was responsible for installing them in the first place?
Ubuntu – How to find reason for orphaned packages in apt-get autoremove
aptpackage-management
Best Answer
Automatically:
One of the solutions is to use
aptitude
, first install it:Now to find out why a package has been installed on your Ubuntu you can run:
However note that:
Also:
In conclusion if you can't find a related package, then there is a high chance that this package has been installed as a dependency or recommendation of on of the other packages that is going to be removed using
apt autoremove
, or somehow is related to this chain.Manually
First let's produce a situation then try to find out why a package has been installed, I first installed
vlc
on my system:after that I only remove the
vlc
itself usingsudo apt remove vlc
, now if I runsudo apt autoremove
I'll get:let's first check one of them using
aptitude
:however the other one because of a direct dependency chain will work fine:
pay attention to the
c
it means that the package was deleted but its configuration files still lives on my system so there is a high chance (in this case 100%) thatvlc-bin
was installed byvlc
.Now let's back to our job and findout why
libqt5x11extras5
lives on our Ubuntu:using
apt-cache rdepends
I'm looking for all packages which has dependency onlibqt5x11extras5
, then I'm looking for the ones which are installed or was installed on my system usingdpkg
with the combination ofgrep
, the result is:see? we found out that this package was related to another package that is in our
autoremove
list:vlc-plugin-qt
, at the end:and we came back to the
vlc
.