Dependencies still exist in "dpkg -l" after running "apt-get remove dependencies-names"

Solution 1:

Note the rc at the beginning of the list.

r: Remove (marked for removal)
c: Configuration files are present.

The difference between apt-get remove and purge (From man apt-get)

   remove
       remove is identical to install except that packages are removed instead of installed.
       Note the removing a package leaves its configuration files in system.

   purge
       purge is identical to remove except that packages are removed and purged (any
       configuration files are deleted too).

As you choose to apt-get remove, your dpkg -l reflecting that. If you would have been used apt-get purge you could avoid such a situation. To get rid of these, try in terminal,

dpkg --list | grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge

It will purge all the packages which are marked for removal. Before you purge them you can check the list which you are going to purge using,

dpkg --list | grep "^rc" | cut -d " " -f 3 

I guess you have no other package remain marked for removal except those are from xfce. If you are not sure about it. Use the following instead,

dpkg --list | grep -i xfce | cut -d " " -f 3 | xargs sudo dpkg --purge

Solution 2:

The dependencies are not still installed.

When you run dpkg -l, dpkg calls dpkg-query. Entries in the first column (where you're seeing rc) consist of two one-letter abbreviations.

The first letter specifies the desired state of the package as specified by package management actions. r means it is intended to be removed. This means it either

  • is actually removed, or
  • has been specified for removal but is not yet fully removed or the removal failed.

To see which is the case, consult the second letter, c. This indicates what, from the package, is installed. If no files of any kind are present, the second letter reads n (though actually, since you're running dpkg -l/dpkg --list without arguments and then parsing the output, the entry would simply not appear at all if there were no files).

c means all that's installed are configuration files. Usually it's not safe to assume a user wants to remove these when uninstalling a package. If you want to remove them, you can pass the --purge flag to apt-get (or specify the purge action instead of the remove action) when uninstalling packages.

To remove these configuration files, even though the packages themselves are uninstalled, you can still purge them, either with dpkg -P ... or apt-get purge .... Using dpkg to purge many packages is can be somewhat complicated but apt-get will match regular expressions (as grep does) for package names. Assuming you want a single short command that removes all these packages and *assuming you really want to remove all packages with xfce in their name, this will do the trick:

sudo apt-get purge xfce.\*

Note that the * is not a wildcard, .\* matches zero or more of any character. The . is essential for making this happen (see below). This regexp is equivalent to just xfce, but it's recognized as a regexp by apt-get because it contains the special character *.

(Similarly, if you used xfce\* or xfce* it would remove all packages with xfc in the name. People have tried to get rid of Wine by removing wine*, which has resulted in every package with win anywhere in the name being removed, breaking their systems!)

Or if you prefer to do the purge with dpkg, an easily comprehended way (which I think thereby reduces mistakes) to do so is to tell dpkg-list how to format its own output:

sudo dpkg -P `dpkg-query -f='${Package}\n' -W | grep xfce`

Or you can simply run dpkg-query -f='${Package} ' -W | grep xfce, letting you examine the output to make sure it's what you want, and then copy and paste that space-delimited list of packages into a sudo apt-get purge or sudo dpkg -P command.