Debian – apt-get purge portmap

aptdebianportmaprpc

i had rpc.statd open on port 111 on a relatively fresh install of debian squeeze. i did an apt-get purge portmap as i wanted to disable rpc services and close the open port on my box; i was presented with the following:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libtirpc1 rpcbind
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libtirpc1 rpcbind
The following packages will be REMOVED:
  nfs-common* portmap*
The following NEW packages will be installed:
  libtirpc1 rpcbind
0 upgraded, 2 newly installed, 2 to remove and 0 not upgraded.
Need to get 127 kB of archives.
After this operation, 438 kB disk space will be freed.
Do you want to continue [Y/n]? n

long story short, i was able to remove portmap, without installing additional packages, by first doing apt-get purge nfs-common followed by apt-get purge portmap.

can anyone explain this behaviour? why would apt-get attempt to install rpcbind and libtirpc1 when attempting to purge portmap in the first case, but not the second? from the output above, it is clear that apt-get intended to remove nfs-common along with portmap to begin with. the only other relevant detail i was able to find is that fam depends on portmap, but this is a remote server and fam and a gui are not needed. is this a bug or am i missing something? if so, who should the report be directed towards?

Best Answer

APT is designed to not leave you a broken system. It has no idea that you are running a server, and don't need some package or the other.

You will see behavior like this when trying to remove a package if some other package depends on what you are trying to remove, but can also use another package instead. When you try to remove the package it depends on APT will offer to install the alternative.

You will see this frequently if you try to purge a mail transfer agent (mail server). There are a large number of programs which require a MTA, so when you try to purge exim or postfix the other will be installed.