#781990 apt: Removing virtual packages doesn't work as you would expect

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
d3fault
Date:
2026-05-23 05:13:01 UTC
Severity:
normal
Tags:
#781990#5
Date:
2015-04-06 02:40:22 UTC
From:
To:
Dear Maintainer,
`apt-get install <virtual-package>` && `apt-get remove <virtual-package>`
does not remove the packages that were implicitly installed, and should.

#781990#10
Date:
2015-04-07 18:06:35 UTC
From:
To:
Hi,

Next time, please provide an example to get an idea of what you mean as
the 'usual' virtual-package doesn't install anything, like
mail-transport-agent. They just display all options and a remove isn't
printing much more than a message indicating that this isn't allowed:
"Virtual packages like 'mail-transport-agent' can't be removed".

An example of what you mean would e.g. be 'adblock-plus' provided by
'xul-ext-adblock-plus'. This installs the iceweasel extension, but gives
no message nor does anything on remove.

I am tagging this 'newcomer' as this looks like a good opportunity
as the 'install' case already works, the 'remove' case should be very
similar. Anyone interested on working on this is highly encouraged to
drop us a line (or two) and/or join #debian-apt on IRC.


Best regards

David Kalnischkies

#781990#17
Date:
2016-10-09 16:16:26 UTC
From:
To:
PR open https://github.com/Debian/apt/pull/24 fixes this
#781990#22
Date:
2022-06-16 14:28:06 UTC
From:
To:
Control: found -1 2.5.0
because <virtual-package> was part of a long list of packages (to
rebuild a package). This makes some answers to

https://askubuntu.com/questions/247549/is-it-possible-to-undo-an-apt-get-install-command

fail (though they can also fail for other reasons).

A simple testcase from what I got:

# apt install dh-sequence-gir
Note, selecting 'gobject-introspection' instead of 'dh-sequence-gir'
The following additional packages will be installed:
  python3-mako python3-markdown
The following NEW packages will be installed:
  gobject-introspection python3-mako python3-markdown

(I've removed unrelated output.)

In the /var/log/apt/history.log file:

Commandline: apt install dh-sequence-gir
Install: python3-mako:amd64 (1.1.3+ds1-3, automatic), gobject-introspection:amd64 (1.72.0-1+b1), python3-markdown:amd64 (3.3.7-1, automatic)

One can see that gobject-introspection doesn't have the "automatic" tag.

# apt purge dh-sequence-gir
Note, selecting 'gobject-introspection' instead of 'dh-sequence-gir'

but nothing is done, and gobject-introspection is still regarded as
manually installed.

Note that in both cases, because of a lot of output, I did not see the
"Note, selecting 'gobject-introspection' instead of 'dh-sequence-gir'"
message (it was unexpected, so I focused on the "will be installed"
information).

Unfortunately it was never merged and became obsolete due to
ABI/API break.

#781990#29
Date:
2026-05-23 05:09:53 UTC
From:
To:
I am looking into this bug and have opened a draft MR <https://salsa.debian.org/apt-team/apt/-/merge_requests/585> with integration tests covering virtual package remove/purge scenarios. Further refinements will follow.

Best Regards,
Aibek Bukabayev

С уважением,
Букабаев Айбек