Articles on: Linux VPS

Speed Up Your apt update: Troubleshooting Slow Performance

If you're experiencing slow performance with the apt update command on a Linux VPS with Ubuntu 20.04, there are several potential causes and corresponding solutions you can investigate:

Slow apt update

Common Causes and Solutions

Note: If you login as user, run this command to login as root : sudo su

Geographically Distant Mirrors

Cause: The default repository mirrors may be geographically distant from your location.
Solution: Change the mirror to by running :

sed -i -e 's/' /etc/apt/sources.list

Change apt mirror

Fast apt update

Local Cache Issues

Cause: Corrupted or outdated cache can affect apt update.
Solution: Clear the local cache by running:
sudo rm -rf /var/lib/apt/lists/*
sudo apt update

DNS Issues

Cause: Slow DNS response times can slow down repository access.
Solution: Change your DNS settings to use faster public DNS servers, such as Google DNS (, or Cloudflare DNS (,
sudo nano /etc/resolv.conf

Update to:


Check current DNS server :

`systemd-resolve --status

Current DNS Server

Proxy Server

Cause: If you are behind a proxy, the proxy server might be causing delays.
Solution: Check your proxy settings and ensure they are correctly configured. You can also try bypassing the proxy to see if it improves speed.

Firewall and Network Configuration

Cause: Network firewalls or misconfigurations can slow down or block connections.
Solution: Check firewall rules and network configurations to ensure they're not the bottleneck. Consult with your network administrator if you're in a managed environment.
Solution: Ubuntu usually preinstalled with ufw firewall.

Check the detailed status of the UFW service:
sudo ufw status verbose
Detailed UFW status

Stop and disable the UFW service:
sudo ufw disable

ufw disable

Additional Tips

Run apt update at Different Times of Day: Sometimes server load varies throughout the day. Running updates during off-peak hours might be faster.
Use Parallel Downloads: Enable parallel downloads in APT for faster updates.
echo 'APT::Acquire::Retries "3";' | sudo tee -a /etc/apt/apt.conf.d/80-retries
echo 'Acquire::Queue-Mode "access";' | sudo tee -a /etc/apt/apt.conf.d/80-queue-mode

Example /etc/apt/sources.list with Updated Mirrors

Here's an example of how your /etc/apt/sources.list might look after updating to a country-specific mirror:

deb focal main restricted
deb focal-updates main restricted
deb focal universe
deb focal-updates universe
deb focal multiverse
deb focal-updates multiverse
deb focal-backports main restricted universe multiverse
deb focal-security main restricted
deb focal-security universe
deb focal-security multiverse

By addressing these potential issues, you can often significantly improve the performance of the apt update command.

Updated on: 28/05/2024

Was this article helpful?

Share your feedback


Thank you!