We've recently upgraded from 10.04 to 14.04.

We have some held packages, which we upgrade them from time to time. It appears that on 14.04, when you install or upgrade a package it removes the hold for the package.

$ dpkg --get-selections libmysqlclient18
libmysqlclient18:amd64              install

# Hold the package
$ echo 'libmysqlclient18:amd64 hold' | sudo dpkg --set-selections

# Check that worked
$ dpkg --get-selections libmysqlclient18
libmysqlclient18:amd64              hold

# Install a new version of the package
$ sudo apt-get install libmysqlclient18
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
The following held packages will be changed:
The following packages will be upgraded:
  libmysqlclient18 mysql-common
2 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
Need to get 610 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.44-0ubuntu0.14.04.1 [13.9 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libmysqlclient18 amd64 5.5.44-0ubuntu0.14.04.1 [596 kB]
Fetched 610 kB in 1s (339 kB/s)
Reading changelogs... Done
apt-listchanges: Mailing root: apt-listchanges: changelogs for <host>
(Reading database ... 490677 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.44-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common (5.5.44-0ubuntu0.14.04.1) over (5.5.43-0ubuntu0.14.04.1) ...
Preparing to unpack .../libmysqlclient18_5.5.44-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.44-0ubuntu0.14.04.1) over (5.5.43-0ubuntu0.14.04.1) ...
Setting up mysql-common (5.5.44-0ubuntu0.14.04.1) ...
Setting up libmysqlclient18:amd64 (5.5.44-0ubuntu0.14.04.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...

The install removed the hold!

$ dpkg --get-selections libmysqlclient18
libmysqlclient18:amd64              install

This happens for packages without postinst/prerm scripts, so it seems the problem is with apt and not with the packages themselves. It didn't happen in 10.04.

Can anyone suggest a workaround that will prevent apt from doing this?


This is a dpkg change, not an apt change:

# dpkg --get-selections  | grep hold
google-chrome-stable                            hold
# dpkg -i google-chrome-stable_44.0.2403.125-1_amd64.deb
(Reading database ... 318187 files and directories currently installed.)
# dpkg --get-selections  | grep hold

After doing some git bisect, this change was introduced in https://anonscm.debian.org/cgit/dpkg/dpkg.git/commit/?id=fb8997a460a0ef2909199b4603604a4e855003e0 as part of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=162541

  • Thanks, that probably took a bit of work to track down. Doesn't help me work around it, but we may have another solution (considering adding a line to our postinst scripts to mark the packages as held again, since these are all packages we control).
    – craigds
    Aug 6 '15 at 22:20
  • Another update: you can't actually mark a package as held during postinst, because you can't acquire the dpkg lock. So we still need a workaround.
    – craigds
    Aug 7 '15 at 5:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.