Official-images: unable to install ubuntu packages.

Created on 15 Jan 2016  Â·  21Comments  Â·  Source: docker-library/official-images

root@a9607cb2a2a4:~# apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: gcc (>= 4:4.4.3) but it is not going to be installed
g++ : Depends: cpp (>= 4:4.8.2-1ubuntu6) but it is not going to be installed
Depends: gcc (>= 4:4.8.2-1ubuntu6) but it is not going to be installed
Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
Depends: gcc-4.8 (>= 4.8.2-5~) but it is not going to be installed
libcairo2-dev : Depends: libfontconfig1-dev (>= 2.2.95) but it is not going to be installed
Depends: libfreetype6-dev (>= 2.1.10) but it is not going to be installed
Depends: libpng-dev
Depends: libglib2.0-dev but it is not going to be installed
libjpeg8-dev : Depends: libjpeg-turbo8-dev (>= 1.1.90+svn722-1ubuntu6) but it is not going to be installed
libpango1.0-dev : Depends: libglib2.0-dev (>= 2.34.0) but it is not going to be installed
Depends: libfreetype6-dev but it is not going to be installed
Depends: libxft-dev but it is not going to be installed
Depends: libfontconfig1-dev (>= 2.10.91) but it is not going to be installed
Recommends: debhelper but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

All 21 comments

There is no apt cache yet (on purpose, since it would get outdated and takes up extra space); you'll need to apt-get update first.

apt-get wont' work properly

when executing

apt-get update

we will get the following errors:

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/source/Sources  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages  Hash Sum mismatch

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

That sounds like a bad mirror or maybe a misbehaving proxy -- are you
behind any kind of firewall (corporate or otherwise)?

@tianon
should be directly downloaded from docker.io

erics-MacBook-Air:~ sam$ docker pull ubuntu
Using default tag: latest
Pulling repository docker.io/library/ubuntu
af88597ec24b: Pulling dependent layers 
af88597ec24b: Download complete 
895b070402bd: Download complete 
02e5bca4149b: Download complete 
b2ae0a712b39: Download complete 
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu: this image was pulled from a legacy registry.  Important: This registry version will not be supported in future versions of docker.
erics-MacBook-Air:~ sam$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              latest              af88597ec24b        11 days ago         187.9 MB
erics-MacBook-Air:~ sam$ docker run -t -i af8 /bin/bash
root@e86bc7318066:/# apt-get update 
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [64.4 kB]
Hit http://archive.ubuntu.com trusty Release.gpg                
Get:3 http://archive.ubuntu.com trusty-updates/main Sources [309 kB]
Get:4 http://archive.ubuntu.com trusty-updates/restricted Sources [5219 B]     
Get:5 http://archive.ubuntu.com trusty-updates/universe Sources [183 kB]
Get:6 http://archive.ubuntu.com trusty-updates/main amd64 Packages [851 kB]    
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [23.4 kB]
Get:8 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [421 kB]
Get:9 http://archive.ubuntu.com trusty-security/main Sources [129 kB]          
Get:10 http://archive.ubuntu.com trusty-security/restricted Sources [3920 B]   
Get:11 http://archive.ubuntu.com trusty-security/universe Sources [37.4 kB]    
Get:12 http://archive.ubuntu.com trusty-security/main amd64 Packages [495 kB]  
Get:13 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [20.2 kB]
Get:14 http://archive.ubuntu.com trusty-security/universe amd64 Packages [158 kB]
Hit http://archive.ubuntu.com trusty Release                                   
Get:15 http://archive.ubuntu.com trusty/main Sources [1335 kB]                 
Get:16 http://archive.ubuntu.com trusty/restricted Sources [5335 B]            
Get:17 http://archive.ubuntu.com trusty/universe Sources [7926 kB]             
Get:18 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]          
Get:19 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]    
Get:20 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]      
Fetched 21.4 MB in 21s (1018 kB/s)                                             
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/source/Sources  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages  Hash Sum mismatch

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

Debian version

erics-MacBook-Air:~ sam$ docker pull debian
Using default tag: latest
latest: Pulling from library/debian
523ef1d23f22: Pull complete 
140f9bdfeb97: Pull complete 
Digest: sha256:dec98bbc4e5753d94d1f1b65f1c2414bf890570439bb8356fe8776c6bb6bd83f
Status: Downloaded newer image for debian:latest
erics-MacBook-Air:~ sam$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
debian              latest              140f9bdfeb97        8 days ago          125.1 MB
ubuntu              latest              af88597ec24b        11 days ago         187.9 MB
erics-MacBook-Air:~ sam$ docker run -t -i 140 /bin/bash
root@f9f06b8695a3:/# apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]                       
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [232 kB]              
Ign http://httpredir.debian.org jessie-updates InRelease                                                                                        
Ign http://httpredir.debian.org jessie InRelease                                                                                                
Get:3 http://httpredir.debian.org jessie-updates Release.gpg [1554 B]                                                                           
Get:4 http://httpredir.debian.org jessie Release.gpg [2373 B]                                                                                   
Get:5 http://httpredir.debian.org jessie-updates Release [135 kB]
Get:6 http://httpredir.debian.org jessie Release [148 kB]                                                                                       
Get:7 http://httpredir.debian.org jessie/main amd64 Packages [9035 kB]                                                                          
Get:8 http://httpredir.debian.org jessie-updates/main amd64 Packages [3619 B]                                                                   
Fetched 9621 kB in 46s (209 kB/s)                                                                                                               
W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages  Hash Sum mismatch

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

Yeah that looks like a misbehaving/out-of-sync mirror for httpredir.debian.org and archive.ubuntu.com or possibly an overzealous firewall. It works fine from here, so it is not a problem with the images.

$ docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu

Digest: sha256:b53bb7b0d18842214ac7472c2a8801e8682c247d30f1ba4bab0083a2e2e091ea
$ docker run -it ubuntu:latest
root@d54ef266652f:/# apt-get update
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [64.4 kB]
Hit http://archive.ubuntu.com trusty Release.gpg     
Hit http://archive.ubuntu.com trusty Release         
Get:3 http://archive.ubuntu.com trusty-updates/main Sources [311 kB]
Get:4 http://archive.ubuntu.com trusty-updates/restricted Sources [5219 B]
Get:5 http://archive.ubuntu.com trusty-updates/universe Sources [185 kB]
Get:6 http://archive.ubuntu.com trusty-updates/main amd64 Packages [857 kB]
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [23.4 kB]
Get:8 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [434 kB]
Get:9 http://archive.ubuntu.com trusty-security/main Sources [129 kB]
Get:10 http://archive.ubuntu.com trusty-security/restricted Sources [3920 B]
Get:11 http://archive.ubuntu.com trusty-security/universe Sources [37.4 kB]
Get:12 http://archive.ubuntu.com trusty-security/main amd64 Packages [502 kB]
Get:13 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [20.2 kB]
Get:14 http://archive.ubuntu.com trusty-security/universe amd64 Packages [159 kB]
Get:15 http://archive.ubuntu.com trusty/main Sources [1335 kB]
Get:16 http://archive.ubuntu.com trusty/restricted Sources [5335 B]
Get:17 http://archive.ubuntu.com trusty/universe Sources [7926 kB]
Get:18 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]          
Get:19 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]    
Get:20 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]      
Fetched 21.4 MB in 11s (1832 kB/s)                                             
Reading package lists... Done
root@d54ef266652f:/# 

Random suggestion, try rebooting the docker VM (docker-machine restart default).

confused.

@yosifkit how can i fix this problem?

Same issue here. None of the advice on this problem in older threads seems to fix this particular issue.

I'm having a similar issue, and as far as I can tell, it's not a network or firewall issue.

  1. apt update in local docker: fails with the above 404s; on AT&T residential
  2. curl -I http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages (one of the failed fetches) in local docker fails
  3. same curl fails outside of docker
  4. same curl fails from a Joyent instance in their datacenter
  5. us.archive.…, ca.archive.…, de.archive.… all fail both locally and at Joyent
  6. same request fails from https://www.hurl.it too
  7. Trying Packages.bz2 works in Joyent and locally

Is there a way to tell apt update to prefer compressed files? By everything I can tell, (including the directory listing at http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/), uncompressed Packages lists aren't available.

Hmm, it might be dlite/xhyve? I'm able to apt update in ubuntu:latest on a
trusty64 host running docker 1.10.2.

As far as I can tell apt only fetches the gz, xz, or bz2 files for Packages. Given this from the apt man page:

Files like Packages can be available in various
compression formats. By default the acquire methods can decompress
bzip2, lzma and gzip compressed files; with this setting more
formats can be added on the fly or the used method can be changed.

Sometimes rebooting the docker VM on OSX can solve networking issues, especially if OSX has gone to sleep or changed networks.

I have same issue.
My host OS is elementary OS, docker is ubuntu:14.04
my network is SKTelecom, in Korea

 ~/example $ sudo docker build --tag hello:0.1 .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon 
Step 0 : FROM ubuntu:14.04
 ---> 35b394a6f7a2
Step 1 : MAINTAINER Foo Bar <[email protected]>
 ---> Using cache
 ---> 68c90bc7f579
Step 2 : RUN apt-get update
 ---> Running in acd1a4be0039

...
Get:20 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
Get:21 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]
Get:22 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
Fetched 22.2 MB in 21s (1042 kB/s)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.
INFO[0022] The command [/bin/sh -c apt-get update] returned a non-zero code: 100 

but when i use ubuntu:latest, it works.

Hi @vaporize93,
I am using the same ISP, SK Broadband, and it seems the problem is ISP cache.
After changing to KT line, the problem has gone.
Hope it can help you.

Seems to be an external issue to do with the networks, rather than a docker library. Closing this issue for now: if the issue persists for users and there's strong evidence that it's the province of docker library and the official images, we'll reopen.

I faced the same error running docker for Mac. Possibly related with docker engine as suggested before. My fix was to restart docker engine and the image was built after the restart.

any one please help guys stucked due to this

[root@indretest-3 docker]# docker build -t utomcat:0.0.2 .
Sending build context to Docker daemon 563.3MB
Step 1/12 : FROM ubuntu
---> 14f60031763d
Step 2/12 : RUN apt-get update && apt-get install -y vim tar gzip wget curl python-software-properties software-properties-common
---> Running in f05a21d1e72c
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [42.0 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [394 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.8 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [184 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2931 B]
Get:10 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Err:10 http://archive.ubuntu.com/ubuntu xenial/universe Sources
Hash Sum mismatch
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Err:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

Get:14 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [208 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [756 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.3 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [645 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [17.5 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4930 B]
Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6231 B]
Fetched 4590 kB in 31s (144 kB/s)
Reading package lists...
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/source/by-hash/SHA256/e201ab73d77c0208d5dcd4844b6215bc5e18b49d9f9b58d0fb627c47c0438ecd Hash Sum mismatch
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/universe/binary-amd64/by-hash/SHA256/d59324e59d14252ef10e976aea85f19d1d6251f24b752c3f2bc2d9f8e2fe1237
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update && apt-get install -y vim tar gzip wget curl python-software-properties software-properties-common' returned a non-zero code: 100
[root@indretest-3 docker]#

@erarunkumar, that seems to be just an out-of-date/misbehaving mirror or network config and usually resolves itself, if external, or may require a reboot of VM and/or host.

fyi - same issue here - docker restart does not help. Like @junshoong I am in South Korea. no firewall. Using ubuntu:latest works which would confirm a mirror issue.

@yosifkit Scenario is I am running a virtual machine on my desktop and same VM is imported in VMware farm of DC, in virtual machine on my desktop, docker pull is working fine whereas the exactly same VM imported to VMware farm in DC docker pull stop working due to some Hash mismatch.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davivcgarcia picture davivcgarcia  Â·  4Comments

andersla picture andersla  Â·  4Comments

chaudum picture chaudum  Â·  4Comments

yosifkit picture yosifkit  Â·  7Comments

sonicdoe picture sonicdoe  Â·  4Comments