install(ubuntu): place key in /etc/apt/keyrings#5350
Merged
Conversation
skshetry
commented
Mar 4, 2025
Contributor
There was a problem hiding this comment.
PR Overview
This PR updates the installation instructions for Debian/Ubuntu by replacing the deprecated apt-key commands with the new method of placing the GPG key in /etc/apt/keyrings.
- Removed commands using apt-key and /etc/apt/trusted.gpg.d
- Introduced commands to install wget and gpg, create /etc/apt/keyrings, and place the key appropriately
Reviewed Changes
| File | Description |
|---|---|
| content/docs/install/linux.md | Updated Ubuntu installation instructions to use keyrings instead of deprecated apt-key commands |
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
skshetry
commented
Mar 6, 2025
| $ sudo apt install wget gpg | ||
| $ sudo mkdir -p /etc/apt/keyrings | ||
| $ wget -qO - https://dvc.org/deb/iterative.asc | sudo gpg --dearmor -o /etc/apt/keyrings/packages.iterative.gpg | ||
| $ echo "deb [signed-by=/etc/apt/keyrings/packages.iterative.gpg] https://dvc.org/deb/ stable main" | sudo tee /etc/apt/sources.list.d/dvc.list |
Collaborator
Author
There was a problem hiding this comment.
dvc.list had trusted=yes which I have dropped here.
skshetry
commented
Mar 6, 2025
skshetry
commented
Mar 6, 2025
Comment on lines
+108
to
115
| $ sudo apt install wget gpg | ||
| $ sudo mkdir -p /etc/apt/keyrings | ||
| $ wget -qO - https://dvc.org/deb/iterative.asc | sudo gpg --dearmor -o /etc/apt/keyrings/packages.iterative.gpg | ||
| $ echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/packages.iterative.gpg] https://dvc.org/deb/ stable main" | sudo tee /etc/apt/sources.list.d/dvc.list | ||
| $ sudo chmod 644 /etc/apt/keyrings/packages.iterative.gpg /etc/apt/sources.list.d/dvc.list | ||
| $ sudo apt update | ||
| $ sudo apt install dvc | ||
| ``` |
Collaborator
Author
0x2b3bfa0
approved these changes
Mar 6, 2025
Contributor
There was a problem hiding this comment.
I'll refrain from recommending "pearls" like this... 😸 🧶
# install -D -groot -oroot -m644 <(wget -qO- https://dvc.org/deb/iterative.gpg) /etc/apt/keyrings/packages.iterative.gpg
# install -D --group=root --owner=root --mode=u=rw,g=r,o=r <(echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/packages.iterative.gpg] https://dvc.org/deb/ stable main") /etc/apt/sources.list.d/dvc.list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The script that we have is a huge security risk. We were adding our key unconditionally to be trusted by apt for any package from any repo.
Instead, we should create a
.listfile for the repository to tell apt where to find the key for that specific repo, which is what this PR does.As recommended in https://manpages.ubuntu.com/manpages/jammy/en/man8/apt-key.8.html#deprecation.
Also, see https://askubuntu.com/questions/1286545/what-commands-exactly-should-replace-the-deprecated-apt-key.
Also related: #3683.