apt-mark overwrites existing held package info

Bug #1694989 reported by Matthew North
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Debian)
New
Unknown
apt (Ubuntu)
Invalid
Wishlist
Unassigned

Bug Description

Running apt-mark hold commands overwrites / nullifies any existing held package data. Not sure if this is by design, but I assume it's meant to be cumulative.

Ubuntu version: 16.04.2 LTS
Package version: apt 1.2.19 amd64

Expected behaviour:

apt-mark hold 3dchess
apt-mark hold 0ad
apt-mark showhold

3dchess
0ad

Actual behaviour:

apt-mark hold 3dchess
apt-mark hold 0ad
apt-mark showhold

0ad

Tags: artful xenial
Revision history for this message
Julian Andres Klode (juliank) wrote :

Yup, something odd is going on there.

Changed in apt (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Brian Murray (brian-murray) wrote :

Confirmed on artful with apt version 1.4.6.

tags: added: xenial
tags: added: artful
Revision history for this message
David Kalnischkies (donkult) wrote :

Is it really /any/ which I can't confirm at the moment as holding e.g. apt & dpkg works just fine…

The underlying question is: Are the packages you are trying to hold installed? If not, dpkg will accept the hold at first and record it (so apt will report it on showhold again), but as soon as the dpkg/status file is modified again (e.g. with another hold), the record for the uninstalled package is cleaned up removing the hold.

That is intended behavior by dpkg upstream according to earlier talks (and in there since ever, but I think the situations in which cleanup happens increased over time). We were thinking of having some way of having dpkg store such info even for not installed packages, but then life (& freeze) happened I guess, so there is nothing to show off apart from "yeah, we should be doing something, maybe".

Perhaps we should just change apt to not accept holds for non-installed packages until that is resolved in some way.

Revision history for this message
Julian Andres Klode (juliank) wrote :

Ah, that makes sense. Downgrading importance then to match that this is actually working as dpkg intends it to work and us not refusing it is really just a usability issue.

Changed in apt (Ubuntu):
importance: Medium → Low
Revision history for this message
Matthew North (matt-northsky) wrote :

Just to confirm, both packages are installed on my system. (Can't be much more help as am a few thousand miles away from it until Tues.)

Revision history for this message
Matthew North (matt-northsky) wrote :

Managed to get access, they weren't installed - once installed apt mark works as planned. Sorry for the wild goose chase, guys.

Changed in apt (Debian):
status: Unknown → New
Changed in apt (Ubuntu):
importance: Low → Wishlist
Revision history for this message
Nicolas R. (atoomic) wrote :

This is very annoying, I agree that either, apt-mark should not accept 'uninstalled' packages or we should avoid losing packages marked as 'hold'

Steps to reproduce (assuming none of these two packages are available)

Trying to mark as hold two uninstalled packages... and notice that the second we add the second one we lost the status for the first one..

> apt update
> apt-mark hold p0f
p0f set on hold.
> apt-mark showhold
p0f
> grep -c p0f /var/lib/dpkg/status
1
> apt-mark hold dovecot-core
dovecot-core set on hold.
> apt-mark showhold
dovecot-core
> grep -c p0f /var/lib/dpkg/status
0

Changed in apt (Ubuntu):
status: Triaged → Won't Fix
status: Won't Fix → Invalid
Revision history for this message
Julian Andres Klode (juliank) wrote :

This was fixed in

dpkg (1.20.6) unstable; urgency=medium

  [...]
  * libdpkg: Do not forget not-installed packages that are set on hold.
    Reported by David Kalnischkies <email address hidden>.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.