Site Tools


start:orphanedcleanup

This is an old revision of the document!


On testing it is possible a package is removed that you have installed, due to some issue with the package or that is is abandoned. For this reason it is a good idea to every now and again check that the packages on your system have not become orphaned and you still have a pretty clean system.

Its also worthwhile checking if any recommended packages are missing from time to time. Its essentially just checking that what your system has is logical and will be kept up to date by apt. By doing this you will reduce the amount of problems you have as well as avoid having to reinstall your OS clean because you are auditing it and keeping it under control.

The first thing I like to do is ensure I have cleaned up any unneeded packages apt detects itself:

sudo apt-get autoremove

That is safe to do as apt is detecting what it needs and removes what it does not. However you should always read what it wants to remove and check you agree its logical.

Next thing I like to do is check if there were any recommended packages that I needed but did not get installed:

sudo apt-get install aptitude
sudo aptitude search '~RBrecommends:~i'

Aptitude can search for packages you have installed and then what packages they recommended you install. I dont suggest you install any or all of them, instead look to see fi there are any useful packages you would benefit from. Here is my list:

After reviewing the list I decided there was nothing appropriate for me. Its totally fine to not want anything in that list. Its simply what apt is suggesting.

Now I have a clean place to start from and the packages I want installed, I can now look for packages I dont want, and are orphaned.

Orphaned packages are bad, because they will never receive an update. They no longer reside in any source in your apt package manager, for whatever reason. So this is where we must tread carefully as we can break our install if we remove packages that we need, but somehow became orphaned.

In any case our overall goal should be to decide, do we want this? If yes - try to find why its no longer in the repositories we have configured. If no - see if removing it is dangerous.

We ideally want all packages to be in our repositories so they can get updated when needed. In practice this will almost be certainly impossible, but we can get close and ensure that things we cant resolve are at least known to us.

So here is the command:

sudo aptitude search '~o'

Here is my output:

So this output is interesting. I see that several packages are orphaned that need critical attention. The first package gcc-9-base is no longer in the testing repository. This is actually an issue that needs a resolution. It is a library. If I check what I have installed I can see I have installed gcc-10-base, gcc11-base and gcc-12-base.

I can see this by issuing command:

sudo dpkg-query -l 'gcc-*'
start/orphanedcleanup.1652811796.txt.gz · Last modified: 2022/05/17 18:23 by peter