Error: failed retrieving file when updating the system

Hello everyone,
I get these errors sometimes when i update my system using sudo pacman -Syu

The thing is :

  • my internet speed is fine and the download is complete according to me but then at the end of download these errors occurs.
  • I do have DisableDownloadTimeout option enabled in my pacman.conf

But the package that these errors are showing still gets updated

Errors

Last time i got the errors were during this update:

Package (3)         Old Version     New Version     Net Change  Download Size

core/hwdata         0.372-1         0.373-1           0.04 MiB       1.56 MiB
core/linux          6.4.11.arch1-1  6.4.11.arch2-1   -0.08 MiB     125.52 MiB
core/linux-headers  6.4.11.arch1-1  6.4.11.arch2-1    0.00 MiB      29.43 MiB

Total Download Size:   156.51 MiB
Total Installed Size:  293.99 MiB
Net Upgrade Size:       -0.05 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 hwdata-0.373-1-any                                                                    1595.7 KiB  2.42 MiB/s 00:01 [---------------------------------------------------------------------] 100%
 linux-headers-6.4.11.arch2-1-x86_64                                                     29.4 MiB   783 KiB/s 00:38 [---------------------------------------------------------------------] 100%
 linux-6.4.11.arch2-1-x86_64                                                            125.5 MiB  2.15 MiB/s 00:58 [---------------------------------------------------------------------] 100%
 Total (3/3)                                                                            156.5 MiB  2.41 MiB/s 01:05 [---------------------------------------------------------------------] 100%
error: failed retrieving file 'linux-6.4.11.arch2-1-x86_64.pkg.tar.zst' from archlinux.mirror.net.in : The requested URL returned error: 400
error: failed retrieving file 'linux-headers-6.4.11.arch2-1-x86_64.pkg.tar.zst' from archlinux.mirror.net.in : The requested URL returned error: 400
error: failed retrieving file 'linux-headers-6.4.11.arch2-1-x86_64.pkg.tar.zst' from mirrors.piconets.webwerks.in : The requested URL returned error: 404
error: failed retrieving file 'linux-6.4.11.arch2-1-x86_64.pkg.tar.zst' from mirrors.piconets.webwerks.in : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.4.11.arch2-1-x86_64.pkg.tar.zst' from mirror.sahil.world : SSL connection timeout
(3/3) checking keys in keyring                                                                                      [---------------------------------------------------------------------] 100%
(3/3) checking package integrity                                                                                    [---------------------------------------------------------------------] 100%
(3/3) loading package files                                                                                         [---------------------------------------------------------------------] 100%
(3/3) checking for file conflicts                                                                                   [---------------------------------------------------------------------] 100%
:: Running pre-transaction hooks...
(1/2) Remove DKMS modules
==> dkms remove --no-depmod nvidia/535.98 -k 6.4.11-arch1-1
==> depmod 6.4.11-arch1-1

24-Aug-2023 (During latest update)

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 iwd-2.8-1-x86_64                                                                       566.0 KiB  62.4 KiB/s 00:09 [---------------------------------------------------------------------] 100%
 gpgme-1.22.0-1-x86_64                                                                  481.7 KiB   214 KiB/s 00:02 [---------------------------------------------------------------------] 100%
 mpfr-4.2.1-1-x86_64                                                                    427.9 KiB   242 KiB/s 00:02 [---------------------------------------------------------------------] 100%
 ell-0.58-1-x86_64                                                                      236.5 KiB   237 KiB/s 00:01 [---------------------------------------------------------------------] 100%
 zlib-1:1.3-1-x86_64                                                                     92.5 KiB   117 KiB/s 00:01 [---------------------------------------------------------------------] 100%
 eos-bash-shared-23-22.10-any                                                            50.4 KiB  15.8 KiB/s 00:03 [---------------------------------------------------------------------] 100%
 welcome-3.69-5-any                                                                      31.2 KiB  94.5 KiB/s 00:00 [---------------------------------------------------------------------] 100%
 minizip-1:1.3-1-x86_64                                                                  27.5 KiB  63.9 KiB/s 00:00 [---------------------------------------------------------------------] 100%
 eos-packagelist-2.2-1-any                                                               13.0 KiB  22.7 KiB/s 00:01 [---------------------------------------------------------------------] 100%
 pacman-mirrorlist-20230820-1-any                                                         8.1 KiB  16.3 KiB/s 00:01 [---------------------------------------------------------------------] 100%
 nvidia-dkms-535.104.05-1-x86_64                                                         42.9 MiB   777 KiB/s 00:57 [---------------------------------------------------------------------] 100%
 linux-lts-headers-6.1.47-1-x86_64                                                        8.5 MiB   724 KiB/s 00:12 [---------------------------------------------------------------------] 100%
 linux-lts-6.1.47-1-x86_64                                                              116.2 MiB  1209 KiB/s 01:38 [---------------------------------------------------------------------] 100%
 nvidia-utils-535.104.05-1-x86_64                                                       261.0 MiB  1932 KiB/s 02:18 [---------------------------------------------------------------------] 100%
 Total (14/14)                                                                          448.8 MiB  3.24 MiB/s 02:19 [---------------------------------------------------------------------] 100%
error: failed retrieving file 'linux-lts-headers-6.1.47-1-x86_64.pkg.tar.zst' from archlinux.mirror.net.in : transfer closed with 8953089 bytes remaining to read
error: failed retrieving file 'linux-lts-headers-6.1.47-1-x86_64.pkg.tar.zst' from mirrors.piconets.webwerks.in : HTTP server doesn't seem to support byte ranges. Cannot resume.

Can someone tell me why are these errors occurring and what can i do to solve them ?

Have you reranked your mirrors?

I did that after the first time i got this error.
Note: It happens sometimes. This error didn’t appear in the last 3-4 updates excluding the latest one

try pacman -Syyuu maybe?

❯ sudo pacman -Syyu
:: Synchronizing package databases...
 endeavouros                                                                             24.7 KiB  35.0 KiB/s 00:01 [---------------------------------------------------------------------] 100%
 core                                                                                   129.5 KiB   185 KiB/s 00:01 [---------------------------------------------------------------------] 100%
 extra                                                                                    8.3 MiB  2.58 MiB/s 00:03 [---------------------------------------------------------------------] 100%
 multilib                                                                               143.2 KiB   198 KiB/s 00:01 [---------------------------------------------------------------------] 100%
:: Starting full system upgrade...
 there is nothing to do

The package is already updated and that’s why i’m asking if package is downloaded and updated correctly then why this error ?

That’s the way pacman works with mirrors. You have a list of mirrors, and the first is used first. If that fails, pacman uses the second, and so on.

Re-ranking Arch mirrors may really help, especially if ranking provides truly the best mirrorlist for your location. But sometimes ranking may produce suboptimal list, so if it doesn’t work well, you probably need to rank again. And sometimes a mirror is permanently disabled, then reranking may be needed.

Note that if you somehow know a great mirror, you can manually add that mirror as the first in file /etc/pacman.d/mirrorlist.

3 Likes

Sorry, guess I misunderstood. I thought you meant you weren’t able to update because of that error.

I just ranked the mirrors for India and this happened :joy:

:: Starting full system upgrade...
warning: ell: local (0.58-1) is newer than extra (0.57-1)
warning: iwd: local (2.8-1) is newer than extra (2.7-1)
warning: linux-lts: local (6.1.47-1) is newer than core (6.1.46-1)
warning: linux-lts-headers: local (6.1.47-1) is newer than core (6.1.46-1)
 there is nothing to do

I always thought ranking gave the best results. But seems like it’s not the case as you’ve already pointed out

I never understood why people rank mirrors by country. Just because some mirror is in your country, doesn’t mean it’s faster or more reliable than some other.

Just use

rate-mirrors arch | sudo tee /etc/pacman.d/mirrorlist      
3 Likes

That’s because the mirrors in India are outdated compared to the mirrors you were using before you ranked them (the ones you ran the previous system update with).

Just use the latest mirrors and sort them by speed. This will save you some grief.

sudo reflector --latest 20 --sort rate --save /etc/pacman.d/mirrorlist

The takeaway:
Not all mirrors are in sync with each other.

1 Like

image
I was simply following the reflector guide.

I think i should be using what @anthony93 said

It is very much possible that rate-mirrors gives better results than reflector in your country.

Note that in reflector-simple you can use the reflector options like --age, or sort by age instead of rate.

1 Like

Starting this thread once again because even after updating the mirrors. From the last 2-3 days, i’m getting these errors during the first update

Total Download Size:    66.13 MiB
Total Installed Size:  224.09 MiB
Net Upgrade Size:        0.67 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 groff-1.23.0-4-x86_64          2.3 MiB  78.6 KiB/s 00:30 [------------------------------] 100%
 hwdata-0.374-1-any          1597.0 KiB  36.5 KiB/s 00:44 [------------------------------] 100%
 alsa-utils-1.2.10-1-x86_64  1203.7 KiB   108 KiB/s 00:11 [------------------------------] 100%
 openssh-9.4p1-3-x86_64      1140.1 KiB   156 KiB/s 00:07 [------------------------------] 100%
 pipewire-audio-1:0.3.79...  1135.6 KiB  95.4 KiB/s 00:12 [------------------------------] 100%
 ffmpeg-2:6.0-9-x86_64         11.4 MiB   148 KiB/s 01:19 [------------------------------] 100%
 telegram-desktop-4.9.5-...    31.5 MiB   301 KiB/s 01:47 [------------------------------] 100%
 nodejs-20.6.0-1-x86_64         3.8 MiB   325 KiB/s 00:12 [------------------------------] 100%
 Total ( 8/19)                 66.1 MiB   500 KiB/s 02:15 [------------------------------] 100%
error: failed retrieving file 'openssh-9.4p1-3-x86_64.pkg.tar.zst.sig' from de.arch.mirror.kescher.at : 
error: failed retrieving file 'pipewire-audio-1:0.3.79-2-x86_64.pkg.tar.zst.sig' from de.arch.mirror.kescher.at : 
error: failed retrieving file 'nodejs-20.6.0-1-x86_64.pkg.tar.zst' from de.arch.mirror.kescher.at : HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
warning: too many errors from de.arch.mirror.kescher.at, skipping for the remainder of this transaction
error: failed retrieving file 'telegram-desktop-4.9.5-1-x86_64.pkg.tar.zst.sig' from de.arch.mirror.kescher.at : 
warning: failed to retrieve some files
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

You can see that the internet speed is fine but suddenly this error occurs.
After this if i run sudo pacman -Syu again then everything works fine.

Note: Sometimes, due to networks problem my internet speed goes down for a moment but it returns to normal within seconds