Increase performance of Pacman in Arch Linux

This post is meant for those who are having low download speed when using pacman in Arch Linux. The tutorial applies to both Desktop and ARM Embedded Board users.

arch

After updating the Arch Linux or on a fresh install, the Arch Linux may be shown errors on further updation using pacman which is the default simple but powerful package manager in Arch based distros.

Error may look like this

error: failed retrieving file 'extra.db' from ftp.archlinux.org

Make sure you have the correct mirrorlist, in sort of ranking in /etc/pacman.d/mirrorlist. Try uncommenting more mirrors if it doesnt help (be wise to choose the faster ones for you). Avoid ftp mirrors if possible.

If the problem still exist please try disabling ipv6. Check the network connection using ping http://www.google.com. You may need to run dhcpcd if using dynamic ip.

If you are able to get ping but still cant update using pacman it may be because of the slow network access to the update site and the connection timeout within 10 seconds because of slowness.

There is a workaround for the problem.

Edit /etc/pacman.conf file using the command sudo nano /etc/pacman.conf

Find the line starting XferCommand=/usr/bin/wget… under [options] tab
or add the line

XferCommand=/usr/bin/wget --passive-ftp -c -O %o %u

Note: wget should be preinstalled before editing the file and using pacman.

Aria2 is a multiple connection handling utility which can accelerate your downloads. Making use of this utility for pacman, edit the /etc/pacman.conf file with the following line included under [options]

XferCommand = /usr/bin/aria2c --allow-overwrite=true -c --file-allocation=none --log-level=error -m2 -x2 --max-file-not-found=5 -k5M --no-conf -Rtrue --summary-interval=60 -t60 -d / -o %o %u

User can edit the -t60 attribute which provides 60 seconds timeout on connection request to a server according to your requirement.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s