I compiled and packaged QEMU for my Raspberry Pi, but apt thinks that by installing it I'm "downgrading" from 1.3.1 (latest available in the repos) to 5.2.50 (my deb). so now every time I run apt upgrade apt "upgrades" from 5.2.50 (my deb) to 1.3.1 (latest available in the repos). for now I'm using sudo apt-mark hold qemu.

what I want is to make the postinst script in the deb to hold the package from updating and the prerm script to uphold it, I know you can't run apt and dpkg commands from those scripts without removing dpkg locks or something like that that I don't want to do.

my question: is there a way to hold the package from updating with the postinst script and untold it with the prerm script without removing the dpkg locks?

1 Answer 1


The appropriate fix is to use the right version number, not to try and hold the package by removing locks in the postinst. The QEMU package you’re replacing has an “epoch”, the number before the colon in the version number, “1:3.1...”. Your version number needs this too, i.e. “1:5.2.50...”

apt will then consider your version to be newer than the version in the repositories.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .