3

trying install MS SQL Server 2022 on Debian 11 is driving me crazy, as I'm not being able to add MS repo properly. First of all, step-by-step guide by Microsoft -just for Ubuntu- in this page: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-linux-ver16&preserve-view=true

I add the the repo and import the public key, but doing sudo apt-get update gives the following error:

GPG Error: https://packages.microsoft.com/ubuntu/20.04/mssql-server-2022 focal InRelease: the following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF

I try importing again, but this time using gpg, importing the public key:

gpg --recv-keys --keyserver https://packages.microsoft.com/keys/microsoft.asc EB3E94ADBE1229CF

The key was added, I even check it with Kleopatra an the public key is imported.

But then again, doing sudo apt-get update, I get the same error again!

GPG Error: https://packages.microsoft.com/ubuntu/20.04/mssql-server-2022 focal InRelease: the following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF

I don't understand why apt-get cannot find the public key, if it is correctly imported.

Thanks in advance!

1
  • Welcome to Unix! You can improve your question by converting the URL to a link with an alternate string so screen readers will not speak the whole URL. Dec 22, 2022 at 1:07

1 Answer 1

2

apt uses gpg, but it maintains its own keyring store in /etc/apt/keyrings rather than the default ~/.gnupg/.

apt-key (a wrapper around gpg specifically for apt's needs) is the tool for manipulating apt's key store.

Microsoft's own web page has instructions for importing the key into apt with apt-key add:

curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/debian/10/prod
sudo apt-get update

That will need to be edited slightly for Debian 11 rather than 10. Or for whichever Ubuntu release you're using (don't use Debian packages with Ubuntu and vice-versa. The .deb format is compatible, but the actual packages and the libraries they depend upon may not be - and usually aren't).

And even the page you linked to has something very similar:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

(whether you use curl or wget to download the key is irrelevant - it's the apt-key add that's important)


PS: If you don't have any specific need for MS SQL (e.g. as a learning/training exercise or you use other software that ONLY works with it and not other SQL databases), IMO you would be far better off using Postgresql instead. It's packaged for Debian and almost every other Linux distro.

1
  • if you won't mind - please update the apt-key add since it has been deprecated to usr/share/keyrings
    – Allstar
    Oct 26, 2023 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .