Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] Problem with pinning local repo

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Danethz
Posts: 3
Joined: 2023-02-05 09:53

[Software] Problem with pinning local repo

#1 Post by Danethz »

Hello!
Debian 11.2
I have 3 repos: http://security.debian.org and local main-repo https://my.repo.local/debian11-main and local security-updates-repo https://my.repo.local/debian11-security
Repos priorities:

Code: Select all

apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 600 https://my.repo.local/debian11-main bullseye/main amd64 Packages
     release o=Debian,a=bullseye,n=bullseye,l=my.repo.local-stable,c=main,b=amd64
     origin my.repo.local
 600 https://my.repo.local/debian11-security bullseye-security/main amd64 Packages
     release o=Debian,a=bullseye-security,n=bullseye-security,l=my.repo.local-stable,c=main,b=amd64
     origin my.repo.local
 500 http://security.debian.org bullseye-security/main amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
     origin security.debian.org
Pining local repo:

Code: Select all

Package: *
Pin:  release l=my.repo.local-stable
Pin-Priority: 600
When I check kernel version to install:

Code: Select all

apt-cache policy linux-image-amd64
linux-image-amd64:
  Installed: 5.10.158-2
  Candidate: 5.10.158-2
  Version table:
     5.10.162-1 500
        500 http://security.debian.org bullseye-security/main amd64 Packages
 *** 5.10.158-2 600
        600 https://my.repo.local/debian11-main bullseye/main amd64 Packages
        100 /var/lib/dpkg/status
     5.10.149-2 600
        600 https://my.repo.local/debian11-security bullseye-security/main amd64 Packages
Like we see in Candidate, APT don't want to use http://security.debian.org to download last kernel version.

But If I set local repos priority to 500 al goes well:

Code: Select all

apt-cache policy linux-image-amd64
linux-image-amd64:
  Installed: 5.10.158-2
  Candidate: 5.10.162-1
  Version table:
     5.10.162-1 500
        500 http://security.debian.org bullseye-security/main amd64 Packages
 *** 5.10.158-2 500
        500 https://my.repo.local/debian11-main bullseye/main amd64 Packages
        100 /var/lib/dpkg/status
     5.10.149-2 500
        500 https://my.repo.local/debian11-security bullseye-security/main amd64 Packages
Manual about pinning:

Code: Select all

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
I thought APT-behavior would be to install the most new package from repos in repos with priority 500 <= P < 990

I don't understad why APT don't use official repo. when I set priority of my local repo to 600.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 621
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 60 times
Been thanked: 146 times

Re: [Software] Problem with pinning local repo

#2 Post by fabien »

Hello,

This is normal behaviour:

system default:

Code: Select all

$> apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://deb.debian.org/debian bullseye-updates/main amd64 Packages
     release v=11-updates,o=Debian,a=stable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian-security bullseye-security/non-free amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=non-free,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/non-free amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=non-free,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/contrib amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=contrib,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/main amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:

$> apt policy sudo
sudo:
  Installed: (none)
  Candidate: 1.9.5p2-3+deb11u1
  Version table:
     1.9.5p2-3+deb11u1 500
        500 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     1.9.5p2-3 500
        500 https://deb.debian.org/debian bullseye/main amd64 Packages
stable > stable-security:

Code: Select all

$> cat /etc/apt/preferences.d/01test
Package: *
Pin: release a=stable
Pin-Priority: 600

$> apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://deb.debian.org/debian bullseye-updates/main amd64 Packages
     release v=11-updates,o=Debian,a=stable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian-security bullseye-security/non-free amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=non-free,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
     origin deb.debian.org
 600 https://deb.debian.org/debian bullseye/non-free amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=non-free,b=amd64
     origin deb.debian.org
 600 https://deb.debian.org/debian bullseye/contrib amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=contrib,b=amd64
     origin deb.debian.org
 600 https://deb.debian.org/debian bullseye/main amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:

$> apt policy sudo
sudo:
  Installed: (none)
  Candidate: 1.9.5p2-3
  Version table:
     1.9.5p2-3+deb11u1 500
        500 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     1.9.5p2-3 600
        600 https://deb.debian.org/debian bullseye/main amd64 Packages
stable-security < stable:

Code: Select all

$> cat /etc/apt/preferences.d/01test
Package: *
Pin: release a=stable-security
Pin-Priority: 400

$> apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://deb.debian.org/debian bullseye-updates/main amd64 Packages
     release v=11-updates,o=Debian,a=stable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 400 https://deb.debian.org/debian-security bullseye-security/non-free amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=non-free,b=amd64
     origin deb.debian.org
 400 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/non-free amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=non-free,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/contrib amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=contrib,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/main amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:

apt policy sudo
sudo:
  Installed: (none)
  Candidate: 1.9.5p2-3
  Version table:
     1.9.5p2-3+deb11u1 400
        400 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     1.9.5p2-3 500
        500 https://deb.debian.org/debian bullseye/main amd64 Packages
What do you want to achieve?

Danethz
Posts: 3
Joined: 2023-02-05 09:53

Re: [Software] Problem with pinning local repo

#3 Post by Danethz »

Thanks for response :)
My goal:
I have 2 groups of Debian-servers - testing and stable.

And I have 4 local repos made by Aptly:
  • my.repo.local/debian11-main - label=my.repo.local-stable
  • my.repo.local/debian11-main-test - label=my.repo.local-test
  • my.repo.local/debian11-security - label=my.repo.local-stable
  • my.repo.local/debian11-security-test - label=my.repo.local-test
I want to prioritize repository based on label:

Code: Select all

Package: *
Pin:  release l=my.repo.local-stable
Pin-Priority: 600

Package: *
Pin:  release l=my.repo.local-test
Pin-Priority: 700
Stable group wouldn't have test-repos in their source.list

Then I want to use Unattended-upgrades to install only security-updates for now:

Code: Select all

Unattended-Upgrade::Origins-Pattern {
        "label=my.repo.local*";
};
In your example of pinning you used archive parameter to filter repos.
However, at the moment I can not understand how to set the priorities of repositories based on labels.
apt policy shows that pinning has been applied but it doesn't work.

And Unattended-upgrades uses local repo only when official repo disabled.
Sorry for the offtop, this 2 problems are connected :)
Last edited by Danethz on 2023-02-05 20:27, edited 1 time in total.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 621
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 60 times
Been thanked: 146 times

Re: [Software] Problem with pinning local repo

#4 Post by fabien »

Danethz wrote: 2023-02-05 20:26In your example of pinning you used archive parameter to filter repos.
However, at the moment I can not understand how to set the priorities of repositories based on labels.
Works with label as well:

Code: Select all

$> cat /etc/apt/preferences.d/01test
Package: *
Pin: release l=Debian-Security
Pin-Priority: 400

$> apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://deb.debian.org/debian bullseye-updates/main amd64 Packages
     release v=11-updates,o=Debian,a=stable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 400 https://deb.debian.org/debian-security bullseye-security/non-free amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=non-free,b=amd64
     origin deb.debian.org
 400 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/non-free amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=non-free,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/contrib amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=contrib,b=amd64
     origin deb.debian.org
 500 https://deb.debian.org/debian bullseye/main amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:

$> apt policy sudo
sudo:
  Installed: (none)
  Candidate: 1.9.5p2-3
  Version table:
     1.9.5p2-3+deb11u1 400
        400 https://deb.debian.org/debian-security bullseye-security/main amd64 Packages
     1.9.5p2-3 500
        500 https://deb.debian.org/debian bullseye/main amd64 Packages
Danethz wrote: 2023-02-05 20:26apt policy shows that pinning has been applied but it doesn't work.
Of course it works, it selects the higher version in the higher priority.

Sorry, I can't help more as I don't have a local repository to test further.

Danethz
Posts: 3
Joined: 2023-02-05 09:53

Re: [Software] Problem with pinning local repo

#5 Post by Danethz »

Sorry, I can't help more as I don't have a local repository to test further.
Thanks anyway, I'll try it further

Post Reply