Errors during apt update on Ubuntu2004 - "File has unexpected size"

Hey, today morning when I try to run the apt update, the following error emerged. According to the blog “File has unexpected size”, it might be a CDN issue so I report here.

How to reproduce:

  1. On a machine that was freshly deployed with Ubuntu2004, get cuda-keyring installed:
~$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
~$ sudo dpkg -i cuda-keyring_1.0-1_all.deb
  1. run the apt update command, then the issue emerges:
~$ sudo apt update
Get:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease [1581 B]
Get:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Packages [580 kB]
Err:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Packages
  **File has unexpected size (580845 != 580040). Mirror sync in progress? [IP: 152.199.39.144 443]**
  Hashes of expected file:
   - Filesize:580040 [weak]
   - SHA256:dc8abbaf470d3ee626f4f1f4d2871a98d8dc8f770bc592676f0d1f60637e0c2d
   - SHA1:109bfa4e5c415731aa44b1c1caae3f19754c5406 [weak]
   - MD5Sum:bf8f928cb55b1c9e4c158a69ee52b5d8 [weak]
  Release file created at: Mon, 11 Jul 2022 19:01:54 +0000
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease          
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-security InRelease
Fetched 1581 B in 4s (396 B/s)
Reading package lists... Done
E: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/Packages.gz  **File has unexpected size (580845 != 580040). Mirror sync in progress? [IP: 152.199.39.144 443]**
   Hashes of expected file:
    - Filesize:580040 [weak]
    - SHA256:dc8abbaf470d3ee626f4f1f4d2871a98d8dc8f770bc592676f0d1f60637e0c2d
    - SHA1:109bfa4e5c415731aa44b1c1caae3f19754c5406 [weak]
    - MD5Sum:bf8f928cb55b1c9e4c158a69ee52b5d8 [weak]
   Release file created at: Mon, 11 Jul 2022 19:01:54 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.

Wondering if this is an issue? If yes, is anything I should do to fix it?

1 Like

Hello @michael.starwang , I had the same issue and I found a fix that seems to work, see Error during apt update on Ubuntu 18.04 "File has unexpected size" - #2 by alexandrebrown97
Let me know if it worked for you as well, we have pretty similar setup, only the ubuntu version differs.

Thank you for sharing @alexandrebrown97 but it didn’t solve the issue for me.

I am working on a fresh Ubuntu 20.04 and was getting the same error as @michael.starwang above. Adding the old apt-key succeeded, but I still get the same error during apt-get update.

Seems the Nvidia repository is fine now. Thanks for the replies & feedback @alexandrebrown97 @3ababa

1 Like