Web lists-archives.com

Re: prevent apt from downgrading packages




Felix Rubio wrote: 
> Hi all,
> 
>     I have mix stable+testing (~1200 packages from stable, ~20 packages from
> testing). I have the following contents in /etc/apt/preferences.d/pinning:
> 
> Package: *
> Pin: release a=stable
> Pin-Priority: 1001
> 
> Package: *
> Pin: release a=testing
> Pin-Priority: 200
> 
> Package: *
> Pin: release a=experimental
> Pin-Priority: -10
> 
> Package: *
> Pin: release a=unstable
> Pin-Priority: -10
> 
> What happens is: after an apt update, I list the packages to be upgraded
> with apt list --upgradable, and I get only those that will be upgraded.
> However, when I run apt upgrade, I get a number of packages that will be
> downgraded. How can I prevent this downgrading from happening?

here are magic levels for the numbers in the priority field.
They are explained, at length, in man apt_preferences. The
highlights:

    P >= 1000
       causes a version to be installed even if this constitutes a
       downgrade of the package

    990 <= P < 1000
       causes a version to be installed even if it does not come from the
       target release, unless the installed version is more recent

    500 <= P < 990
       causes a version to be installed unless there is a version
       available belonging to the target release or the installed version
       is more recent

    100 <= P < 500
       causes a version to be installed unless there is a version
       available belonging to some other distribution or the installed
       version is more recent

    0 < P < 100
       causes a version to be installed only if there is no installed
       version of the package

    P < 0
       prevents the version from being installed


Your downgrades are probably caused by the 1001 priority for
stable; changing that to 999 might be what you want.

-dsr-