Howto remove orphan packages in Ubuntu

There is usually some orphan packages left on the system after upgrading Ubuntu from one major version to another. These packages can cause strange errors like Ubuntu bug #151045. The solution to this problem is a package named deborphan. deborphan removes orphan packages that are left on your Ubuntu installation and you should run this program after any major Ubuntu upgrade.

Install and run deborphan

# sudo aptitude install deborphan
# sudo deborphan

Result

liblzo1
libdb4.3
libsasl2

These files were listed on one of my Ubuntu 8.04 installations. This installation had been upgraded from a previous LTS version.

All we have to do now is to remove those orphaned packages

# sudo deborphan | xargs sudo aptitude purge -y

This howto has not been tested on a Debian distribution, but I guess it will work there also.

2 thoughts on “Howto remove orphan packages in Ubuntu

  1. Hi, thanks for the deborphan tip. But it looks like xargs has trouble with line oriented stdin, and deborphan seems to output lines. So do you think running this command on ubuntu might be problematic?

  2. @aditya menon:
    Hi! I’ve just tested this on Ubuntu 12.04 and everything worked fine.

    @Hans-Henry Jakobsen:
    Hello, thanks for article!

Comments are closed.