I just upgrade from ubuntu 16.04 to Ubuntu 18.04.

Before then end of the upgrade, it asked me if I want to delete obsoletes packages and packages installed automatically no more used.

I answered "no", because I need to keep some packages (php7.0). Now I migrated to the newer packages (php7.2) how do I retrieve and delete obsoletes packages ?

I tried apt autoremove but it seems not to delete obsolete packages. What is the command used by do-release-upgrade to retrieve these packages ?


This answer has a couple of examples on how to retrieve obsolete packages.

It should be fairly easy then to remove them.

A simple oneliner (warning not tested!) can be:

aptitude show '~o' | grep Package: | cut -d' ' -f2 | xargs -n1 -l --verbose sudo apt-get purge -y

I use

apt list --installed | grep -v xenial

to list all packages that are not in Xenial (change release name accordingly, of course). Then I remove them manually; I am extremely wary of automating package management tasks.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.