After removing virtualbox package on my PC with
apt remove virtualbox-5.1
I found the package still list in dpkg -l.
root@hon-pc-01:~# dpkg -l | grep virtual rc encfs 1.8.1-3 amd64 encrypted virtual filesystem ii gvfs:amd64 1.28.2-1ubuntu1~16.04.1 amd64 userspace virtual filesystem - GIO module ii gvfs-backends 1.28.2-1ubuntu1~16.04.1 amd64 userspace virtual filesystem - backends ii gvfs-bin 1.28.2-1ubuntu1~16.04.1 amd64 userspace virtual filesystem - binaries ii gvfs-common 1.28.2-1ubuntu1~16.04.1 all userspace virtual filesystem - common data files ii gvfs-daemons 1.28.2-1ubuntu1~16.04.1 amd64 userspace virtual filesystem - servers ii gvfs-fuse 1.28.2-1ubuntu1~16.04.1 amd64 userspace virtual filesystem - fuse server ii gvfs-libs:amd64 1.28.2-1ubuntu1~16.04.1 amd64 userspace virtual filesystem - private libraries ii openvpn 2.3.10-1ubuntu2 amd64 virtual private network daemon ii python3-virtualenv 15.0.1+ds-3ubuntu1 all Python virtual environment creator ii unity-scope-virtualbox 0.1+13.10.20130723-0ubuntu1 all VirtualBox scope for Unity rc virtualbox-5.1 5.1.14-112924~Ubuntu~xenial amd64 Oracle VM VirtualBox ii virtualenv 15.0.1+ds-3ubuntu1 all Python virtual environment creator root@hon-pc-01:~#
Now it is marked as “rc” instead of “ii”.
rc means some of the config files for this package is left on the server. To completely remove, you need to use
apt remove --purge virtualbox-5.1
On checking i found many other packages i removed did the same, left behind config files. To see all packages that are removed and still have config files on your PC, run
dpkg -l | grep "^rc"
To see only package name, run
dpkg -l | grep '^rc' | awk '{print $2}'
Now to remove them all, run
apt purge $(dpkg -l | grep '^rc' | awk '{print $2}')
OR you can use
apt-get remove --purge `dpkg -l | grep '^rc' | awk '{print $2}'`