Software & AppsOperating SystemLinux

How To fix curl error 77 on Ubuntu 20.04.3 LTS

Ubuntu 6

In this article, we will delve into the process of fixing the curl error 77 on Ubuntu 20.04.3 LTS. This error, which reads as “curl: (77) error setting certificate verify locations”, can occur when the certificate authority chain file is either missing or corrupted.

Quick Answer

To fix curl error 77 on Ubuntu 20.04.3 LTS, you can try reinstalling the ca-certificates package, updating the ca-certificates, fixing the permissions of the /etc/ssl/certs directory, or checking for a custom certificate file.

Understanding curl error 77

Before we dive into the solution, let’s understand what curl error 77 is. Curl is a command-line tool used to transfer data to or from a server. It supports various protocols, including HTTP, HTTPS, FTP, and more. Error 77 is related to the certificate authority chain file. This file is essential for verifying the authenticity of a server’s SSL/TLS certificate. If this file is missing, corrupted, or improperly configured, curl can’t verify the server’s certificate, hence the error.

Solutions to Fix curl error 77

There are several ways to fix this error. We’ll go through each one step-by-step.

Reinstalling the ca-certificates package

The first method is to reinstall the ca-certificates package. This package is responsible for providing the certificate authority chain file. You can reinstall it using the following commands:

sudo apt-get remove ca-certificates
sudo apt-get install ca-certificates

The apt-get remove command removes the ca-certificates package, and the apt-get install command installs it again.

Updating the ca-certificates

If reinstalling the ca-certificates package doesn’t work, you can try updating it. This can be done with the following command:

sudo update-ca-certificates

The update-ca-certificates command updates the certificate authority chain file with the latest certificates from the certificate authorities.

Fixing the permissions of the /etc/ssl/certs directory

In some cases, the error may be caused by incorrect permissions on the /etc/ssl/certs directory. You can fix the permissions with the following command:

sudo chmod -R 755 /etc/ssl/certs

The chmod command changes the permissions of a file or directory. The -R option makes the command recursive, meaning it applies to the directory and its subdirectories. The 755 sets the permissions to read and execute for everyone and write for the owner.

Checking for a custom certificate file

In some cases, the error may be caused by a custom certificate file appended to the ca-certificates.crt file, which is not in the required PEM format. You can check this by opening the ca-certificates.crt file with a text editor and looking for any certificates that don’t begin with -----BEGIN CERTIFICATE----- and end with -----END CERTIFICATE-----.

Conclusion

Fixing the curl error 77 on Ubuntu 20.04.3 LTS involves either reinstalling or updating the ca-certificates package, fixing the permissions of the /etc/ssl/certs directory, or checking for a custom certificate file. It’s important to be cautious when modifying the ca-certificates folders to avoid issues. If you’re unsure, always consult with a professional or seek help from online communities like StackOverflow or the Ubuntu Forums.

What is the purpose of the ca-certificates package?

The ca-certificates package is responsible for providing the certificate authority chain file, which is essential for verifying the authenticity of a server’s SSL/TLS certificate.

How can I reinstall the ca-certificates package?

To reinstall the ca-certificates package, you can use the following commands:

sudo apt-get remove ca-certificates
sudo apt-get install ca-certificates
What does the update-ca-certificates command do?

The update-ca-certificates command updates the certificate authority chain file with the latest certificates from the certificate authorities.

How can I fix the permissions of the /etc/ssl/certs directory?

You can fix the permissions of the /etc/ssl/certs directory using the following command:

sudo chmod -R 755 /etc/ssl/certs
How can I check for a custom certificate file?

To check for a custom certificate file, you can open the ca-certificates.crt file with a text editor and look for any certificates that don’t begin with -----BEGIN CERTIFICATE----- and end with -----END CERTIFICATE-----.

Leave a Comment

Your email address will not be published. Required fields are marked *