Resolving Certificate Verification Failure in WSL Ubuntu for add-apt-repository

Abstract: Resolve certificate verification failures in WSL Ubuntu add-apt-repository by installing the corporate proxy's CA certificate into the system trust store.

Created: 2026-10-14 by

The add-apt-repository command fails with certificate verification errors in WSL Ubuntu when network security policies intercept TLS traffic. This occurs because the interception proxy uses a custom root certificate not present in the system’s trusted store. You can resolve this by downloading the proxy’s CA certificate and installing it into /usr/local/share/ca-certificates/, then running update-ca-certificates.

Understanding the Root Cause

When you use tools like add-apt-repository or apt update inside Windows Subsystem for Linux (WSL), the environment relies on the standard Ubuntu trust store to verify SSL/TLS certificates. In many corporate or educational networks, a transparent proxy or firewall intercepts HTTPS traffic to scan for malware or enforce policy. This process requires the proxy to present its own digital certificate instead of the original site’s certificate. Because your WSL instance does not recognize this custom Certificate Authority (CA) as a trusted source, OpenSSL rejects the connection with a "certificate verification failed" error. This is distinct from general network connectivity issues; if you can browse the web in Windows but cannot install packages in WSL, the issue is almost certainly related to certificate trust rather than network access. The WSL kernel shares the network interface with the host Windows machine, so the traffic flows through the same proxy, but the Linux guest does not automatically inherit the host’s trusted certificates unless explicitly configured.

Distinguishing from Other Network Issues

It is important to differentiate this problem from other common WSL networking quirks. For instance, some users encounter difficulties importing distros or managing disk space due to configuration errors unrelated to TLS. If you are experiencing installation failures or storage anomalies, those may require different troubleshooting steps. However, specific errors mentioning "SSL: CERTIFICATE_VERIFY_FAILED" or "unable to get local issuer certificate" point directly to the trust store mismatch described here.

Identifying the Interception Proxy

Before adding any certificates, you must identify which organization or device is performing the interception. Most commonly, this is a corporate security appliance provided by your IT department. You will need the public CA certificate used by this proxy. This file is typically available in one of two ways: 1. Direct Download: Some proxies provide a direct link to download the root certificate, often accessible via a specific URL within the organization’s intranet or portal. 2. Export from Browser: If you have administrative access to the Windows host where the proxy is installed, you can export the certificate from your web browser (Chrome, Edge, or Firefox). Navigate to the settings under Privacy and Security > Manage Certificates, locate the certificate issued by your organization, and export it in Base64 encoded X.509 format (.cer or .crt). Ensure that you obtain the correct root or intermediate CA certificate. Do not attempt to capture certificates dynamically using packet sniffers unless you have explicit permission, as this can be complex and prone to error. The static root certificate is the most reliable solution for persistent package management operations.

Installing the Certificate in WSL Ubuntu

Once you have the certificate file, follow these steps to integrate it into the WSL Ubuntu environment. Open your WSL terminal and ensure you have sudo privileges. First, create a directory for local custom certificates if it does not already exist. While /usr/local/share/ca-certificates/ is the standard location, ensuring the directory exists prevents permission errors during the next step.
sudo mkdir -p /usr/local/share/ca-certificates/extra
Next, copy your downloaded certificate file into this directory. Rename the file to end with .crt if it has a different extension. For example, if your file is named company-root.cer, move it as follows:
sudo cp ~/Downloads/company-root.cer /usr/local/share/ca-certificates/extra/company-root.crt
You can place multiple certificates in this folder if your network uses multiple CAs. Ensure the files are readable by the system. After copying the file, you must trigger the certificate update process. Run the following command to rebuild the trust store:
sudo update-ca-certificates
This command scans the /usr/local/share/ca-certificates/ directory and updates the /etc/ssl/certs/ca-certificates.crt file, which is used by OpenSSL and APT. You should see output indicating that new certificates were added.

Verifying the Fix

After updating the certificates, test the resolution by attempting the operation that previously failed. Run sudo apt update or try adding the repository again using add-apt-repository. If the configuration is correct, the commands should complete without SSL errors. If you still encounter issues, verify that the certificate was correctly copied and that there are no syntax errors in the file. You can also check the APT logs for more detailed error messages. Additionally, ensure that your WSL instance is up to date, although this specific fix applies to all modern versions of Ubuntu on WSL. For users who frequently switch between networks or need to manage their WSL distribution differently, understanding the underlying infrastructure is helpful. If you ever need to reset your environment or migrate your setup, knowing how to handle core components like certificates ensures smoother transitions. For broader context on managing your WSL instance, such as locating your installation files or dealing with disk usage, refer to our guide on Ubuntu WSL Install Location: Where to Find It?.

Frequently Asked Questions

Why does this work in Windows but not WSL?

Windows maintains its own separate certificate store managed by the operating system, which often includes corporate CAs by default. WSL runs a Linux kernel that uses the Unix-style trust store located in /etc/ssl/. These two stores do not sync automatically, requiring manual intervention for Linux-specific tools.

Can I use environment variables to bypass the certificate check?

While you can set CURL_CA_BUNDLE or REQUESTS_CA_BUNDLE to point to your certificate, this is not recommended for system-wide package management. Modifying the system trust store via update-ca-certificates is the permanent and correct solution that affects all applications, including APT and Git.

What if my company uses multiple interception proxies?

If your network routes traffic through different proxies depending on the destination, you may need to import multiple certificates. Simply copy each additional .crt file into the /usr/local/share/ca-certificates/extra/ directory and run sudo update-ca-certificates again after each addition.

Does this fix apply to other Linux distributions in WSL?

Yes, this method works for any Linux distribution running in WSL, such as Debian, Kali, or Fedora. Each distribution has its own trust store, so you must perform these steps individually for each distro you use that requires HTTPS access.

How do I remove the custom certificate later?

To remove the certificate, simply delete the corresponding .crt file from /usr/local/share/ca-certificates/extra/ and run sudo update-ca-certificates again. This will remove the certificate from the active trust store, reverting the system to its previous state.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More