Skip to main content

How can I make apt install packages of a specific release with just apt update and upgrade when I h [Resolved]

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 buster main
deb-src buster main

deb buster/updates main
deb-src 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 sid main
deb-src 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:

  Installed: 2.29-2
  Candidate: 2.29-2
  Version table:
 *** 2.29-2 500
        500 sid/main amd64 Packages
        100 /var/lib/dpkg/status
     2.28-10 500
        500 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

Question Credit: green_yallowa
Question Reference
Asked October 9, 2019
Posted Under: Unix Linux
2 Answers

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.

credit: Ferenc Wágner
Answered October 9, 2019
Your Answer