How to uninstall desktop environments installed with tasksel?
I'm playing around with different DEs in a VM. I assumed that unchecking the DE in tasksel would uninstall it completely, but apparently it doesn't.
I try for example to uninstall the task-lxde-desktop package but it still leaves packages like lxde, lxde-session and openbox installed. apt autoremove doesn't remove those.
Is there an easy way to completely uninstall DEs or is this a limitation on how metapackages work in Debian?
Sort by:
Best
Open comment sort options
Comments Section
It's a limitation on how circular "Recommends" dependencies limits the ability of
apt
to recognise that packages are unused.Basically, packages aren't uninstalled if other packages depend on them. If you install
foo
which depends onlibfoo
, and then installbar
which also depends onlibfoo
, if you later deletefoo
then you don't wantlibfoo
to be uninstalled because that would breakbar
.The problem is that if
foo
depends onbar
andbaz
, andbar
andbaz
both depend on each other, if you removefoo
then neitherbar
norbaz
will will be recognised as a candidates for removal because they both have packages that depend on them - each other. Now, Debian policy 7.2 strongly recommends against creating circular "Depends" relationships between packages because of the issues it can cause, but circular "Recommends" relationships (or wherefoo
depends onbar
, andbar
recommendsfoo
) are not discouraged - and are actually quite common. But circular "Recommends" also inhibit automatic removal - which is likely what is happening here.I've thought it might be nice if
apt autoremove
had an option where it could find groups of packages where none of them were manually installed, and there is no "Depends" or "Recommends" relationship from any manually installed package to any package in the group.But on top of that, there is the virtual package issue where if
foo
has a dependency likekwin | x-window-manager
, and you installopenbox
which providesx-window-manager
, then I think that even if you havekwin
installed thenopenbox
won't be a candidate for removal because it provides a virtual package that is depended on by another package.Basically,
apt
errs on the side of keeping anything it thinks another package on your system might need, unless you specifically tell it otherwise. Which I think is pretty sensible.What a bummer. I thought that if you install a metapackage, it should be equally easy to revert back to the former state by removing it.
I tried using
apt-get purge -o Apt::AutoRemove::RecommendsImportant=false --autoremove openbox
but it seems to want to delete stuff related to other desktop environments as well.Other distros really handle this better.
Agreed. This is really the only major complain from me. Every time I install Debian I have to carefully plan for what I install (with
--no-install-recommends
).The only really reliable way of uninstalling something in Debian is to track down
/var/log/apt/history*
, and purge packages from the buttom until the step of the target package, then re-install any leaf package which was installed later than the package removed. If at a later stage I decide it to be too much harassment to retract installations by tracking/var/log/apt/history*
step by step then I'd just nuke the whole installation of Debian and reinstall it, so that I can get rid of the sick feeling of being bloated when I try to remove something.pacman -Rs
for Arch andapk del
for Alpine both do a very job at uninstalling packages without bloat leftover.aptitude why lxde
I recently switched from LXDE to Cinnamon, I logged out, ctrl+alt+F1 for text terminal and ran:
I suppose best way is "apt-get remove --purge <package>*" for example:
should remove package and all the config files.
In the same vein, there's
apt purge <package>
and alsoapt autopurge
, which is the same asapt autoremove --purge
The easiest way to figure out this sort of thing is through
aptitude
, which allows you to easily browse through the dependencies and reverse dependencies of packages. Recursively, even. You can remove the packages you're sure you want to get rid of, and mark as dependency-only the packages you're not sure of that somehow don't already have that mark. All quickly and interactively.Figuring out virtual dependencies, where you may have multiple packages that all
Provide
the same virtual package name and you only need one, is the trickiest bit. But even there,aptitude
can make it a lot easier, as it actually does allow you to browse virtual packages!Just save state before, and remove the added packages after.
E.g.:
Can also extract the information from /var/log/dpkg.log* file(s) if necessary.