kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

error building image: error building stage: lstat /tmp/apt-key-gpghome.VoPBz66R2g/gnupg_spawn_agent_sentinel.lock: no such file or directory

Open olivierboudet opened this issue 6 years ago • 54 comments

Actual behavior I am trying to build a Dockerfile which is built correctly with docker daemon. I have this error :

Setting up google-chrome-stable (77.0.3865.75-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.36.5-2+deb9u2) ...
INFO[0278] Taking snapshot of full filesystem...        
INFO[0279] Adding whiteout for /var/lib/apt/lists       
error building image: error building stage: lstat /tmp/apt-key-gpghome.7n7iliD9iR/gnupg_spawn_agent_sentinel.lock: no such file or directory

Expected behavior As it works with docker daemon, I expect that the build is also OK with kaniko without changing the dockerfile.

To Reproduce Use this Dockerfile in a builder-node directory

FROM google/cloud-sdk:262.0.0-slim

RUN apt-get update && apt-get install --yes curl && \
    curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
    apt-get install -y nodejs
 
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/chrome.list && \
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |  apt-key add - && \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" |  tee /etc/apt/sources.list.d/yarn.list && \
    apt-get update && \
    apt-get install --no-install-recommends -y software-properties-common && \
    # installation des paquets via apt
    apt-get install --no-install-recommends -y --allow-unauthenticated unzip google-chrome-stable yarn build-essential && \
    apt-get clean && \
    rm -rf /etc/apt/sources.list.d/chrome.list /var/lib/apt/lists

Run it :

run_in_docker.sh Dockerfile $(pwd)/builder-node gcr.io/myproject/builder-node:kaniko false

Additional Information

  • no other file in build context than the Dockerfile
ls -l builder-node 
total 4
-rw-r--r-- 1 olivier olivier 2354 15 sept. 23:26 Dockerfile
  • Kaniko Image built with make image from commit d67a8225031f2809f0d6c8c4f1825f233d8574a1 :
gcr.io/kaniko-project/executor                  latest              af14b1090d2e        2 hours ago         49.1MB

olivierboudet avatar Sep 15 '19 21:09 olivierboudet

I'm seeing the same issue with the debug tag. I'm following the instructions for building images in Gitlab CI.

Running the following:

for dir in $(ls -p contexts | grep -i '/')
do
	tag=$(echo $dir | cut -d'/' -f1)

	echo "building $tag..."
	/kaniko/executor --context $CI_PROJECT_DIR/contexts/$tag/ \
		--dockerfile $CI_PROJECT_DIR/contexts/$tag/Dockerfile \
		--destination $repo/google-chrome:$tag \
		--no-push
done

Folder structure looks like the following:

.
├── CONTRIBUTING.md
├── README.md
├── ci
│   ├── build.sh
│   └── build_and_push.sh
└── contexts
    └── 77.0.3865.90
        └── Dockerfile

juicemia avatar Sep 25 '19 20:09 juicemia

Getting same kind of error here:

update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for libc-bin (2.24-11+deb9u4) ...
INFO[0254] Taking snapshot of full filesystem...        
error building image: error building stage: lstat /tmp/apt-key-gpghome.4lNiMJ5oLl/pubring.kbx: no such file or directory

Any solution?

fabn avatar Sep 26 '19 08:09 fabn

Thanks @fabn, i will take a look at this.

tejal29 avatar Oct 04 '19 09:10 tejal29

I have the same problem, also with the debug tag :

Setting up google-chrome-stable (76.0.3809.132-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Setting up liblwp-protocol-https-perl (6.06-2) ...
Setting up libwww-perl (6.15-1) ...
Setting up libxml-parser-perl (2.44-2+b1) ...
Setting up libxml-twig-perl (1:3.50-1) ...
Setting up libnet-dbus-perl (1.1.0-4+b1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

INFO[0053] Taking snapshot of full filesystem...        
error building image: error building stage: lstat /tmp/apt-key-gpghome.X3u0zrcS5t/pubring.orig.gpg: no such file or directory

I feel like the error is related to chrome installation inside image but not sure of that.

Neonox31 avatar Oct 07 '19 06:10 Neonox31

@Neonox31 that was my first thought but same dockerfile builds in native docker with no issues

fabn avatar Oct 07 '19 06:10 fabn

@fabn Yes, but I think the conflict is between kaniko and chrome.

Neonox31 avatar Oct 07 '19 07:10 Neonox31

I can confirm it's about the chrome install. When I just remove Chrome (google-chrome-unstable in my case) from the list of packages installed by apt-get, kaniko is able to build the image

EppO avatar Oct 15 '19 19:10 EppO

I'm experiencing a similar issue with a gradle container:

INFO[0091] Taking snapshot of full filesystem...        
error building image: error building stage: Failed to get file info for /root/.kotlin/daemon/kotlin-daemon.2019-10-29T08-34-55.719Z.7338a1b69672dd00d0aa900c1e9f04a7.17450.run: lstat /root/.kotlin/daemon/kotlin-daemon.2019-10-29T08-34-55.719Z.7338a1b69672dd00d0aa900c1e9f04a7.17450.run: no such file or directory

When I enabled debug logging the issue disappeared. I suspect it might be a race condition but I have no experience to further investigate.

nielsvanvelzen avatar Oct 29 '19 08:10 nielsvanvelzen

Sorry @EppO and @fabn this fell off my radar.

tejal29 avatar Nov 14 '19 21:11 tejal29

i will take a look at this tomorrow.

tejal29 avatar Nov 14 '19 21:11 tejal29

Exactly the same thing while building huge (3gb) container with gradle&android sdk:

INFO[0454] Taking snapshot of full filesystem...        
error building image: error building stage: lstat /tmp/hsperfdata_root/6383: no such file or directory

caseycs avatar Nov 27 '19 18:11 caseycs

any progress on this one? can't use kaniko atm for building images from cicd. using kaniko:debug latest image from gcr.io

HerrmannHinz avatar Dec 16 '19 19:12 HerrmannHinz

Same error here, I'm trying to build a danlynn/ember-cli image on Gitlab CI…

jandillmann avatar Dec 19 '19 11:12 jandillmann

@jandillmann @fabn I was getting this same issue when installing google-chrome-stable using Kaniko within GitLab CI. I was able to fix it for now by inserting this statement before doing apt-get install operations.

RUN apt-get clean \
 && cd /var/lib/apt \
 && mv lists lists.old \
 && mkdir -p lists/partial \
 && apt-get update \
 && apt-get upgrade -y   

So now my entire Dockerfile looks like this:

FROM node:12.8.0

ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

RUN apt-get clean \
 && cd /var/lib/apt \
 && mv lists lists.old \
 && mkdir -p lists/partial \
 && apt-get update \
 && apt-get upgrade -y     

RUN cd /tmp && \
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
    dpkg -i google-chrome-stable_current_amd64.deb; apt-get update; apt-get install -y -f

RUN mkdir -p /code
WORKDIR /code
COPY . /code

RUN npm install -g -s --no-progress yarn && \
    yarn global add nightwatch && \
    yarn add babel-plugin-add-module-exports babel-preset-es2015 -D && \
    yarn

EXPOSE 4444

I'm not exactly sure why we need to clean out the lists directory beforehand, but the source of the solution comes from the owner of this issue: https://github.com/GoogleContainerTools/kaniko/issues/793

drshrey avatar Dec 19 '19 19:12 drshrey

Hey @olivierboudet, @jandillmann, @HerrmannHinz , @drshrey, @EppO, @Neonox31, @fabn , @nielsdenissen Sorry this took a lot of time. I have a fix for this and verified your dockerfile on my branch. https://github.com/GoogleContainerTools/kaniko/pull/1000

Thanks a again! Please let me know if you want an image to verify this works on your side.

tejal29 avatar Jan 25 '20 00:01 tejal29

@tejal29 I am interested to have an image with this fix and the one in #793 if possible to check if my dockerfile is building with it.

thanks

olivierboudet avatar Jan 26 '20 13:01 olivierboudet

@tejal29: I can test it on my side too if this helps, thanks!

EppO avatar Jan 27 '20 14:01 EppO

Thanks a lot @EppO. I pushed the following images with the fix

gcr.io/kaniko-project/executor:fix_769
gcr.io/kaniko-project/executor:debug_769

tejal29 avatar Jan 29 '20 17:01 tejal29

@olivierboudet i did verify your dockerfile at my end and its works. Do you want to give it a try with these images

gcr.io/kaniko-project/executor:fix_769
gcr.io/kaniko-project/executor:debug_769

tejal29 avatar Jan 29 '20 17:01 tejal29

@tejal29 I wasn't able to pull down your debug_769 image for some reason, but fix_769 works for me. Will test it out and let you know if it fixes the issue. Thanks!

EDIT: nevermind, GitLab doesn't support non debug_* images because images require a shell for GitLab CI :(. See https://github.com/GoogleContainerTools/kaniko/issues/430

drshrey avatar Jan 29 '20 21:01 drshrey

@olivierboudet i did verify your dockerfile at my end and its works. Do you want to give it a try with these images

gcr.io/kaniko-project/executor:fix_769
gcr.io/kaniko-project/executor:debug_769

yes it works on my side also, thanks

olivierboudet avatar Jan 30 '20 14:01 olivierboudet

Thanks a lot @EppO. I pushed the following images with the fix

gcr.io/kaniko-project/executor:fix_769
gcr.io/kaniko-project/executor:debug_769

I'm using the kaniko debug image in a GitLab pipeline that needs a shell to inject the custom executor command, and I can't pull gcr.io/kaniko-project/executor:debug_769 for some reasons. It doesn't show up in GCR registry.

EppO avatar Jan 30 '20 16:01 EppO

@EppO and @drshrey i pushed an image without the debug_. Thanks!

docker tag gcr.io/kaniko-project/executor:debug_769 gcr.io/kaniko-project/debug:769
docker push gcr.io/kaniko-project/debug:769

tejal29 avatar Jan 30 '20 21:01 tejal29

Job succeeded! It works! Thanks a lot for your fix

EppO avatar Jan 31 '20 03:01 EppO

Thank you @tejal29, all is well now!

drshrey avatar Jan 31 '20 05:01 drshrey

Great! This fix will available in next release in about an hour!

tejal29 avatar Jan 31 '20 19:01 tejal29

Sorry, i am going to push the release to monday since could not get done in the am.

Thanks Tejal

tejal29 avatar Jan 31 '20 23:01 tejal29

Hey folks, Release v0.17.0 is now up! Please use the latest image and let us know if you still see this issue!

Thank you for your patience!

tejal29 avatar Feb 03 '20 22:02 tejal29

I just hit this ...

INFO[0008] Unpacking rootfs as cmd RUN gcc --version requires it. 
error building image: error building stage: failed to get filesystem from image: mkdir /usr/lib/jvm/default-jvm: file exists

I'm using GCB,

steps:
- name: 'gcr.io/kaniko-project/executor:latest'
  args:
  - --destination=gcr.io/$PROJECT_ID/alpine-emulator
  - --cache=true
  - --cache-ttl=24h

bimargulies-google avatar Feb 25 '20 22:02 bimargulies-google

I just hit this ...

INFO[0008] Unpacking rootfs as cmd RUN gcc --version requires it. 
error building image: error building stage: failed to get filesystem from image: mkdir /usr/lib/jvm/default-jvm: file exists

I'm using GCB,

steps:
- name: 'gcr.io/kaniko-project/executor:latest'
  args:
  - --destination=gcr.io/$PROJECT_ID/alpine-emulator
  - --cache=true
  - --cache-ttl=24h

that may be the same as #830

cvgw avatar Feb 27 '20 23:02 cvgw