Skip to content

Instantly share code, notes, and snippets.

@tst32
Created January 5, 2023 18:09
Show Gist options
  • Save tst32/9a188d39ce250dfbf45fd827d0512b3b to your computer and use it in GitHub Desktop.
Save tst32/9a188d39ce250dfbf45fd827d0512b3b to your computer and use it in GitHub Desktop.
how to resolve: public key is not available: NO_PUBKEY 23F3D4EA75716059 (microsoft way)
type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

@tst32
Copy link
Author

tst32 commented Jan 15, 2023

sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg

@tst32
Copy link
Author

tst32 commented Feb 6, 2023

there are two ways to replace the use of the obsolete apt-key in a new way
The first way is to put the desired "NO_PUBKEY" and put it in the trusted by apt service gpg repository.
/etc/apt/trusted.gpg.d/ this is a common way for installers scripts
Another way which I have shown in the examples above is to specify the desired gpg file as a valid signature in the repo source file. This requires first downloading the gpg file and then converting it to the desired by apt format and saving it to a convenient location - usually either in your home directory or in /usr/share/keyrings/<name.gpg>
and then add it to the source.list file

.i.e.

# ищем NO_PUBKEY
gpg --no-default-keyring --keyring protonvpn.gpg --keyserver keyserver.ubuntu.com  --recv-keys 4EDE055B645F044F
# экспорт в нужный для APT формат
gpg --no-default-keyring --keyring $HOME/.gnupg/protonvpn.gpg --export > ./archive-protonvpn.gpg
# копируем в удобное место
cp ./archive-protonvpn.gpg /usr/share/keyrings/
sudo chmod 644 /usr/share/keyrings/archive-protonvpn.gpg 
# открывам nano/vi/gedit
nano /etc/apt/sources.list.d/protonvpn-stable.list
# добавляем
deb [arch="all" signed-by=/usr/share/keyrings/archive-protonvpn.gpg] https://repo.protonvpn.com/debian stable main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment