Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use apt preferences to prefer packages from the mirror over the main repos #18793

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saiarcot895
Copy link
Contributor

Why I did it

Currently, if snapshots are enabled, then packages from the mirror and packages from the main repos have the same priority. This becomes problematic if the main repos have a package that's of a newer version than the snapshots, and something wants to install that newer version, even though it could be installed with that older version. For example, if a -dev package is being installed, and there's a newer version of the -dev and the main package in the main repos (compared to the snapshots), then apt will try to install the newer -dev package, which will have a dependency on the newer main package, but the older main package will still be installed. It could instead try to install the older -dev package from the snapshots, which would be installable.

Work item tracking
  • Microsoft ADO (number only):

How I did it

To fix this, use apt preferences to give the pacakges in the snapshot repo a higher priority than the ones in the main repo. This should be enough to convince apt to use packages from the snapshot repo whenever possible, but it still allows packages from the main repo to be installed, in case some change comes in that requires that for whatever reason.

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

…repos

Currently, if snapshots are enabled, then packages from the mirror and
packages from the main repos have the same priority. This becomes
problematic if the main repos have a package that's of a newer version
than the snapshots, and something wants to install that newer version,
even though it could be installed with that older version. For example,
if a -dev package is being installed, and there's a newer version of the
-dev and the main package in the main repos (compared to the snapshots),
then apt will try to install the newer -dev package, which will have a
dependency on the newer main package, but the older main package will
still be installed. It could instead try to install the older -dev
package from the snapshots, which would be installable.

To fix this, use apt preferences to give the pacakges in the snapshot
repo a higher priority than the ones in the main repo. This should be
enough to convince apt to use packages from the snapshot repo whenever
possible, but it still allows packages from the main repo to be
installed, in case some change comes in that requires that for
whatever reason.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
@saiarcot895 saiarcot895 marked this pull request as draft April 25, 2024 00:40
@mssonicbld
Copy link
Collaborator

/azp run

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants