4

I recently installed Ubuntu 20.04. Considering the time that passed since its release I thought it would be stable. After installing it, I go to Snap Store (named Ubuntu Software) and I see that several new programs appear, but after a few moments, only the editor picks show, nothing else.

I try to install PyCharm through the command line with snap, sudo snap install pycharm-community --classic but it gives me this error: x509: certificate signed by unknown authority.

Afterwards, I decide to purge snap store and reinstall it, and after running these 2 commands: sudo apt-get update,sudo apt install snapd, I enter this one sudo snap install snap-store and gives me again, the same error with the certificates.

I got no idea whats going on. I installed it from 0

Edit 1:
Output of snap list:

No snaps are installed yet. Try 'snap install hello-world'.

Output of sudo snap install snap-store:

error: cannot install "snap-store": Post
       https://api.snapcraft.io/v2/snaps/refresh: x509: certificate signed by
       unknown authority
Random Person
  • 1,488
  • 1
  • 14
  • 33
learn123456
  • 41
  • 1
  • 4

1 Answers1

2

This may be due to a missing trusted CA certificate.

Verification of the cause

Test #1

openssl s_client -connect api.snapcraft.io:443

Example of a response that confirms a missing CA certificate. See line with verify error:

$ openssl s_client -connect api.snapcraft.io:443
CONNECTED(00000003)
depth=1 C = US, O = DigiCert Inc, CN = DigiCert TLS RSA SHA256 2020 CA1
verify error:num=20:unable to get local issuer certificate

Test #2

ls -l /etc/ssl/certs | grep -i digicert

DigiCert CA certificates should be displayed e.g. as follows

b1159c4c.0 -> DigiCert_Assured_ID_Root_CA.pem
dd8e9d41.0 -> DigiCert_Global_Root_G3.pem
244b5494.0 -> DigiCert_High_Assurance_EV_Root_CA.pem
3513523f.0 -> DigiCert_Global_Root_CA.pem
607986c7.0 -> DigiCert_Global_Root_G2.pem
7f3d5d1d.0 -> DigiCert_Assured_ID_Root_G3.pem
75d1b2ed.0 -> DigiCert_Trusted_Root_G4.pem
9d04f354.0 -> DigiCert_Assured_ID_Root_G2.pem

When they are not, they need to be added.

Solution

sudo dpkg-reconfigure ca-certificates
sudo systemctl restart snapd
sudo snap refresh

The first command allows you to add interactively new CA certificates. The source for adding certificates can usually be found in the directory /usr/share/ca-certificates/mozilla/

If certificates are missing there, they can be downloaded from https://www.digicert.com/kb/digicert-root-certificates.htm

netbat
  • 889
  • 1
  • 12