apt cancels holds on uninstalled packages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dpkg (Ubuntu) |
Triaged
|
Low
|
Unassigned |
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
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.
This is not a bug in apt. dpkg cleans up its database and removes hold states for non-installed packages following an operation.