Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker apt update: Some index files failed to download. They have been ignored, or old ones used instead

Tags:

docker

macos

Environment:

Host OS: Mac OS Catalina Docker Version: Docker version 19.03.8, build afacb8b

Problem:

From inside docker, I have ensured I can ping 8.8.8.8 and also resolve hostnames. But I dont understand why I am seeing ***

unexpected size error

when I run apt update.

From bash terminal, I run the following commands:

docker run -it ubuntu:18.04 bash

root@83c668ee64d0:/# apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://security.debian.org/debian-security buster/updates/main amd64 Packages [201 kB]
Get:3 http://deb.debian.org/debian buster InRelease [121 kB]
Get:4 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7905 kB]
Err:5 http://deb.debian.org/debian buster/main amd64 Packages
  File has unexpected size (13168 != 7905140). Mirror sync in progress? [IP: 151.101.96.204 80]
  Hashes of expected file:
   - Filesize:7905140 [weak]
   - SHA256:1b42c3159a573be2bea3b55e2f55f2236f6c0ca23beac23205d2688b892b3052
   - MD5Sum:9f4af9cc7e89f9ec9607738718505126 [weak]
  Release file created at: Sat, 09 May 2020 09:51:02 +0000
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7380 B]
Err:6 http://deb.debian.org/debian buster-updates/main amd64 Packages
  File has unexpected size (13184 != 7380). Mirror sync in progress? [IP: 151.101.96.204 80]
  Hashes of expected file:
   - Filesize:7380 [weak]
   - SHA256:6af9ea081b6a3da33cfaf76a81978517f65d38e45230089a5612e56f2b6b789d
  Release file created at: Wed, 03 Jun 2020 20:19:15 +0000
Fetched 438 kB in 3s (156 kB/s)
Reading package lists... Done
E: Failed to fetch http://deb.debian.org/debian/dists/buster/main/binary-amd64/by-hash/SHA256/1b42c3159a573be2bea3b55e2f55f2236f6c0ca23beac23205d2688b892b3052  File has unexpected size (13168 != 7905140). Mirror sync in progress? [IP: 151.101.96.204 80]
   Hashes of expected file:
    - Filesize:7905140 [weak]
    - SHA256:1b42c3159a573be2bea3b55e2f55f2236f6c0ca23beac23205d2688b892b3052
    - MD5Sum:9f4af9cc7e89f9ec9607738718505126 [weak]
   Release file created at: Sat, 09 May 2020 09:51:02 +0000
E: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/main/binary-amd64/by-hash/SHA256/6af9ea081b6a3da33cfaf76a81978517f65d38e45230089a5612e56f2b6b789d  File has unexpected size (13184 != 7380). Mirror sync in progress? [IP: 151.101.96.204 80]
   Hashes of expected file:
    - Filesize:7380 [weak]
    - SHA256:6af9ea081b6a3da33cfaf76a81978517f65d38e45230089a5612e56f2b6b789d
   Release file created at: Wed, 03 Jun 2020 20:19:15 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.

From inside docker, I have ensured I can ping 8.8.8.8 and also resolve hostnames. But I dont understand why I am seeing unexpected size error
like image 717
Romaan Avatar asked Nov 21 '25 05:11

Romaan


1 Answers

I did the following:

curl http://deb.debian.org/debian/dists/buster/main/binary-amd64/by-hash/SHA256/1b42c3159a573be2bea3b55e2f55f2236f6c0ca23beac23205d2688b892b3052

and found

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <!--    Applications (such as Dictionary.app) can recognise that a
                webpage has been restricted by looking for the following comment:   -->

        <!-- com.apple.parentalcontrols.webcontentfilter.accessrestricted -->

        <title>Access Restricted</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <script type="text/javascript">

<!--

This made sense, my iPad had content restriction and it had synchronised with my iMac and blocked the traffic. To fix go to System preferences -> Screen time -> Content and Privacy -> Turn off content and privacy restriction

like image 72
Romaan Avatar answered Nov 23 '25 19:11

Romaan