Skip to content

“apt-get update” always fail when build base docker image. #4366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BaluAlluru opened this issue Apr 3, 2020 · 13 comments
Open

“apt-get update” always fail when build base docker image. #4366

BaluAlluru opened this issue Apr 3, 2020 · 13 comments
Assignees
Labels

Comments

@BaluAlluru
Copy link

seeing below error when building sonic image on main trunk.
$ make configure PLATFORM=broadcom
+++ Making configure +++
make -f Makefile.work configure
make[1]: Entering directory '/home/bala/sonic/Apr3_soniclocalRepo/SONiC_QFX5200_GitHub'
Image sonic-slave-jessie:da83677fffb not found. Building...
Sending build context to Docker daemon 26.11kB
Step 1/38 : FROM debian:jessie
---> c1045f0373cd
Step 2/38 : MAINTAINER [email protected]
---> Running in 96cf6060c5cf
Removing intermediate container 96cf6060c5cf
---> 7225790d7edd
Step 3/38 : COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"]
---> b6cc8888f624
Step 4/38 : RUN sed -i '/http://deb.debian.org/debian jessie-updates main/d' /etc/apt/sources.list
---> Running in 969a402510cc
Removing intermediate container 969a402510cc
---> c019549972eb
Step 5/38 : RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list
---> Running in 5d69ed0d93aa
Removing intermediate container 5d69ed0d93aa
---> 57a448475e84
Step 6/38 : ENV DEBIAN_FRONTEND=noninteractive
---> Running in 92cd4c1192f4
Removing intermediate container 92cd4c1192f4
---> e3739afccd45
Step 7/38 : RUN apt-get update && apt-get install -y apt-utils default-jre-headless openssh-server curl wget unzip git build-essential libtool lintian sudo dh-make dh-exec kmod libtinyxml2-2 libboost-program-options1.55-dev libtinyxml2-dev python python-pip libncurses5-dev texinfo dh-autoreconf python3-pip doxygen devscripts git-buildpackage perl-modules libswitch-perl dh-systemd libreadline-dev texlive-latex-base texlive-generic-recommended texlive-fonts-recommended libpam0g-dev libpam-dev libcap-dev imagemagick ghostscript groff libpcre3-dev gawk chrpath libc-ares-dev hardening-wrapper libsnmp-dev libjson0 libjson0-dev libsystemd-dev python-ipaddr install-info cdbs libxml-simple-perl graphviz aspell bc fakeroot build-essential devscripts quilt stgit module-assistant gem2deb libboost-all-dev libevent-dev libglib2.0-dev libqt4-dev python-all-dev python-twisted php5-dev phpunit libbit-vector-perl openjdk-7-jdk javahelper maven-debian-helper ant libmaven-ant-tasks-java libhttpclient-java libslf4j-java libservlet3.1-java qt5-default pkg-php-tools libpcre3 libpcre3-dev byacc flex libglib2.0-dev bison expat libexpat1-dev dpatch libdb-dev iptables-dev swig ctags libtool-bin libxml2-dev libusb-1.0-0-dev libcurl3-nss-dev libunwind8-dev telnet libc-ares2 libgoogle-perftools4 cpio squashfs-tools zip linux-compiler-gcc-4.9-x86 linux-kbuild-3.16 libdaemon-dev libdbus-1-dev libjansson-dev libpcap-dev dnsutils libusb-dev augeas-tools libyaml-dev libevent-dev libjudy-dev libedit-dev libnanomsg-dev python-stdeb libjemalloc-dev dkms sharutils libncursesw5-dev libbz2-dev liblzma-dev libgdbm-dev tk-dev blt-dev libmpdec-dev libbluetooth-dev locales libsqlite3-dev libgpm2 time net-tools xvfb python-sphinx python3-sphinx cppcheck clang pylint gcovr python-pytest=2.6.3* python3-pytest=2.6.3* python-pytest-cov python3-pytest-cov python-parse libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-markupsafe python-pygments python-roman sphinx-common python-lxml python-netaddr python-ipaddr python-yaml procmail libgtest-dev cmake autoconf-archive swig3.0 cm-super-minimal libatm1-dev libelf-dev libmnl-dev libselinux1-dev linuxdoc-tools lynx texlive-latex-extra texlive-latex-recommended python-sphinx python-docutils python3-all python3-setuptools python3-sphinx python3-docutils python3-requests python3-pytest python3-colorama texi2html bash-completion dosfstools qemu-kvm libvirt-bin
---> Running in 4b939f6ce398
Ign http://debian-archive.trafficmanager.net jessie InRelease
Get:1 http://debian-archive.trafficmanager.net jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://security.debian.org jessie/updates InRelease [44.9 kB]
Get:3 http://debian-archive.trafficmanager.net jessie Release.gpg [1652 B]
Get:4 http://debian-archive.trafficmanager.net jessie Release [77.3 kB]
Get:5 http://deb.debian.org jessie Release.gpg [1652 B]
Get:6 http://deb.debian.org jessie Release [77.3 kB]
Get:7 http://debian-archive.trafficmanager.net jessie/updates/main Sources [441 kB]
Get:8 http://debian-archive.trafficmanager.net jessie/updates/contrib Sources [1298 B]
Get:9 http://debian-archive.trafficmanager.net jessie/updates/non-free Sources [1740 B]
Get:10 http://debian-archive.trafficmanager.net jessie/updates/main amd64 Packages [954 kB]
Get:11 http://security.debian.org jessie/updates/main amd64 Packages [954 kB]
Get:12 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Get:13 http://debian-archive.trafficmanager.net jessie/updates/contrib amd64 Packages [2366 B]
Get:14 http://debian-archive.trafficmanager.net jessie/updates/non-free amd64 Packages [4959 B]
Get:15 http://debian-archive.trafficmanager.net jessie/main Sources [9169 kB]
Get:16 http://debian-archive.trafficmanager.net jessie/contrib Sources [58.9 kB]
Get:17 http://debian-archive.trafficmanager.net jessie/non-free Sources [119 kB]
Get:18 http://debian-archive.trafficmanager.net jessie/main amd64 Packages [9098 kB]
Get:19 http://debian-archive.trafficmanager.net jessie/contrib amd64 Packages [59.2 kB]
Get:20 http://debian-archive.trafficmanager.net jessie/non-free amd64 Packages [101 kB]

Fetched 30.3 MB in 38s (783 kB/s)
W: Failed to fetch http://security.debian.org/debian-security/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.
The command '/bin/sh -c apt-get update && apt-get install -y apt-utils default-jre-headless openssh-server curl wget unzip git build-essential libtool lintian sudo dh-make dh-exec kmod libtinyxml2-2 libboost-program-options1.55-dev libtinyxml2-dev python python-pip libncurses5-dev texinfo dh-autoreconf python3-pip doxygen devscripts git-buildpackage perl-modules libswitch-perl dh-systemd libreadline-dev texlive-latex-base texlive-generic-recommended texlive-fonts-recommended libpam0g-dev libpam-dev libcap-dev imagemagick ghostscript groff libpcre3-dev gawk chrpath libc-ares-dev hardening-wrapper libsnmp-dev libjson0 libjson0-dev libsystemd-dev python-ipaddr install-info cdbs libxml-simple-perl graphviz aspell bc fakeroot build-essential devscripts quilt stgit module-assistant gem2deb libboost-all-dev libevent-dev libglib2.0-dev libqt4-dev python-all-dev python-twisted php5-dev phpunit libbit-vector-perl openjdk-7-jdk javahelper maven-debian-helper ant libmaven-ant-tasks-java libhttpclient-java libslf4j-java libservlet3.1-java qt5-default pkg-php-tools libpcre3 libpcre3-dev byacc flex libglib2.0-dev bison expat libexpat1-dev dpatch libdb-dev iptables-dev swig ctags libtool-bin libxml2-dev libusb-1.0-0-dev libcurl3-nss-dev libunwind8-dev telnet libc-ares2 libgoogle-perftools4 cpio squashfs-tools zip linux-compiler-gcc-4.9-x86 linux-kbuild-3.16 libdaemon-dev libdbus-1-dev libjansson-dev libpcap-dev dnsutils libusb-dev augeas-tools libyaml-dev libevent-dev libjudy-dev libedit-dev libnanomsg-dev python-stdeb libjemalloc-dev dkms sharutils libncursesw5-dev libbz2-dev liblzma-dev libgdbm-dev tk-dev blt-dev libmpdec-dev libbluetooth-dev locales libsqlite3-dev libgpm2 time net-tools xvfb python-sphinx python3-sphinx cppcheck clang pylint gcovr python-pytest=2.6.3* python3-pytest=2.6.3* python-pytest-cov python3-pytest-cov python-parse libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-markupsafe python-pygments python-roman sphinx-common python-lxml python-netaddr python-ipaddr python-yaml procmail libgtest-dev cmake autoconf-archive swig3.0 cm-super-minimal libatm1-dev libelf-dev libmnl-dev libselinux1-dev linuxdoc-tools lynx texlive-latex-extra texlive-latex-recommended python-sphinx python-docutils python3-all python3-setuptools python3-sphinx python3-docutils python3-requests python3-pytest python3-colorama texi2html bash-completion dosfstools qemu-kvm libvirt-bin' returned a non-zero code: 100
Image sonic-slave-jessie-bala:c988c38ace0 not found. Building...
Sending build context to Docker daemon 26.11kB
Step 1/18 : ARG slave_base_tag_ref=latest
Step 2/18 : FROM sonic-slave-jessie:${slave_base_tag_ref}
pull access denied for sonic-slave-jessie, repository does not exist or may require 'docker login'
Unable to find image 'sonic-slave-jessie-bala:c988c38ace0' locally
docker: Error response from daemon: pull access denied for sonic-slave-jessie-bala, repository does not exist or may require 'docker login'.
See 'docker run --help'.
Makefile.work:200: recipe for target 'configure' failed
make[1]: *** [configure] Error 125

@ciju-juniper
Copy link
Contributor

@lguohan This problem happens when the 'sonic-slave-jessie-${user}' build docker is built from scratch. If there is already a 'sonic-slave-jessie-${user}' image is present in the local docker image repository, things will go smooth.

Are there any workarounds available to get rid of this problem? We ran into this issue after deleting all the existing images from local docker image repository due to lack of storage space.

@ciju-juniper
Copy link
Contributor

I was able to get the 'sonic-slave-jessie' built by adding the option "-o Acquire::CompressionTypes::Order::=gz" option to apt-get in sonic-slave-jessie/Dockerfile & sonic-slave-jessie/Dockerfile.j2

314 # Install docker engine 17.03.2~ce-0 inside docker and enable experimental feature
315 RUN apt-get update -o Acquire::CompressionTypes::Order::=gz

This is just a way to get going. I can see that http://security.debian.org/debian-security/dists/jessie/updates/main/binary-amd64/Packages has been updated just two days back and this hash mismatch is a result of that. It needs to be fixed.

@lguohan @gechiang How do we get the hash updated?

@lguohan
Copy link
Collaborator

lguohan commented Apr 5, 2020

check this job.

daily build works. https://sonic-jenkins.westus2.cloudapp.azure.com/job/bldenv/job/sonic-slave-jessie/132/

i suspect some temp issue.

@ciju-juniper
Copy link
Contributor

@xinliu-seattle
Copy link
Contributor

ciju, our build job doesn't have this issue. suggest you to check on your side.

@kktheballer
Copy link
Contributor

@ciju-juniper @BaluAlluru Were you guys able to resolve this? I am actually facing the exact same problem when trying to run "make configure PLATFORM=vs"

@ciju-juniper
Copy link
Contributor

@kktheballer It's better now. Sometimes, we still do hit this problem. So we add the workaround "-o Acquire::CompressionTypes::Order::=gz" in the failing docker slave Dockerfile.j2

@stephengzh
Copy link

@kktheballer It's better now. Sometimes, we still do hit this problem. So we add the workaround "-o Acquire::CompressionTypes::Order::=gz" in the failing docker slave Dockerfile.j2

Hello, I met the same issue when I built the PTF docker with:
admin5@admin5-PowerEdge-R720:~/sonic-buildimage-1$ make configure PLATFORM=generic

I added the workaround "-o Acquire::CompressionTypes::Order::=gz" in the failing docker slave Dockerfile.j2:

admin5@admin5-PowerEdge-R720:~/sonic-buildimage-1/sonic-slave-jessie$ cat Dockerfile.j2
.
.
.

Install depot-tools (for git-retry)

RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools
ENV PATH /usr/share/depot_tools:$PATH

Install docker engine 17.03.2~ce-0 inside docker and enable experimental feature

RUN apt-get update -o Acquire::CompressionTypes::Order::=gz
RUN apt-get install -y
apt-transport-https
ca-certificates
curl
.
.
.

But still unable to find image:

Image sonic-slave-jessie-admin5:7c444646c9 not found. Building...
Sending build context to Docker daemon 26.11kB
Step 1/18 : ARG slave_base_tag_ref=latest
Step 2/18 : FROM sonic-slave-jessie:${slave_base_tag_ref}
pull access denied for sonic-slave-jessie, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Unable to find image 'sonic-slave-jessie-admin5:7c444646c9' locally
docker: Error response from daemon: pull access denied for sonic-slave-jessie-admin5, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
Makefile.work:219: recipe for target 'configure' failed
make[1]: *** [configure] Error 125
make[1]: Leaving directory '/home/admin5/sonic-buildimage-1'
Makefile:29: recipe for target 'configure' failed
make: *** [configure] Error 2

Please help me.

@kktheballer
Copy link
Contributor

@ciju-juniper Thanks for your response. What I ended up doing was doing the OS build on a new VM altogether and that did the trick.

@torombolo17
Copy link

Hello! I've tried running make configure PLATFORM=barefoot in two different VMs (Debian 9 and Ubuntu 18.04) and I get the same issue in both of them:

Image sonic-slave-stretch-admin2:14984cfb5c not found. Building...
Sending build context to Docker daemon 26.62kB
Step 1/18 : ARG slave_base_tag_ref=latest
Step 2/18 : FROM sonic-slave-stretch:${slave_base_tag_ref}
pull access denied for sonic-slave-stretch, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Unable to find image 'sonic-slave-stretch-admin2:14984cfb5c' locally
docker: Error response from daemon: pull access denied for sonic-slave-stretch-admin2, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
Makefile.work:195: recipe for target 'configure' failed
make[1]: *** [configure] Error 125
make[1]: Leaving directory '/home/admin2/Documents/sonic-buildimage'
Makefile:19: recipe for target 'configure' failed
make: *** [configure] Error 2

I added -o Acquire::CompressionTypes::Order::=gz to both the Dockerfile and Dockerfile.j2, but I still get the error. Any help?

@hulksmaaash
Copy link

I was hitting this same issue and adding the -o Acquire::CompressionTypes::Order::=gz' to the Dockerfile and Dockerfile.j2 didn't help. However, after adding --force-yes after every apt-get install -y and apt install -y in both files, I was able to complete the build.

I am building with PLATFORM=vs and PLATFORM_ARCH=arm64

@kielfriedt
Copy link

I was hitting this same issue and adding the -o Acquire::CompressionTypes::Order::=gz' to the Dockerfile and Dockerfile.j2 didn't help. However, after adding --force-yes after every apt-get install -y and apt install -y in both files, I was able to complete the build.

I am building with PLATFORM=vs and PLATFORM_ARCH=arm64

This worked for me

@asmirnov-ionos
Copy link

Hi there in 2023!

I just faced same issue while trying build Sonic locally on Ubuntu 22.04.1 LTS

Image sonic-slave-bullseye:1f0118f0315 not found. Building...
Sending build context to Docker daemon  246.8kB
Step 1/61 : FROM debian:bullseye
 ---> 5c8936e57a38
Step 2/61 : MAINTAINER [email protected]
 ---> Running in ee748ca7e7c8
Removing intermediate container ee748ca7e7c8
 ---> cff5f175d1ec
Step 3/61 : COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"]
 ---> 7e13bf138512
Step 4/61 : COPY ["buildinfo", "/usr/local/share/buildinfo"]
 ---> 76f509cefbbb
Step 5/61 : RUN dpkg -i /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb
 ---> Running in d92be096db48
dpkg-deb: error: archive '/usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb
The command '/bin/sh -c dpkg -i /usr/local/share/buildinfo/sonic-build-hooks_1.0_all.deb' returned a non-zero code: 1
Unable to find image 'sonic-slave-bullseye:1f0118f0315' locally
Error response from daemon: pull access denied for sonic-slave-bullseye, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Error: No such container:path: sonic-slave-bullseye:/etc/os-release
Error: No such container:path: sonic-slave-bullseye:/usr/local/share/buildinfo/pre-versions
Error: No such container:path: sonic-slave-bullseye:/usr/local/share/buildinfo/post-versions
Error: No such container: sonic-slave-bullseye
Image sonic-slave-bullseye-asmirnov:68d6accd74d not found. Building...
Sending build context to Docker daemon  248.3kB
Step 1/18 : ARG slave_base_tag_ref=latest
Step 2/18 : FROM sonic-slave-bullseye:${slave_base_tag_ref}
pull access denied for sonic-slave-bullseye, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Unable to find image 'sonic-slave-bullseye-asmirnov:68d6accd74d' locally
docker: Error response from daemon: pull access denied for sonic-slave-bullseye-asmirnov, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
make[1]: *** [Makefile.work:402: configure] Error 125

my build env settings are:

export NOJESSIE=1
export NOSTRETCH=1
export NOBUSTER=1
export BLDENV=bullseye
export PLATFORM=mellanox 
export SONIC_BUILD_JOBS=$(nproc) 
export ENABLE_ZTP=y 
git clone https://github.com/sonic-net/sonic-buildimage
cd sonic-buildimage/
git checkout ea51d9514d870b7720da38ab2dbadb503d89726c
clear; time make init; time make configure; time make target/sonic-mellanox.bin 

As issue is still open i wonder if there any workaround already implemented in some feature branch ?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants