Ubuntu 18.04 don't create a snap package (Failed to update the package cache)

Err http://archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons
  Hash Sum mismatch                                                            
Fetched 42.2 MB in 6s (6574 kB/s)                                              
Failed to update the package cache: Some files could not be downloaded:

E:Failed to fetch copy:/home/andrei/.cache/snapcraft/stage-packages/apt/22a57eaf9c51f344182f55b1a3e19fc331a464fdf25de5d9f405bd5982c9b45687c89983faafb9e6b46fa3d84441fbc6/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_icons-48x48.tar.gz  Hash Sum mismatch
E:Some index files failed to download. They have been ignored
or old ones used instead.

Check that the sources on your host are configured correctly.

I found a solution, but it did not help me

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update
1 Like

this is an issue for me as well in a fresh ubuntu 18.04 install

1 Like

Does anyone know how to solve this problem?

I have the same problem. The solution Endril found, does not help me either.

I have the same problem too using 18.04.

if I find a solution to this problem, I will write here

Glad someone posted this here. I am having the same problem on my installation of Ubuntu 18.04 as well.

Specifically I am getting this error:

E:Failed to fetch copy:/home/{name}/.cache/snapcraft/stage-packages/apt/ebbb4b1389f7016ca9b0be1bf758a6dabc4816304b01c4a504834f8b8be018b1c6748d93faa768ea0be99565dd4b0574/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-48x48.tar.gz  Hash Sum mismatch
E:Some index files failed to download. They have been ignored
or old ones used instead.

this problem can be solved as follows:
you need to build your application in an lxd container with the image of ubuntu 18 04.

   sudo snap install lxd
   sudo lxd init
   sudo lxc launch ubuntu:18.04 myBuildUbuntu
   sudo lxc shell myBuildUbuntu

snapcraft LXD doc

is this bug going to be fixed ?
it is not always convenient to collect the project through the Docker.

This error message is likely due to the ISP’s faulty transparent proxy and not a snapcraft bug. I may be wrong though but I encountered a similar APT networking error and found that when using another ISP (like mobile network sharing) the error can’t be reproduced.

I do not think that the problem is in the proxy or provider. Because in that case this error would be repeated on all ubuntu versions and not just 18 04.

How are you running snapcraft (i.e. what was the command-line you typed)?
What distribution and version are you using?
Are you running in a virtual machine or other container-like situation?
If you are using Ubuntu as your host, does sudo apt update work on your host when your sources.list is set to use archive.ubuntu.com?
If your host also fails, does changing to other archive mirrors also fail in the same way?
Does the problem also occur on a different network or ISP?

Also helpful might be your ISP name, and country, for correlation with others that have reported the problem.

Note that I do not encounter the problem on my end.

the error is reproduced on two machines with ubuntu 18.04

  • distribution:
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic

  • I run snapcraft in the project directory
snapcraft 
  • source.list
# deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu bionic main restricted
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu bionic universe
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu bionic-updates universe
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu bionic multiverse
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
# deb-src http://by.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://archive.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://archive.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://archive.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
  • my century: Belarus
    provider ByFly

  • if you use ubuntu 18.04 from the LXD container, then everything is good, but if from the native OS this error occurs

I just checked on another provider (life) the same thing.
here is the error log

andrei@andrei-desktop:/media/D/QtDeployTemplate/installer/packages/app$ snapcraft 

Preparing to pull desktop-glib-only 
Get:1 http://repo.steampowered.com/steam precise InRelease [2842 B]            
Get:2 http://archive.canonical.com/ubuntu bionic InRelease [10.2 kB]           
Get:3 http://repo.steampowered.com/steam precise/steam Sources [549 B]         
Get:4 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]               
Get:5 http://repo.steampowered.com/steam precise/steam amd64 Packages [604 B]  
Get:6 http://repo.steampowered.com/steam precise/steam i386 Packages [803 B]   
Get:7 http://archive.canonical.com/ubuntu bionic/partner amd64 Packages [2344 B]
Get:8 http://archive.canonical.com/ubuntu bionic/partner i386 Packages [2340 B]
Get:9 http://archive.canonical.com/ubuntu bionic/partner Translation-en [1272 B]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]     
Get:11 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]   
Get:12 http://archive.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]    
Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1019 kB]   
Get:14 http://archive.ubuntu.com/ubuntu bionic/main i386 Packages [1007 kB]    
Get:15 http://archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]    
Get:16 http://archive.ubuntu.com/ubuntu bionic/main Translation-ru [350 kB]    
Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata [477 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic/main DEP-11 64x64 Icons [245 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [9184 B]
Get:21 http://archive.ubuntu.com/ubuntu bionic/restricted i386 Packages [9156 B]
Get:22 http://archive.ubuntu.com/ubuntu bionic/restricted Translation-en [3584 B]
Get:23 http://archive.ubuntu.com/ubuntu bionic/restricted Translation-ru [2524 B]
Get:24 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
Get:25 http://archive.ubuntu.com/ubuntu bionic/universe i386 Packages [8531 kB]
Get:26 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
Get:27 http://archive.ubuntu.com/ubuntu bionic/universe Translation-ru [1231 kB]
Get:28 http://archive.ubuntu.com/ubuntu bionic/universe amd64 DEP-11 Metadata [3287 kB]
Get:29 http://archive.ubuntu.com/ubuntu bionic/universe DEP-11 48x48 Icons [2151 kB]
Get:30 http://archive.ubuntu.com/ubuntu bionic/universe DEP-11 64x64 Icons [8420 kB]
Get:31 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:32 http://archive.ubuntu.com/ubuntu bionic/multiverse i386 Packages [144 kB]
Get:33 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:34 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-ru [79.7 kB]
Get:35 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 DEP-11 Metadata [49.7 kB]
Get:36 http://archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 48x48 Icons [8931 B]
Get:37 http://archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 64x64 Icons [225 kB]
Get:38 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [303 kB]
Get:39 http://archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [272 kB]
Get:40 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [114 kB]
Get:41 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [138 kB]
Get:42 http://archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [31.4 kB]
Get:43 http://archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [53.7 kB]
Get:44 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [173 kB]
Get:45 http://archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [173 kB]
Get:46 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [80.0 kB]
Get:47 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [153 kB]
Get:48 http://archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [155 kB]
Get:49 http://archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [258 kB]
Get:50 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [3772 B]
Get:51 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse i386 Packages [3928 B]
Get:52 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [2376 B]
Get:53 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2468 B]
Get:54 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse DEP-11 48x48 Icons [29 B]
Get:55 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse DEP-11 64x64 Icons [2638 B]
Get:56 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [2704 B]
Get:57 http://archive.ubuntu.com/ubuntu bionic-backports/universe i386 Packages [2704 B]
Get:58 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1136 B]
Get:59 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [5100 B]
Get:60 http://archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 48x48 Icons [29 B]
Get:61 http://archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 64x64 Icons [1789 B]
Get:62 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [158 kB]
Get:63 http://archive.ubuntu.com/ubuntu bionic-security/main i386 Packages [128 kB]
Get:64 http://archive.ubuntu.com/ubuntu bionic-security/main Translation-en [60.8 kB]
Get:65 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [204 B]
Get:66 http://archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [29 B]
Get:67 http://archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [29 B]
Get:68 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [57.0 kB]
Err http://archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons   
  Hash Sum mismatch                                                            
Get:69 http://archive.ubuntu.com/ubuntu bionic-security/universe i386 Packages [56.9 kB]
Get:70 http://archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [33.6 kB]
Get:71 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [6820 B]
Get:72 http://archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [9090 B]
Get:73 http://archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [11.3 kB]
Get:74 http://archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [1444 B]
Get:75 http://archive.ubuntu.com/ubuntu bionic-security/multiverse i386 Packages [1608 B]
Get:76 http://archive.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [996 B]
Fetched 30.0 MB in 6s (1430 kB/s)                                              
Get:1 http://archive.canonical.com/ubuntu bionic InRelease [10.2 kB]           
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]               
Get:3 http://repo.steampowered.com/steam precise InRelease [2842 B]            
Get:4 http://archive.canonical.com/ubuntu bionic/partner amd64 Packages [2344 B]
Get:5 http://repo.steampowered.com/steam precise/steam Sources [549 B]         
Get:6 http://archive.canonical.com/ubuntu bionic/partner i386 Packages [2340 B]
Get:7 http://archive.canonical.com/ubuntu bionic/partner Translation-en [1272 B]
Get:8 http://repo.steampowered.com/steam precise/steam amd64 Packages [604 B]  
Get:9 http://repo.steampowered.com/steam precise/steam i386 Packages [803 B]   
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]     
Get:11 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]   
Get:12 http://archive.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]    
Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1019 kB]   
Get:14 http://archive.ubuntu.com/ubuntu bionic/main i386 Packages [1007 kB]    
Get:15 http://archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]    
Get:16 http://archive.ubuntu.com/ubuntu bionic/main Translation-ru [350 kB]    
Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata [477 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic/main DEP-11 64x64 Icons [245 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [9184 B]
Get:21 http://archive.ubuntu.com/ubuntu bionic/restricted i386 Packages [9156 B]
Get:22 http://archive.ubuntu.com/ubuntu bionic/restricted Translation-en [3584 B]
Get:23 http://archive.ubuntu.com/ubuntu bionic/restricted Translation-ru [2524 B]
Get:24 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
Get:25 http://archive.ubuntu.com/ubuntu bionic/universe i386 Packages [8531 kB]
Get:26 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
Get:27 http://archive.ubuntu.com/ubuntu bionic/universe Translation-ru [1231 kB]
Get:28 http://archive.ubuntu.com/ubuntu bionic/universe amd64 DEP-11 Metadata [3287 kB]
Get:29 http://archive.ubuntu.com/ubuntu bionic/universe DEP-11 48x48 Icons [2151 kB]
Get:30 http://archive.ubuntu.com/ubuntu bionic/universe DEP-11 64x64 Icons [8420 kB]
Get:31 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:32 http://archive.ubuntu.com/ubuntu bionic/multiverse i386 Packages [144 kB]
Get:33 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:34 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-ru [79.7 kB]
Get:35 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 DEP-11 Metadata [49.7 kB]
Get:36 http://archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 48x48 Icons [8931 B]
Get:37 http://archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 64x64 Icons [225 kB]
Get:38 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [303 kB]
Get:39 http://archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [272 kB]
Get:40 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [114 kB]
Get:41 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [138 kB]
Get:42 http://archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [31.4 kB]
Get:43 http://archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [53.7 kB]
Get:44 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [173 kB]
Get:45 http://archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [173 kB]
Get:46 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [80.0 kB]
Get:47 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [153 kB]
Get:48 http://archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [155 kB]
Get:49 http://archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [258 kB]
Get:50 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [3772 B]
Get:51 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse i386 Packages [3928 B]
Get:52 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [2376 B]
Get:53 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2468 B]
Get:54 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse DEP-11 48x48 Icons [29 B]
Get:55 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse DEP-11 64x64 Icons [2638 B]
Get:56 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [2704 B]
Get:57 http://archive.ubuntu.com/ubuntu bionic-backports/universe i386 Packages [2704 B]
Get:58 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1136 B]
Get:59 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [5100 B]
Get:60 http://archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 48x48 Icons [29 B]
Get:61 http://archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 64x64 Icons [1789 B]
Get:62 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [158 kB]
Get:63 http://archive.ubuntu.com/ubuntu bionic-security/main i386 Packages [128 kB]
Get:64 http://archive.ubuntu.com/ubuntu bionic-security/main Translation-en [60.8 kB]
Get:65 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [204 B]
Get:66 http://archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [29 B]
Get:67 http://archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [29 B]
Err http://archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons   
  Hash Sum mismatch                                                            
Get:68 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [57.0 kB]
Get:69 http://archive.ubuntu.com/ubuntu bionic-security/universe i386 Packages [56.9 kB]
Get:70 http://archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [33.6 kB]
Get:71 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [6820 B]
Get:72 http://archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [9090 B]
Get:73 http://archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [11.3 kB]
Get:74 http://archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [1444 B]
Get:75 http://archive.ubuntu.com/ubuntu bionic-security/multiverse i386 Packages [1608 B]
Get:76 http://archive.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [996 B]
Fetched 44.6 MB in 6s (56.7 kB/s)                                              
Failed to update the package cache: Some files could not be downloaded:

E:Failed to fetch copy:/home/andrei/.cache/snapcraft/stage-packages/apt/0d21a9198eb907a0ff357ddb0238b9ee9159e67cbfbb293ca0f567efec37014ac603a3e4dc696f4cd0d8f1bbed8334f4/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-48x48.tar.gz  Hash Sum mismatch
E:Some index files failed to download. They have been ignored
or old ones used instead.

Check that the sources on your host are configured correctly.

I believe this is your issue. Have you altered this configuration from the defaults? The security repository is hosted at http://security.ubuntu.com/ubuntu, but you have yours configured to use http://archive.ubuntu.com/ubuntu.

No, I did not change anything, I installed an image from the official site, and did it several times.
I installed ubuntu 18.04 different hosts, the problem is the same,

I reproduced the problem just now.

First I built something with snapcraft on bionic, and verified it built fine, no warning.

Then I changed /etc/apt/sources.list to add

deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

at the end. Voila, snapcraft now fails with

E:Failed to fetch copy:/home/dank/.cache/snapcraft/stage-packages/apt/ce447e8cd9a9016c1222302927d231c373080838d1dba0fb34fb11e2a4e3a9eeb22060b3057a6e5a6e80e8635399f954/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-48x48.tar.gz  Hash Sum mismatch

Above that error were several lines with a warning:

W:Target Contents-deb-legacy (Contents-all) is configured multiple times in /home/dank/.cache/snapcraft/stage-packages/apt/ce447e8cd9a9016c1222302927d231c373080838d1dba0fb34fb11e2a4e3a9eeb22060b3057a6e5a6e80e8635399f954/etc/apt/sources.list:15 and /home/dank/.cache/snapcraft/stage-packages/apt/ce447e8cd9a9016c1222302927d231c373080838d1dba0fb34fb11e2a4e3a9eeb22060b3057a6e5a6e80e8635399f954/etc/apt/sources.list:33

Fine, evidently my sources.list is confused, so next I tried replacing the entire /etc/apt/sources.list with minimal correct contents,

deb http://archive.ubuntu.com/ubuntu  bionic           main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu  bionic-updates   main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu  bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security  main restricted universe multiverse

This still failed with

Err http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons                                                                                             
  Hash Sum mismatch  
...
E:Failed to fetch copy:/home/dank/.cache/snapcraft/stage-packages/apt/9e9bf0558a790d131a6ed6709b20f534d57088f34d355b770f4ec88fbf6c12982a8fb3e28d10682aae632dff4beb4360/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-48x48.tar.gz  Hash Sum mismatch

this time without the ‘multiple configuration’ warning.

OK, so, uh, maybe http://security.ubuntu.com/ubuntu bionic-security/main is broken. And sure enough, removing the word ‘main’ from the line

deb http://security.ubuntu.com/ubuntu bionic-security  main restricted universe multiverse

worked.

I don’t think I’m behind any kind of proxy (I’m in downtown Los Angeles on a 100Mbps link).

The characteristic of a transparent proxy is that you can’t identify it in regular circumstances (unless it fails to do the right job)

I would suggest contacting the ISP, and try another ISP to see if the problem can still be reproduced.

It would be great if snapcraft can specify an HTTPS archive, which doesn’t affected by transparent proxy by nature.

Pretty sure my company doesn’t use an http proxy. Besides, if the problem were a proxy, wouldn’t I have the same problem using apt at the desktop? I don’t; apt update works fine at the desktop.

https://askubuntu.com/questions/41605/trouble-downloading-packages-list-due-to-a-hash-sum-mismatch-error and https://github.com/moby/moby/issues/30207 have some interesting tips. I tried using

deb mirror://mirrors.ubuntu.com/mirrors.txt bionic           main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates   main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-security  main restricted universe multiverse

but although it worked fine on the desktop (except for picking slow mirrors),
it failed horribly in snapcraft, with warnings like:

W:The repository 'mirror://mirrors.ubuntu.com/mirrors.txt bionic Release' does not have a Release file.
W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use.

Anyway, given that the problem does not happen on the desktop, only inside snapcraft, I’m pretty sure it’s not a transparent proxy problem. Something smells funny here.

I was helped by the complete removal of the repositories ubuntu, and then the connection. Perhaps there was an error in source.list

everything is ready, there is no more error.

1 Like