Tuesday, October 6, 2015

Fix "Cannot add PPA. Please check that the PPA name or format is correct" And Other CA-Certificates Related Issues In Ubuntu

Yesterday I encountered an issue in Ubuntu related to CA-certificates which resulted in errors when trying to add PPA repositories, cloning GIT repositories and more and I decided to make an article on how to fix these issues in Ubuntu, in case you run into the same issue.

Here's what happened. Firstly, I tried adding a PPA via command line, and this was the output:
sudo add-apt-repository ppa:failsdownloadsteam/java
[sudo] password for andrei:
Cannot add PPA: 'ppa:failsdownloadsteam/java'.
Please check that the PPA name or format is correct.

add-apt-repository ca-certificates error

The PPA name was definitely correct and I wasn't using any proxies so I had no idea what could be wrong at that point. Then I tried to add the PPA via Software Sources (called "Software & Updates" in newer Ubuntu versions). That didn't work either.

Then (it may seem unrelated but it actually wasn't) I tried to clone a Git (GitHub) repository and the following error was displayed:
fatal: unable to access 'http://github.com/rg3/youtube-dl.git': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Thanks to this error message I figured out that there was something wrong with CA certificates (the "ca-certificates" package includes PEM files of CA certificates to allow SSL-based applications to check for the authenticity of SSL connections). For some reason, the CA certificates on my system were broken or missing.

The fix is rather simple and it only requires reinstalling ca-certificates. So to fix it, use the following command:
sudo apt-get install --reinstall ca-certificates
Reinstalling ca-certificates (the command above) fixed both adding PPAs ("add-apt-repository" command) as well as cloning GIT repositories, among others.

No comments:

Post a Comment