How to Fix ‘Failed to Fetch 403 Forbidden’ in Ubuntu apt Update

Executing sudo apt update on an Ubuntu or Debian system should query configured software mirrors and refresh the local package cache. However, encountering errors reading “E: Failed to fetch http://… 403 Forbidden [IP: …]” halts package management. The HTTP 403 Forbidden status code indicates that the remote web server understood your request, but explicitly refused authorization. This error typically occurs when an enterprise proxy blocks package downloads, local internet service providers (ISPs) or cloud mirrors enforce geo-blocking, cloudflare rate-limits rapid automated requests, or third-party Personal Package Archives (PPAs) were removed or restricted by their maintainers.

Identify Which Specific Repository Triggered the 403 Error

The APT terminal output highlights the exact domain and repository URL responsible for the access refusal.

  1. In your terminal window, scroll up to the lines flagged with Err:.
  2. Look for lines resembling:
    Err:8 https://ppa.launchpadcontent.net/maintainer/ppa/ubuntu noble InRelease
      403  Forbidden [IP: 185.125.190.80 443]
  3. Note the failing repository URL. If the URL points to a Launchpad PPA, the maintainer likely deleted the repository or restricted builds. If it points to an official Ubuntu archive mirror, the IP address may be geo-blocked or rate-limited.

Switch from a Geographic Mirror to the Main Ubuntu Mirror

Country-specific Ubuntu mirror servers (such as us.archive.ubuntu.com or regional ISP caches) occasionally suffer Cloudflare DDoS protections or temporary firewall blocks that reject legitimate queries.

  1. Open the master repository list file in the nano editor with administrative privileges:
    sudo nano /etc/apt/sources.list
  2. Search for country-specific subdomains (e.g. http://us.archive.ubuntu.com/ubuntu/).
  3. Replace all regional prefixes with the primary canonical archive:
    http://archive.ubuntu.com/ubuntu/
  4. Alternatively, automate this replacement across the file using sed:
    sudo sed -i 's/[a-z]*.archive.ubuntu.com/archive.ubuntu.com/g' /etc/apt/sources.list
  5. Save the file with Ctrl + O and exit with Ctrl + X.
  6. Run sudo apt update to test connectivity.

Inspect and Clear Orphaned APT Proxy Configurations

If you previously utilized a corporate proxy, university VPN, or caching proxy (like apt-cacher-ng), stale configuration directives can route requests through dead endpoints.

  1. Inspect the APT configuration directory for proxy directives:
    grep -rn "Acquire::http::Proxy" /etc/apt/apt.conf /etc/apt/apt.conf.d/
  2. If an active proxy is detected in /etc/apt/apt.conf.d/proxy.conf, open the file and comment out the proxy line with a # symbol.
  3. Check user environment variables:
    env | grep -i proxy
  4. If http_proxy or https_proxy are set, unset them temporarily:
    unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY

Remove or Purge Blocked Third-Party PPAs

If a third-party PPA maintainer has restricted access or decommissioned their repository, remove the source file.

  1. If the failing source is a PPA, remove it using:
    sudo add-apt-repository --remove ppa:maintainer/ppa-name
  2. If it is a custom .list or .sources file in /etc/apt/sources.list.d/:
    sudo rm /etc/apt/sources.list.d/problematic-repo.list
  3. Clean the package archive:
    sudo apt clean && sudo apt update

Configure User-Agent Header for Cloudflare Bypass

Certain strict content delivery networks block the default Debian/Ubuntu APT user-agent string to prevent automated scraping.

  1. Create a custom configuration file:
    sudo nano /etc/apt/apt.conf.d/99user-agent
  2. Add the following directive to masquerade as standard browser traffic:
    Acquire::http::User-Agent "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0";
  3. Save and exit, then run sudo apt update.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.