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

 

 

 

[O/S] [Solved] How does apt's preferences.d syntax work?

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
Outline
Posts: 5
Joined: 2024-02-01 15:05

[O/S] [Solved] How does apt's preferences.d syntax work?

#1 Post by Outline »

Hello, Today I had some issues with the nvidia driver. After some search I found the issue was that the linux-header-amd64 package was pointing to a previous kernel (linux-header-6.1.0-16 instead of -17). However, no update was proposed to me. Moreover, the headers for -17 were found when using apt install ...-17, but the command failed because a dependency was unmet (namely the error was linux-headers-6.1.0-17-amd64 : Depends: linux-kbuild-6.1 (>= 6.1.69-1) but 6.1.67-1 is to be installed).

I changed my /etc/apt/preferences.d/stable.pref from

Code: Select all

Package: *
Pin: release n=bookworm
Pin: release n=bookworm-security
Pin: release n=bookworm-updates
Pin-Priority: 900
to:

Code: Select all

Package: *
Pin: release n=bookworm
Pin: release n=bookworm-security
Pin-Priority: 900

Package: *
Pin: release n=bookworm-updates
Pin-Priority: 800
And voilà, it magically worked and made me upgrade all the packages as needed.

The question is: what was wrong with the old preferences.d file? After all, if bookworm-updates is providing linux-kbuild-6.1==6.1.67-1 but bookworm provides linux-kbuild-6.1==6.1.69-1, and if bookworm and bookworm-updates have the same priority, then the most recent should be picked, isn't it?
Last edited by Outline on 2024-02-04 19:51, edited 2 times in total.

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

Re: [O/S] How does apt's preferences.d work for stable-updates?

#2 Post by fabien »

Hello, welcome to the forum!
Outline wrote: 2024-02-01 15:18 if bookworm and bookworm-updates have the same priority, then the most recent should be picked, isn't it?
Yes it is. But that's not the case with your setup. You can check this with apt policy:

Code: Select all

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

$> apt policy linux-headers-amd64 
linux-headers-amd64:
  Installed: (none)
  Candidate: 6.1.67-1
  Version table:
     6.1.69-1 500
        500 https://deb.debian.org/debian-security bookworm-security/main amd64 Packages
     6.1.67-1 900
        900 https://deb.debian.org/debian bookworm-updates/main amd64 Packages
     6.1.66-1 500
        500 https://deb.debian.org/debian bookworm/main amd64 Packages
As you can see, only the last entry is taken into account.

You must use separate records:

Code: Select all

Package: *
Pin: release n=bookworm
Pin-Priority: 900

Package: *
Pin: release n=bookworm-security
Pin-Priority: 900

Package: *
Pin: release n=bookworm-updates
Pin-Priority: 900

Code: Select all

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

$> apt policy linux-headers-amd64 
linux-headers-amd64:
  Installed: (none)
  Candidate: 6.1.69-1
  Version table:
     6.1.69-1 900
        900 https://deb.debian.org/debian-security bookworm-security/main amd64 Packages
     6.1.67-1 900
        900 https://deb.debian.org/debian bookworm-updates/main amd64 Packages
     6.1.66-1 900
        900 https://deb.debian.org/debian bookworm/main amd64 Packages
Also note that your second solution is also not what you want (bookworm's priority is still 500).
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Outline
Posts: 5
Joined: 2024-02-01 15:05

Re: [O/S] How does apt's preferences.d work for stable-updates?

#3 Post by Outline »

Great, thank you!

Some documentation in the man pages of apt_preferences puts multiple "Pin:" lines one after the other, without context. Hence, I assumed that was an accepted syntax...

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

Re: [O/S] How does apt's preferences.d work for stable-updates?

#4 Post by fabien »

This?
man 5 apt_preferences wrote:the Version: line
names the release version. [...] Specifying this in the APT preferences file would require one of the following lines.

Pin: release v=12
Pin: release a=stable, v=12
Pin: release 12
It's true that this manual requires careful reading.
Please mark your topic as solved for the benefit of other viewers. You do this by editing your first post and changing the title, like this for example:
[O/S] [SOLVED] How does apt's preferences.d work for stable-updates?
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

Post Reply