Debian: Remove packages in status rc

The status rc says that the package was removed but the configuration files are still on disk. This happens either when the packages are deleted with apt-get remove or they are automatically removed due to a dependency. In this second case, it also happens if the main package was purged and not only removed.

You can determine which package are in this status with:

# dpkg -l | grep ^rc

So executing this will return only the names of all these packages:

# dpkg -l | grep ^rc | awk ‘{print $2}’

And to purge all these packages:

# dpkg -l | grep ^rc | awk ‘{print $2}’ | xargs dpkg -P

If you want to first see what dpkg would do, use:

# dpkg -l | grep ^rc | awk ‘{print $2}’ | xargs dpkg –no-act -P

Leave a Reply

Your email address will not be published. Required fields are marked *