Fix Slow Pacman Downloads on Arch Linux (Mirrors & Speed Fix)

Fix Slow Pacman Downloads on Arch Linux (Mirrors & Speed Fix)

How to Fix Pacman & Yay Slow Downloads on Arch Linux

Struggling with sluggish updates or "could not resolve host" errors on Arch Linux? These bottlenecks are typically caused by inefficient DNS resolvers or outdated package mirrors that are physically distant from your location.

Welcome back to MusaBase! Whether you have just finished a minimal Arch Linux installation or you are currently customizing your KDE Plasma desktop, slow download speeds can make the process frustrating. In today's guide, I will show you how to fix slow download issues in both Pacman and yay, while also configuring /etc/resolv.conf for a faster, more reliable connection.

In this guide, we will cover:

  • Adding Google and Cloudflare Public DNS for hostname resolution
  • Installing and configuring Reflector, a powerful mirror optimization tool
  • Updating your mirrorlist with the fastest and most secure servers
  • Optimizing Parallel Downloads to fetch multiple packages at once

By the end of this tutorial, you will have resolved your Pacman and yay speed issues and established a solid DNS configuration. Let’s get started!




The Problem: Pacman & yay Errors

Before we dive into the fixes, let's identify the symptoms. If you are seeing any of the following errors in your terminal, your DNS or mirrorlist is likely misconfigured or outdated.

If these look familiar, the following steps will resolve them.







Adding DNS Nameservers

When we run a command like sudo pacman -S firefox, your system needs to find the exact location of the mirror server (e.g.mirror.rackspace.com). Since computers communicate through IP addresses, a DNS acts as an interpreter.

By default Arch Linux uses the DNS provided by your ISP, if it is slow, outdated, or unreliable, your system fails to find the server's IP, resulting in the most common error known as: could not resolve host. In this step we will add publicly accessible nameservers provided by Cloudflare and Google, which will ensure that our system always finds the fastest path to the Arch mirrors.

We can solve this problem using two different methods:

  • Temporary Solution: By manually configuring /etc/resolv.conf
  • Permanent Solution (Specific & Global): By using NetworkManager's command-line tool nmcli

For a fast and immediate fix, you can follow Step 1.1. However, please note that these settings will revert to defaults after a network restart or a system reboot. For a long-term fix, follow Step 1.2 to make your DNS configuration persistent.


Step 1.1: Adding Nameservers Temporarily

  • To add nameservers, we first need to open the /etc/resolv.conf file.
  • Run the following command:
sudo nano /etc/resolv.conf
  • In the /etc/resolv.conf file, remove the existing nameserver if already exist.
    • Usually it looks like: 192.168.xx.xx
  • Add the following nameservers:
nameserver 1.1.1.1
nameserver 8.8.8.8
  • After adding the nameservers, press CTRL + O to save the files, then press ENTER to apply the changes, and press CTRL + X to exit the file.

1.2: Adding Permanent Nameservers for a Specific Connection

Using this method, you will set custom DNS for only one specific connection at a time, such as your Home Wi-Fi, Ethernet, or Mobile Hotspot. If you want to set these DNS settings globally for every network you connect to, please skip to Step 1.3. Otherwise, follow the steps below for your current network:

To add nameservers permanently we need the NMCLI tool to tell the Arch Linux system to disable the auto configured DNS resolving and use our added nameservers instead. To make the custom nameserver changes permanent, follow these steps:

  • Open terminal and run:
nmcli connection show
  • This will print out your list of connection-profiles.
  • Since, I'm connected to internet via my ethernet cable, it is showing my connection name as Wired connection 1.
  • If you are connected through Wi-Fi or hotspot, it may show you Wifi connection 1 or your wifi name.
  • Note the name of your currently connected connection.
  • Run the following command by adding your connection name in it.
sudo nmcli con mod "Wired connection 1" ipv4.ignore-auto-dns yes
  • Next, run nmcli command again with nameserver addresses:
sudo nmcli con mod "Wired connection 1" ipv4.dns "1.1.1.1 8.8.8.8"
  • After the changes, we also need to restart the connection with this command:
sudo nmcli con up "Wired connection 1"

1.3: Adding Permanent Nameservers Globally

If you want a "set and forget" solution, this method is for you. Unlike the previous step, this configuration enforces your custom DNS settings globally across the entire system.

This method ensures that your custom DNS settings remain active across all networks. Whether you are connecting to your university Wi-Fi, a friend's hotspot, or any public network, Arch Linux will strictly use your defined nameservers for every connection.

  • To set nameservers globally, first we need to create a global-dns.conf file.
  • Open terminal and run:
sudo nano /etc/NetworkManager/conf.d/global-dns.conf
  • The file will be empty.
  • Next, in the file add the following lines:
[main]
dns=default

[connection]
# Block all Auto DNS Provided by ISPs
ipv4.ignore-auto-dns=yes

[global-dns-domain-*]
servers=1.1.1.1,8.8.8.8
  • After adding the lines, press Ctrl + O to save the changes, then press Enter to apply the changes, then press Ctrl + X to exit the file.
  • Next for networkmanager to apply and use the custom added nameserver, we need to restart it.
  • Run:
sudo systemctl restart NetworkManager

# OR

sudo nmcli connection up "Wired connection 1"
  • Now to verify that your custom added nameservers, run:
cat /etc/resolv.conf
  • If you still see your ISP provided DNS even after disabling it in the global-dns.conf file, run the following command to shut it down indefinitely:
sudo nmcli connection modify "Wired connection 1" ipv4.dns ""
sudo nmcli connection up "Wired connection 1"

Revert DNS Configurations back to Defaults

If you are facing issues after configuring your DNS settings with permanent process, or want to use the ISP provided DNS, you can always revert back to defaults.


Revert DNS Settings back for Specific Connection

  • To revert back the DNS settings back to defaults for specific connection, run consecutively:
sudo nmcli connection modify "Wired connection 1" ipv4.dns ""
sudo nmcli con mod "Wired connection 1" ipv4.ignore-auto-dns no
sudo nmcli connection up "Wired connection 1"

Revert DNS Settings back Globally

  • If you followed and created the global-dns.conf file, then do the following:
sudo mv /etc/NetworkManager/conf.d/global-dns.conf /etc/NetworkManager/conf.d/global-dns.conf.bak

# OR
sudo rm /etc/NetworkManager/conf.d/global-dns.conf



Install Reflector & Update Mirrorlist

A Mirrorlist is a configuration file used by the package manager to identify the servers from which packages and updates are downloaded. Since high global traffic can make a single central server slow or even unresponsive, Linux distributions use mirrors. These are multiple servers around the world that host identical copies of the distribution's software repositories, acting just like a CDN to ensure fast and reliable downloads.

To set or update mirrorlist we can use reflector. It is a Python script which can retrieve the latest mirror list update the existing local mirrorlist file with fastest mirrors.

Install Reflector

  • To install reflector, simply run:
sudo pacman -Syu
sudo pacman -S reflector

Create Backup of Existing Mirrorlist

  • First, create the backup of existing mirrorlist with:
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak

Update Mirrorlist

  • Now, run:
sudo reflector --verbose --country 'Singapore,India,Germany' --latest 20 --protocol https --sort rate --connection-timeout 15 --save /etc/pacman.d/mirrorlist
  • Next, we need to sync the database with new mirrors.
  • Run:
sudo pacman -Syyu



Step 3: Optimize Parallel Downloads

By default, Pacman downloads packages five at a time or one by one. Even with the fastest mirrors, this can feel slow if you are installing a large desktop environment like KDE Plasma or GNOME. To fix this, we need to configure the pacman.conf file for Parallel Downloads.

  • Open the Pacman configuration file:
sudo nano /etc/pacman.conf
  • Look for the line ParallelDownloads = 5 or #ParallelDownloads=5.
  • Remove the # if present to enable this feature. You can also increase the number (e.g., 10) if you have a high-speed connection.

ParallelDownloads = 10
  • To save the changes, press Ctrl + O, then press Enter, and to exit the file, press Ctrl + X.



Frequently Asked Questions: Pacman & Yay Slow Downloads

Why are my downloads slow on Arch Linux?

Slow downloads on Arch Linux are typically caused by two main factors: slow DNS resolution from your ISP or outdated mirrors that are geographically far from your location. DNS issues lead to "could not resolve host" errors, while outdated mirrors result in poor download speeds. This guide shows you how to configure fast public DNS (Cloudflare, Google) and use reflector to update your mirrorlist with the fastest servers.

What is DNS and why does it affect download speed?

DNS (Domain Name System) translates domain names like mirror.rackspace.com into IP addresses. If your ISP's DNS is slow or unreliable, your system may take a long time to find the mirror server, causing timeouts or "could not resolve host" errors. Using fast public DNS like 1.1.1.1 (Cloudflare) or 8.8.8.8 (Google) speeds up this resolution process.

How do I temporarily add custom DNS nameservers?

You can edit /etc/resolv.conf directly:

sudo nano /etc/resolv.conf

Remove existing entries and add:

nameserver 1.1.1.1
nameserver 8.8.8.8

Save and exit. Note that this change is temporary and may be overwritten after reboot or network restart.

How do I make DNS changes permanent for a specific connection?

If you use NetworkManager, use nmcli to set permanent DNS for a specific connection. First list connections:

nmcli connection show

Then modify your active connection (e.g., "Wired connection 1"):

sudo nmcli con mod "Wired connection 1" ipv4.ignore-auto-dns yes
sudo nmcli con mod "Wired connection 1" ipv4.dns "1.1.1.1 8.8.8.8"
sudo nmcli con up "Wired connection 1"

These settings survive reboots.

How do I set permanent DNS globally for all connections?

Create a global NetworkManager configuration file:

sudo nano /etc/NetworkManager/conf.d/global-dns.conf

Add:

[main]
dns=default

[connection]
ipv4.ignore-auto-dns=yes

[global-dns-domain-*]
servers=1.1.1.1,8.8.8.8

Then restart NetworkManager: sudo systemctl restart NetworkManager. Verify with cat /etc/resolv.conf.

How do I revert permanent DNS changes?

For a specific connection:

sudo nmcli con mod "Wired connection 1" ipv4.dns ""
sudo nmcli con mod "Wired connection 1" ipv4.ignore-auto-dns no
sudo nmcli con up "Wired connection 1"

For global settings, remove the config file:

sudo rm /etc/NetworkManager/conf.d/global-dns.conf

Then restart NetworkManager.

What is a mirrorlist and why should I update it?

The mirrorlist is a file (/etc/pacman.d/mirrorlist) that tells pacman which servers to download packages from. Over time, mirrors can become slow or outdated. Updating it with the fastest and most recent servers ensures you get maximum download speed and up-to-date packages.

How do I install and use reflector to update mirrors?

First install reflector:

sudo pacman -S reflector

Then run a command like this (adjust countries to your location):

sudo reflector --verbose --country 'Singapore,India,Germany' --latest 20 --protocol https --sort rate --connection-timeout 15 --save /etc/pacman.d/mirrorlist

Finally, refresh pacman database: sudo pacman -Syyu.

What do the reflector flags mean?
  • --country: Restricts mirrors to specific countries (choose those closest to you).
  • --latest 20: Only include the 20 most recently synchronized mirrors.
  • --protocol https: Use only HTTPS mirrors for security.
  • --sort rate: Sort mirrors by actual download speed (fastest first).
  • --connection-timeout 15: Skip mirrors that don't respond within 15 seconds.
  • --save: Write the new list to the mirrorlist file.
How often should I update my mirrorlist?

It's good practice to run reflector every few weeks or whenever you notice download speeds dropping. You can also set up a systemd timer to automate it. The command is safe to run regularly.

What is parallel downloads in pacman and how do I enable it?

Parallel downloads allow pacman to fetch multiple packages simultaneously, greatly speeding up updates. Enable it by editing /etc/pacman.conf:

sudo nano /etc/pacman.conf

Find the line #ParallelDownloads = 5, remove the #, and set a number (e.g., 10). Save and exit. The change applies immediately.

What is the difference between -Syu and -Syyu?

-Syu refreshes the package database only if it's outdated. -Syyu forces a full refresh even if the database is considered up-to-date. Use -Syyu after changing mirrors to ensure pacman uses the new list immediately.

Why do I get "could not resolve host" errors even after changing DNS?

If the error persists, your DNS changes may not have applied correctly. Check /etc/resolv.conf to confirm your custom nameservers are present. If using NetworkManager, ensure you restarted the connection. Also, temporarily disable any firewall or VPN that might be interfering.

How can I test if my new DNS is working?

Use the dig or nslookup command:

dig google.com

Check the "SERVER" line in the output; it should show your custom DNS IP (e.g., 1.1.1.1). Alternatively, use systemd-resolve --status if using systemd-resolved.



What’s Next?

With your DNS configured and mirrorlist optimized, your Arch Linux system is now primed for high-speed performance. No more "could not resolve host" errors or frustratingly slow updates. Now that your package manager is firing on all cylinders, it's time to build your perfect setup.

Level Up Your Arch Journey

🎨 HyDE Hyprland: Craft a theme‑centric tiling environment, HyDE project.

🚀 End 4 Hyprland: Experience the future of Linux desktop with AI integration, End 4 dotfiles.

✂️ DaVinci Resolve: Transform raw footage into polished productions, DaVinci Resolve on Arch.

🎥 OBS Studio: Record high‑quality tutorials and gameplay, OBS setup guide.

🔧 GRUB Troubleshooting: Rescue your bootloader if Windows disappears, restore Windows in GRUB.

💻 QEMU/KVM Virtualization: Run operating systems with near‑native performance, QEMU/KVM setup.

🎮 Steam Gaming: Run Windows titles with Proton for optimal performance, Steam and Proton for Windows Games on Linux.

🍾 Bottles: Play Epic, GOG, and standalone EXEs seamlessly, Bottles setup for Windows Games on Linux.

This concludes the guide on fixing slow Pacman and Yay downloads. If you’re still experiencing speed bottlenecks or need help with Reflector configurations, feel free to drop a comment below. I’m always here to help you optimize your Arch system!

101 out, I’ll see you in the next one!

Load comments