Error during apt update on Ubuntu 18.04 "File has unexpected size"

Hello,
I am receiving this error from our CI (it was working fine this morning) :

Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/Packages.gz File has unexpected size (815853 != 814314). Mirror sync in progress? [IP: XXX.XXX.XX.XXX XXX]
Hashes of expected file:
- Filesize:814314 [weak]
 - SHA256:Some_value
 - SHA1:Some_value [weak]
- MD5Sum:Some_value [weak]
 Release file created at: Mon, 11 Jul 2022 19:02:21 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.

Steps to reproduce

  1. Create a file named : Dockerfile
FROM nvidia/cuda:10.2-base-ubuntu18.04

RUN apt-key del 7fa2af80 \
    && apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub \
    && apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub \
    && apt update
  1. Try to build it.
docker build -t nvidia-issue .
  1. Notice the error
2 Likes

I tried taking some bits from 18.04 CUDA docker image is broken - #6 by francis.toupin and now the following dockerfile works for me :

FROM nvidia/cuda:10.2-base-ubuntu18.04

RUN rm /etc/apt/sources.list.d/cuda.list \
    && apt-key del 7fa2af80 \
    && apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub \
    && apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub \
    && apt update

The fix for me was to add rm /etc/apt/sources.list.d/cuda.list before any apt command.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.