Understanding the Debian Package rc State

In Debian and Debian-based Linux distributions, package management tools report specific status codes that indicate the exact condition of installed, modified, or deleted software. This article explains the rc status in Debian package management, detailing the specific state a package enters when it receives this designation, why configuration files are preserved, and how administrators can completely remove these remnants from their operating system.

The Definition of the rc State

When a package is listed with the rc status in Debian's package manager (dpkg), it has entered the Config-files state (often described as "deinstalled, configuration files remaining").

The two letters represent distinct pieces of information tracked by dpkg:

  • r (Desired action): Indicates that the package is marked for removal.
  • c (Current status): Indicates that the package binaries have been removed, but its configuration files still reside on the system.

In this state, all executable binaries, shared libraries, and application data installed by the package have been deleted from directories like /usr/bin, /usr/lib, and /usr/share. However, user-editable configuration files—primarily located within the /etc directory—are deliberately preserved.

Why Packages Enter the rc State

A package enters this state when it is removed using a standard removal command rather than a complete purge. For example, executing:

apt remove <package-name>

or

dpkg -r <package-name>

instructs Debian to remove the software components while safeguarding your customized configurations. This default behavior ensures that if you reinstall the package in the future, your previous settings, service configurations, and customization options are immediately restored without manual reconfiguration.

How to Find and Remove rc Packages

To view all packages currently residing in the rc state on your system, run:

dpkg -l | grep '^rc'

If you do not plan to reinstall the software and want to reclaim disk space or clean your system records, you must transition the package from "removed" to "purged."

To purge a single package:

apt purge <package-name>

To automatically remove all packages currently in the rc state at once, execute:

dpkg -l | grep '^rc' | awk '{print $2}' | xargs -r dpkg -P

Once purged, the package completely exits the rc state, all associated files in /etc are permanently deleted, and the package is removed entirely from the local dpkg database.