[Bug 1904195] Re: apt cancels holds on uninstalled packages
Harald van Dijk
1904195 at bugs.launchpad.net
Fri Nov 13 15:18:46 UTC 2020
You're right btw that it's a dpkg bug, but it's a bit more subtle. The
cleanup that dpkg performs after installation is meant to preserve the
hold state for non-installed packages. This is handled by the
pkg_is_informative function, which classifies everything with "pkg->want
!= PKG_WANT_UNKNOWN" as informative, so would actually preserve hold for
non-installed packages. However, pkg_parse_verify contains logic to fix
up state left by older dpkg versions, without taking into account that
this also includes valid state by current dpkg versions:
/* XXX: Mark not-installed leftover packages for automatic removal on
* next database dump. This code can be removed after dpkg 1.16.x, when
* there's guarantee that no leftover is found on the status file on
* major distributions. */
if (!(ps->flags & pdb_recordavailable) &&
pkg->status == PKG_STAT_NOTINSTALLED &&
pkg->eflag == PKG_EFLAG_OK &&
(pkg->want == PKG_WANT_PURGE ||
pkg->want == PKG_WANT_DEINSTALL ||
pkg->want == PKG_WANT_HOLD)) {
pkg_set_want(pkg, PKG_WANT_UNKNOWN);
}
We are now at dpkg 1.20.x, well after 1.16.x. If this block of code is
removed (or at least the pkg->want == PKG_WANT_HOLD condition), direct
installation by dpkg works as expected, and presumably installation
using apt will work as expected as well.
** Also affects: dpkg (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1904195
Title:
apt cancels holds on uninstalled packages
Status in apt package in Ubuntu:
Invalid
Status in dpkg package in Ubuntu:
New
Bug description:
When a package is not installed and apt dist-upgrade offers to install
it, if this is not desired, it is possible to hold the package using
multiple tools, which puts it in a state documented in dpkg.1 as:
hold
A package marked to be on hold is kept on the same version, that
is, no automatic new installs, upgrades or removals will be
performed on them, unless these actions are requested explicitly,
or are permitted to be done automatically with the --force-hold
option.
Note the "no automatic new installs", suggesting that this is a
correct and valid use for packages that are not installed. I use "apt-
mark hold" to put packages in this state.
This is respected by apt when choosing what to install, but any
installation causes this state to be lost for uninstalled packages,
even installations of completely unrelated packages.
Steps to reproduce:
- Add a repository to sources.list that adds new essential packages, and run `apt update`.
- Observe that `apt dist-upgrade` will want to install new packages.
- Put the packages on hold, using `apt-mark hold <package>`.
- Observe that `apt dist-upgrade` will no longer want to install new packages.
- Install an unrelated package.
- Observe that `apt dist-upgrade` will again want to install new packages.
Seen on Ubuntu 20.10, apt 2.1.10.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1904195/+subscriptions
More information about the foundations-bugs
mailing list