This error occurs when apt cannot establish a connection to a configured proxy server. Common causes include incorrect proxy configuration, unreachable proxy server, wrong credentials, or firewall blocking.
The apt package manager has been configured to use a proxy server for downloading packages, but it cannot establish a connection to that proxy. This typically indicates a network connectivity issue between your system and the proxy server, misconfiguration in apt settings, or the proxy server being offline.
Check if apt is configured to use a proxy by examining these files:
sudo cat /etc/apt/apt.conf
sudo cat /etc/apt/apt.conf.d/proxy.conf
cat ~/.bashrc | grep -i proxy
cat /etc/environment | grep -i proxyLook for lines like:
Acquire::http::Proxy "http://proxy:port";
Acquire::https::Proxy "https://proxy:port";
http_proxy=http://proxy:portVerify the proxy server is reachable using telnet or nc:
telnet proxy.example.com 8080Or using nc:
nc -zv proxy.example.com 8080A successful connection shows no error message. If connection is refused, the proxy is not accessible.
If your proxy requires authentication, ensure credentials are properly configured. Special characters in passwords must be URL-encoded:
# Example with credentials:
Acquire::http::Proxy "http://username:[email protected]:8080/";For special characters like @ or !, use URL encoding:
- @ becomes %40
- ! becomes %21
- $ becomes %24
Test the proxy directly:
curl -x http://username:password@proxy:port http://example.comRun apt without the proxy to verify connectivity to package repositories:
sudo apt -o Acquire::http::Proxy=false updateIf this succeeds, your issue is with the proxy configuration. If it still fails, the problem is network connectivity to repositories.
If proxy is no longer needed, remove it from configuration:
# Remove proxy configuration files
sudo rm /etc/apt/apt.conf.d/proxy.conf
# Or comment out proxy lines in apt.conf
sudo nano /etc/apt/apt.confUnset environment variables:
unset http_proxy https_proxy ftp_proxy
unset HTTP_PROXY HTTPS_PROXY FTP_PROXYThen retry the apt command:
sudo apt updateSome networks have DNS issues that prevent hostname resolution for proxy servers. Try using the IP address directly:
Instead of:
Acquire::http::Proxy "http://proxy.example.com:8080/";Use:
Acquire::http::Proxy "http://192.168.1.100:8080/";If your network uses a PAC (Proxy Auto-Config) file, you cannot directly use it with apt. Instead, retrieve the PAC file, decode it to find the actual proxy server address, and configure apt with that address. Some corporate networks use transparent proxies that don't require explicit configuration - in that case, remove all proxy settings from apt. For rootless systems or containers, the proxy configuration may need to be set differently - check the specific container runtime documentation.
E: Package 'package:i386' has no installation candidate
How to fix "Package package:i386 has no installation candidate" in apt
E: The value 'value' is invalid for APT::Default-Release
How to fix invalid APT::Default-Release value in APT
dpkg: error: unable to create new file 'path': Permission denied
How to fix dpkg permission denied errors in APT
subprocess installed post-removal script returned error exit status 1
How to fix "subprocess installed post-removal script returned error exit status 1" in APT
dpkg: error processing package package-name (--install)
How to fix "dpkg: error processing package" in apt