How to fix W: Failed to fetch URL 403 Forbidden in APT
This error occurs when apt cannot access a repository due to HTTP 403 access restrictions. Common causes include deprecated PPAs, repository configuration mismatches, or network issues.
Quick fix
Fixes W: Failed to fetch URL 403 Forbidden
sudo apt update 2>&1 | grep -i "failed\|403"- Identify failing repositories
- List all enabled repositories
- Disable or remove problematic PPAs
- Switch HTTP repositories to HTTPS
sudo apt update 2>&1 | grep -i "failed\|403"W: Failed to fetch URL 403 Forbidden
What this error means
The APT package manager attempted to fetch package metadata from a configured repository, but the server rejected the request with HTTP 403 Forbidden. This indicates the connection succeeded, but the server denied access to the requested resource. The 403 error typically means the repository is either no longer available, configured for a different system version, or the source list contains invalid entries.
Typical symptoms
- apt update or apt-get update fails with 403 Forbidden errors
- W: Failed to fetch messages appear for one or more repositories
- Cannot install or upgrade packages due to update failures
- Specific PPA repositories are inaccessible while others work
Common causes
- Deprecated or discontinued PPA repositories that no longer exist or have been removed
- Repository source configured for a different Ubuntu/Debian version than the system
- Invalid or outdated repository entries in /etc/apt/sources.list or /etc/apt/sources.list.d/
- Network connectivity issues between the system and the repository server
- HTTP proxy or firewall rules blocking access to specific repositories
- Repository server-side access restrictions or rate limiting
- Bug in older APT versions with incorrect HTTP redirect handling
How to fix "W: Failed to fetch URL 403 Forbidden"
First, determine which repositories are causing the 403 error:
sudo apt update 2>&1 | grep -i "failed\|403"This will show you the specific repository URLs that are returning 403 errors.
View all currently enabled repository sources to identify problematic ones:
grep -r --include='*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/Note any PPAs or third-party repositories that appear suspicious or unfamiliar.
Remove or disable the failing repositories. For PPAs, you have several options:
Option A: Via GUI (Ubuntu/Linux Mint)
1. Open Software Sources from the system menu
2. Find the problematic repository in the PPAs or Additional Repositories tab
3. Uncheck it to disable it
4. Click Close
Option B: Via command line
Find and remove the problematic .list file:
sudo rm /etc/apt/sources.list.d/repository-name.list
sudo rm /etc/apt/sources.list.d/repository-name.list.saveFor example, if jonathonf-python-3.6-ubuntu.list is failing:
sudo rm /etc/apt/sources.list.d/jonathonf-python-3.6-ubuntu.list*If the repository URLs use HTTP, try switching to HTTPS for better compatibility:
sudo sed -i 's|http://archive.ubuntu.com|https://archive.ubuntu.com|g' /etc/apt/sources.list
sudo sed -i 's|http://security.ubuntu.com|https://security.ubuntu.com|g' /etc/apt/sources.listThen try updating again:
sudo apt updateIf the default repository is still inaccessible, switch to an alternative mirror:
On Ubuntu:
1. Open Software Sources
2. In the Ubuntu Software tab, change the Download from dropdown to a different server (e.g., a regional mirror)
3. Click Close and try updating again
On Debian:
Switch to deb.debian.org which provides reliable access:
sudo sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.listIf you're on Linux Mint, try the maintenance cleanup:
1. Open Software Sources from the system menu
2. Click the Maintenance tab at the bottom
3. Click "Purge residual configuration"
4. Close Software Sources
5. Try updating again:
sudo apt updateIf the issue persists, verify network connectivity:
# Test DNS resolution
nslookup archive.ubuntu.com
# Test HTTP connectivity to a repository
curl -I http://archive.ubuntu.com/ubuntu/dists/
# Check for IPv6 issues
ping6 archive.ubuntu.comIf IPv6 connectivity is causing problems, you can disable IPv6:
Via Network Settings GUI:
1. Open Network Connections
2. Edit your connection
3. Go to IPv6 tab
4. Set dropdown to "Ignore"
5. Save and restart the network connection
Via command line (temporary):
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1After making changes, verify that apt update works correctly:
sudo apt update
sudo apt upgrade -yIf all repositories are now accessible, you should see success messages for each repository source.
Advanced notes
The 403 Forbidden error indicates a successful connection but denied access. This differs from connection timeout errors (connection refused) or DNS errors. A 403 response typically comes from the repository server itself, not from network firewalls or proxies. If you're behind a corporate proxy, you may need to configure APT to use the proxy. Older versions of APT have a known bug with HTTP 302 redirects that can incorrectly return 403 errors; updating APT may resolve this. Some CI/CD systems like CircleCI have had issues with 403 errors due to IP-based rate limiting or access restrictions.
Frequently asked questions
- What does "W: Failed to fetch URL 403 Forbidden" mean?
- The APT package manager attempted to fetch package metadata from a configured repository, but the server rejected the request with HTTP 403 Forbidden. This indicates the connection succeeded, but the server denied access to the requested resource. The 403 error typically means the repository is either no longer available, configured for a different system version, or the source list contains invalid entries.
- How do I fix "W: Failed to fetch URL 403 Forbidden"?
- This error occurs when apt cannot access a repository due to HTTP 403 access restrictions. Common causes include deprecated PPAs, repository configuration mismatches, or network issues.
- What causes "W: Failed to fetch URL 403 Forbidden"?
- Deprecated or discontinued PPA repositories that no longer exist or have been removed Repository source configured for a different Ubuntu/Debian version than the system Invalid or outdated repository entries in /etc/apt/sources.list or /etc/apt/sources.list.d/
- Is the "W: Failed to fetch URL 403 Forbidden" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐APT Official Documentation
- ๐ฌLinux.org: Why does apt update cause 403 Forbidden errors?(Stack Overflow)
- ๐ฌLinux Mint Forums: 403 forbidden on sudo apt update(Stack Overflow)