Categories: Ubuntu

Why do removed or uninstalled debian packages still shows in dpkg list?

It is often very confusing when you notice removed or uninstalled debian packages still shows in dpkg list. This usually happens when you remove the debian packages through sudo apt remove command and after removal when you check the list of installed packages through dpkg -l command then the removed packages still be showing in the list. Something like this happened to me as well when I checked the list of installed packages after removing virtualbox application from my Ubuntu 20.04 LTS system, I noticed it was still showing in the list.

So before solving this problem I thought to write an article about this so that it will help you folks as well in case you are also struggling with this problem. In below section, I am going to explain the solution by giving an example of the problem I have faced in my system.

 

Why do removed or uninstalled debian packages still shows in dpkg list?

Also Read: How to Install Nmap on Ubuntu/Debian

So as I was explaining, after removing virtualbox package from my Ubuntu 20.04 LTS system, I noticed it was still showing in the dpkg -l command output as you can see below.

cyberithub@ubuntu:~$ dpkg -l | grep -i virtualbox
rc  virtualbox                                6.1.38-dfsg-3~ubuntu1.20.04.1   amd64           x86 virtualization solution - base binaries
rc  virtualbox-7.0                            7.0.12-159484~Ubuntu~focal      amd64           Oracle VM VirtualBox
rc  virtualbox-ext-pack                       6.1.38-1~ubuntu1.20.04.1        all             extra capabilities for VirtualBox, downloader.

To deal with this problem, first we need to understand the first column of dpkg output. Usually on the first column, you will see any of the below letter code :-

  • u – unknown
  • n – not installed
  • r – removed
  • c – only config files installed/remaining on the system

Depending on the letter code on the output, you have to understand the current package status and taken appropriate action accordingly. So as you can see in our case it is showing as rc which means virtualbox packages are removed, just config files are installed/remaining on the system. So to solve this problem, you have to remove the config files of virtualbox-7.0 using sudo apt purge virtualbox-7.0 --auto-remove command as shown below.

cyberithub@ubuntu:~$ sudo apt purge virtualbox-7.0 --auto-remove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
virtualbox-7.0*
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 261665 files and directories currently installed.)
Purging configuration files for virtualbox-7.0 (7.0.12-159484~Ubuntu~focal) ...
dpkg: warning: while removing virtualbox-7.0, directory '/usr/local/lib/python3.8/dist-packages' not empty so not removed

Similarly, to remove config files of virtualbox you have to run sudo apt purge virtualbox --auto-remove command as shown below.

cyberithub@ubuntu:~$ sudo apt purge virtualbox --auto-remove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
virtualbox*
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 261661 files and directories currently installed.)
Purging configuration files for virtualbox (6.1.38-dfsg-3~ubuntu1.20.04.1) ...
Processing triggers for systemd (245.4-4ubuntu3.22) ...

And finally to remove virtualbox-ext-pack, you have to run sudo apt purge virtualbox-ext-pack --auto-remove command as shown below.

cyberithub@ubuntu:~$ sudo apt purge virtualbox-ext-pack --auto-remove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
virtualbox-ext-pack*
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 261659 files and directories currently installed.)
Purging configuration files for virtualbox-ext-pack (6.1.38-1~ubuntu1.20.04.1) ...

After removing all the configuration files related to removed or uninstalled packages if you now check dpkg list again, this time you will notice that it will not show anything on the output as you can see below. This confirms that package is now fully removed and your problem is solved.

cyberithub@ubuntu:~$ dpkg -l | grep -i virtualbox
Ubuntu Server Admin

Recent Posts

A year of documentation-driven development

For many software teams, documentation is written after features are built and design decisions have…

5 hours ago

Announcing FIPS 140-3 for Ubuntu Core22

With the release of the FIPS 140-3 certified cryptographic modules for Ubuntu 22.04 LTS, Canonical…

1 day ago

The foundations of software: open source libraries and their maintainers

Open source libraries are repositories of code that developers can use and, depending on the…

4 days ago

From inspiration to impact: design students from Regent’s University London explore open design for their dissertation projects

Last year, we had the opportunity to speak at Regent’s UX Conference (Regent’s University London’s…

5 days ago

When an upstream change broke smartcard FIPS authentication – and how we fixed it

A government agency mandated smartcard authentication across their Ubuntu fleet. When they enabled FIPS mode…

6 days ago

Open platforms, edge AI, and sovereign telco clouds: Ecrio & Canonical at MWC Barcelona

Building telco clouds with open source At MWC Barcelona 2026, Canonical is demonstrating how telecommunications…

6 days ago