I'm trying to make a lightweight VM based on Xubuntu. I want to start with a stock Xubuntu installation and then remove any packages that I don't need.

My concept is to build a .deb package that removes the unneeded packages. I've been reasonably successful specifying that my package conflicts with the ones I want to remove. For example:

Conflicts: gnumeric, thunderbird, blueman, mousepad, xchat, etc...

This causes the named packages to be removed when my package is installed.

The problem comes later: if I want to re-install, say, Thunderbird, doing so will cause my package to be uninstalled.

What's a good way to clean up the system in an automated manner? Can the postinst script be used to remove packages?

  • Why not make a master and then template it for your use?
    – mdpc
    Oct 15, 2014 at 7:26

2 Answers 2


How about splitting your package into two: one part that contains the real functionality, and another part that conflicts with the packages you want to remove. Make the first package recommend the second package so that it gets installed by default, but if you later want to install something that your package conflicts with, then you can choose to remove your second package. That shouldn't be a problem as the cleanup has already taken place.

  • Well, it sort of worked for me. I have the "cleanup" package configured to conflict with the packages that I want to remove. The "real" package recommends the "cleanup" package. Indeed, when I install the "real" package, it recommends the "cleanup" one and uninstalls some, but not all, of the conflicted packages. When done, I discover that the "cleanup" package hasn't been installed at all; I have to re-install it to uninstall the rest of the packages. I don't know why this happens. Jan 11, 2015 at 8:48

Declare it as replacing and conflicting with the other package in the debian control file https://www.debian.org/doc/debian-policy/ch-relationships.html#s7.6.2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .