Sample Header Ad - 728x90

Installing Sublime Text with apt fails due to missing public key

2 votes
3 answers
6324 views
I am using the instructions linked below to setup apt to install sublime-text. I am intentionally applying the method for connecting to third party repositories described on the Debian and Stackexchange pages, using Sublime as an example of a third party repo. https://www.sublimetext.com/docs/linux_repositories.html https://wiki.debian.org/DebianRepository/UseThirdParty https://unix.stackexchange.com/questions/332672/how-to-add-a-third-party-repo-and-key-in-debian/582853#582853 However, when running apt update I am getting the following error regarding the encryption key: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 This is what I am doing: Download key, convert key from ascii to binary, and move key to shared location: curl https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor > ~/Downloads/sublime-keyring.gpg sudo mkdir -vp /usr/local/share/keyrings/ sudo mv -v ~/Downloads/sublime-keyring.gpg /usr/local/share/keyrings/sublime-keyring.gpg sudo chown -v root:root /usr/local/share/keyrings/sublime-keyring.gpg sudo chmod -v 0640 /usr/local/share/keyrings/sublime-keyring.gpg Create source list: printf "deb [signed-by=/usr/local/share/keyrings/sublime-keyring.gpg] https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list Set pinning rules to restrict repo usage: printf "%s\n" "Package: *" "Pin: origin download.sublimetext.com" "Pin-Priority: 1" "" "Package: sublime-text" "Pin: origin download.sublimetext.com" "Pin-Priority: 500" | sudo tee /etc/apt/preferences.d/sublime-text.pref Then I run sudo apt update which creates the following output regarding sublime text repo: Get:1 https://download.sublimetext.com apt/stable/ InRelease [2.536 B] Err:1 https://download.sublimetext.com apt/stable/ InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 W: GPG error: https://download.sublimetext.com apt/stable/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 E: The repository 'https://download.sublimetext.com apt/stable/ InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. When I run with debug for gpg, sudo apt -o Debug::Acquire::gpgv=True update, I get a few more details: Get:1 https://download.sublimetext.com apt/stable/ InRelease [2.536 B] 0% [Waiting for headers] [Waiting for headers]inside VerifyGetSigners Preparing to exec: /usr/bin/apt-key --quiet --readonly --keyring /usr/local/share/keyrings/sublime-keyring.gpg verify --status-fd 3 /tmp/apt.sig.zwA50y /tmp/apt.data.zbzsmw Read: [GNUPG:] NEWSIG Read: [GNUPG:] ERRSIG F57D4F59BD3DF454 1 8 01 1627009220 9 - Got ERRSIG F57D4F59BD3DF454 ! Read: [GNUPG:] NO_PUBKEY F57D4F59BD3DF454 Got NO_PUBKEY F57D4F59BD3DF454 ! gpgv exited with status 2 Summary: Good: Valid: Bad: Worthless: SoonWorthless: NoPubKey: NO_PUBKEY F57D4F59BD3DF454 Signed-By: NODATA: no Err:1 https://download.sublimetext.com apt/stable/ InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 W: GPG error: https://download.sublimetext.com apt/stable/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 E: The repository 'https://download.sublimetext.com apt/stable/ InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. I read this to mean that apt is correctly passing on the location of the key I have downloaded. This could mean that gpg can not read the contents of the key. Or maybe the key was somehow mangled in the dearmoring process and no longer has the contents expected. This is pure guessing on my part. When I inspect the dearmored key, sudo gpg --show-keys /usr/local/share/keyrings/sublime-keyring.gpg, I get the following, which seems plausibly correct: pub rsa4096 2017-05-08 [SCEA] 1EDDE2CDFC025D17F6DA9EC0ADAE6AD28A8F901A uid Sublime HQ Pty Ltd sub rsa4096 2017-05-08 [S] The key is readable, although it does not mention F57D4F59BD3DF454. So what went wrong? How can I get this to function correctly?
Asked by tompi (292 rep)
Aug 6, 2021, 09:43 PM
Last activity: Jun 10, 2023, 08:22 AM