I've upgraded Ubuntu 14.04 server to 16.04 (the LTS upgrade). Now there are two pages of packages with the "deinstall" state in the dpkg output. Does that mean the packages are still installed? Does that also mean that I now have the old and new versions of the software running, i.e. PHP 5.5 and 7.0, or MySQL 5.6 and 5.7? Is it necessary to clean up after the upgrade process, or will that happen automatically after some time? Will purging old packages delete the config file for newer versions as well if they are in the same path?

sudo do-release-upgrade
dpkg --get-selections |grep deinstall

By default apt-get remove command doesn't purge anything related to the package. This eventually means that a log of configuration files are left scattered around the place with no corresponding packages.

So, you'll have to remove the package and the configuration files. Currently there are 2 ways to do this:

To remove single package, use below command.

sudo apt-get --purge remove <package_name>

To remove ALL package with deinstalled status, use below command.

sudo dpkg --purge `dpkg --get-selections | grep deinstall | cut -f1`

If you want to check what deinstalled packages that gonna be removed, run below command:

dpkg --get-selections | grep deinstall | cut -f1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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