1

Attention! This is a question for a task I have to do related with my studies. My teacher said that this task might not have a solution, but we needed to do all we could just to learn managing packages. This means, that please don't answer "There is no solution for that". If there is no solution, please I want to know why, and if there is a half-way solution to solve this please say it.
Thanks for reading

Description of the scenario

My VM is running Debian 10, and in its /etc/apt/sources.list I have repositories for buster and sid releases.
Here you have my sources.list

# 

# deb cdrom:[Debian GNU/Linux 10.0.0 _Buster_ - Official amd64 NETINST 20190706-10:23]/ buster main

#deb cdrom:[Debian GNU/Linux 10.0.0 _Buster_ - Official amd64 NETINST 20190706-10:23]/ buster main

deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

#SID repos
deb http://deb.debian.org/debian sid main
deb-src http://deb.debian.org/debian sid main

Secondly, inside my /etc/apt/preferences.d directory I have a file called sid_priority. These are its contents

Package: *
Pin: release a=sid
Pin-Priority: -1

A little bit of explanation about this file

This file is "meant" to low the priority of all sid packages to -1, so when I run sudo apt update and sudo apt upgrade, I end up installing and upgrading only packages for buster. The sid repositories are there ONLY FOR INSTALLING AND UPGRADING MANUALLY, let's say, running sudo apt install (also note that I barely know how packages priorities work, I only saw a little of internet and I could understand just the basics of the basics).

What I want to achieve

I want to install and upgrade by default ONLY by the buster repositories. This means, that If I run sudo apt update' orsudo apt upgrade, I'm not going to install any sid packages. I'll just install sid packages if I runsudo apt install`

What happened to me

I thought that priorities were working, but by executing sudo apt upgrade I ended up with sid packages. You can see an example:

libc6:
  Installed: 2.29-2
  Candidate: 2.29-2
  Version table:
 *** 2.29-2 500
        500 http://deb.debian.org/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status
     2.28-10 500
        500 http://deb.debian.org/debian buster/main amd64 Packages

By the way, don't be afraid to suggest anything, whatever you want, because I'm using VMs and I'm using one specifically for this task. If I need to delete it I'll do it.
Thanks for your help

1

The first example in the manpages answer you question:

EXAMPLES

Tracking Stable

The following APT preferences file will cause APT to assign a priority higher than the default (500) to all package versions belonging to a stable distribution and a prohibitively low priority to package versions belonging to other Debian distributions.

Explanation: Uninstall or do not install any Debian-originated package versions other than those in the stable distro

Package: *
Pin: release a=stable
Pin-Priority: 900
Package: *
Pin: release o=Debian
Pin-Priority: -10

Your sid_preference should be:

Package: *
Pin: release a=stable
Pin-Priority: 900

Package: *
Pin: release o=Debian
Pin-Priority: -1

Check it:

sudo apt update
apt policy libc6

sample output:

libc6:
  Installed: 2.28-10
  Candidate: 2.28-10
  Version table:
     2.29-2 -1
         -1 http://deb.debian.org/debian sid/main amd64 Packages
 *** 2.28-10 900
        900 http://deb.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status

man apt_preferences :

the Origin: line

names the originator of the packages in the directory tree of 
the Release file. Most commonly, this is Debian. Specifying this
origin in the APT preferences file would require the line:

    Pin: release o=Debian
7
  • Thanks so much, really!! But I want to know, what means the release o=Debian? I get that all the stable packages have high priority, but, what do you mean there by release debian? I mean I understand by release buster, sid, jessie...etc. So how is that line of code selecting sid packages? Maybe that is selecting the newest packages, sid has them, and so they are set so -1? – Adrián Jaramillo Oct 8 '19 at 19:05
  • 1
    And how do you know writing debian that this is going to select sid repositories? – Adrián Jaramillo Oct 8 '19 at 19:13
  • I more or less get it, but I still can't understand how checking the originator can meet sid packages. Sorry if I'm been clumsy understanding this @GAD3R – Adrián Jaramillo Oct 8 '19 at 20:11
  • yes but in the buster main repositories, the originator is also debian I guess, so why this doesn't change the priority of stable packages to -1? – Adrián Jaramillo Oct 8 '19 at 20:47
  • So the file of pinning priorities set priorities and then, the next priority blocks can't overwrite the previous? I mean, the priority goes from up to down in that file? @GAD3R – Adrián Jaramillo Oct 8 '19 at 21:03
0

Use a=unstable (suite match) or n=sid (codename match) in your release-based pin configuration; a=sid does not match anything, see man apt_preferences.

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.