Ubuntu apt Certificate Verification Failed: Fixes
In this article
If Ubuntu reports that apt certificate verification failed, it usually cannot validate the HTTPS certificate presented by a package repository. Check the system clock, refresh the CA certificates, and verify the repository URL and network path; do not disable certificate checks, because that removes an important safeguard against tampered packages.
What the error means
APT downloads package indexes and packages from configured sources, commonly over HTTPS. During a secure connection, the server presents a certificate. The client checks that the certificate is valid for the server name, is within its validity period, and chains to a trusted certificate authority (CA). If a required check fails, apt may refuse the connection and show an error mentioning certificate verification, TLS, or a certificate issuer.
The exact wording matters. A certificate verification failure is different from a repository returning “404 Not Found,” an invalid repository signature, or a DNS lookup failure. Those problems can also stop updates, but they need different fixes. Read the lines immediately above and below the error to identify the affected host and whether the issue occurs for one source or many.
Start with the clock and the scope
An incorrect date or time is one of the simplest causes. Certificates have start and expiry dates; a machine whose clock is far behind or ahead can treat a valid certificate as not yet valid or expired. Check the current time with:
date— compare the result with the real local time, including the year.timedatectl status— check whether the clock is synchronized and whether network time synchronization is enabled.
If synchronization is disabled or the clock is wrong, correct the system time using your normal system settings or time-synchronization service, then retry sudo apt update. On a virtual machine, container, or dual-boot system, check whether its host or another operating system is setting the hardware clock incorrectly.
Next, determine the scope. If every HTTPS repository fails, suspect the clock, missing or outdated CA certificates, a proxy, or a network-wide inspection device. If only one repository fails, inspect that source’s URL, hostname, certificate, and repository configuration. A failure limited to one network may point to a captive portal or network proxy.
Refresh Ubuntu’s trusted CA certificates
Ubuntu uses a bundle of trusted CA certificates to validate many HTTPS connections. If that bundle is missing or stale, apt may not recognize a legitimate certificate chain. On a normally functioning Ubuntu installation, refresh the package index and reinstall the CA bundle:
sudo apt update
sudo apt install --reinstall ca-certificates
sudo update-ca-certificates
sudo apt update
The first command may itself fail if apt cannot reach any repository. If so, check the clock and network first. If the machine has no working network, use a trusted Ubuntu installation medium or an approved offline package-management method rather than downloading certificates from an unverified source. On a managed computer, ask the administrator before changing trusted certificates.
Do not assume that manually adding a certificate is always the right fix. A CA certificate should be trusted only when its source and purpose are verified. Trusting an unknown root certificate can let whoever controls it impersonate secure websites and package servers.
Check repository addresses and configuration
Review the repository named in the error. A hostname typo, obsolete mirror, or URL that redirects to a different host can cause a name or certificate mismatch. Ubuntu repository entries are commonly stored in /etc/apt/sources.list and files under /etc/apt/sources.list.d/; newer installations may also use deb822-format files ending in .sources.
Inspect the relevant entry and make sure its hostname is the one supplied by the repository provider. For Ubuntu’s official repositories, use the supported Ubuntu archive locations and the release’s documented configuration. For third-party repositories, consult the vendor’s current instructions. Do not “fix” a hostname mismatch by accepting the certificate anyway: it may indicate a misconfiguration, interception, or a connection to the wrong server.
If the system recently upgraded Ubuntu, confirm that the configured repositories support the installed release. A repository that has been discontinued or moved may need to be replaced or removed, though an unsupported source does not by itself explain every certificate error.
Proxies, captive portals, and network inspection
A proxy, VPN, corporate firewall, or public Wi-Fi login page can change what apt receives. For example, a captive portal may return a sign-in page instead of the expected repository response. A company network may inspect encrypted traffic and present certificates signed by an organization-specific CA. Ubuntu will reject those certificates unless the organization’s CA is correctly installed and trusted.
- Try a different trusted network, if permitted. If apt works there, investigate the original network or proxy.
- Check whether apt has proxy settings in
/etc/apt/apt.conf, files under/etc/apt/apt.conf.d/, or relevant environment variables. - On managed networks, obtain the correct CA and installation instructions from the administrator. Verify the certificate through an established organizational channel.
A proxy setting can be valid for a browser but absent or incorrect for apt, since applications may use different configuration. Conversely, changing proxy settings without authorization may violate network policy.
Why disabling verification is unsafe
Advice to turn off HTTPS peer verification, accept every certificate, or use an insecure repository option is not a safe general solution. It can expose downloads to interception or substitution. APT also checks repository signatures, which provide a separate integrity mechanism, but bypassing transport checks can still leak information and create opportunities for attacks or confusing configuration failures. Keep both certificate validation and repository signature checking enabled.
Likewise, do not “solve” the problem by downloading a random certificate or key from a forum. Use certificates and keys published by the repository owner through an authenticated, documented channel. APT signing-key errors and TLS certificate errors are distinct: installing a repository signing key will not repair a broken HTTPS certificate chain.
Frequently Asked Questions
Can the wrong date really make apt certificate verification fail?
Yes. Certificate validity is checked against the system clock. Correct the date, time, and synchronization status, then run sudo apt update again.
Why does apt fail when my browser opens the repository?
The browser and apt may use different proxy settings, certificate stores, or network paths. A browser may also show a warning that you have overlooked. Check apt’s proxy configuration and read the browser’s certificate details rather than assuming the connection is trustworthy.
Should I use an insecure apt option to get updates?
No. Options that bypass certificate or repository verification weaken protection against tampered downloads. Find and correct the underlying clock, CA, repository, or network problem instead.
What if only one third-party repository fails?
Check that repository’s hostname and current setup instructions, and confirm it supports your Ubuntu release. If the provider has discontinued the repository, remove or replace its source rather than disabling verification.
Does reinstalling ca-certificates always fix the error?
No. It helps when the trusted CA bundle is missing or damaged, but it will not correct a wrong clock, an invalid server certificate, a bad hostname, or a proxy presenting an untrusted certificate.