This warning appears when dpkg tries to remove a package it doesn't recognize as installed. Usually harmless, but indicates a package state mismatch between apt and dpkg.
The "dpkg: warning: ignoring request to remove package-name which isn't installed" warning occurs when the apt or aptitude package manager attempts to remove a package, but dpkg—the underlying Debian package database—doesn't have a record of that package being installed. This is typically a non-fatal warning and doesn't prevent system operations from completing. However, it indicates that there's a mismatch between what apt thinks is installed and what dpkg's database actually contains. This can happen when packages are in an inconsistent state or when package management records get out of sync.
First, verify whether the package is actually installed on your system:
dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W package-nameThis shows the actual status dpkg has for the package. Common outputs:
- install ok installed - Package is installed
- deinstall ok config-files - Package removed but config files remain
- not-installed - Package doesn't exist in dpkg database
If the output shows "deinstall ok config-files", the package is only partially installed (configuration files remain).
If apt-get fails but you want to remove the package completely, try using dpkg directly:
sudo dpkg --purge package-nameThe --purge flag removes the package and its configuration files, which is more forceful than --remove. This often works where apt-get fails due to state mismatches.
Sometimes updating apt's package cache resolves the issue:
sudo apt-get update
sudo apt-get autoremove
sudo apt-get cleanThen try removing the package again:
sudo apt-get remove package-nameIf dpkg was interrupted during a previous operation, run:
sudo dpkg --configure -aThis tells dpkg to finish configuring any packages that are in an incomplete state. After this, retry your package removal:
sudo apt-get remove package-nameIf the package is in a severely broken state, reinstall it first:
sudo apt-get install --reinstall package-nameThen attempt removal:
sudo apt-get remove package-nameThis puts the package back into a known good state before attempting removal.
On systems with multi-architecture support (e.g., both amd64 and i386 packages), this warning can occur when apt/aptitude's package state tracking gets out of sync with dpkg's knowledge of which architectures are installed. Aptitude's "~c" pattern is designed to match only removed (not purged) packages, but in some versions this matching may be incorrect.
If this warning persists after trying the above steps, you can manually reset aptitude's package state database:
sudo rm /var/lib/aptitude/pkgstatesNote: This removes all of aptitude's cached state, so you'll lose action history and marked packages. Aptitude will regenerate this file on next run.
The warning itself is harmless and doesn't prevent your system from functioning. Package removal typically succeeds despite the warning. However, the mismatch it indicates should be resolved to keep your package database clean.
E: Cannot set to hold: package 'package-name' is not installed
How to fix "Cannot set to hold" error when package is not installed in APT
debconf: unable to initialize frontend: Dialog
How to fix "debconf: unable to initialize frontend: Dialog" in APT
E: Could not connect to proxy server
Could not connect to proxy server
dpkg: serious warning: files list file for package 'package-name' contains empty filename
How to fix "files list file contains empty filename" in APT
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt