Error untarring cache: exit status 2


#1

After adding cache/uncache steps to my build config, I’m getting this error on the uncache step.

This is problematic for me. But beyond that, this fails the build and it really seems like it shouldn’t. Having cached intermediate work is a speed up, but not strictly required.

Without this, 2.0 doesn’t seem to add much benefit to my builds.


#2

Did you install the necessary dependencies to untar the cache? Another common problem is permissions related.


#3

No, I didn’t install any particular dependencies for that purpose. But, given that the cache is created in the first place, it would seem to me like those dependencies are present.

And I’m pretty certain it’s not permissions, because I’m setting the mode to 777 on the cache directory before the uncache step.


#4

Install tar, untar, and gzip and it will work okay.


#5

A vague problem with the circleci docker images, is that if you’re trying to cache anything which the circleci user does not have write permissions to, then restoring it will fail.

Any suggestions for ways around this?


#6

Maybe chowning before & after? I’ll open a bug ticket to address this.


#9

Hey there, any update here? Circle 2 is fast enough that this isn’t a HUGE problem for us, but not having any caches work is definitely not ideal and will probably keep us on Circle 1 in the meantime.


#10

Caching works properly at this time, but it does not address insufficient permissions yet. What are you trying to cache?


#11

We’re having trouble to use caches for anything. For instance, we use yarn for JS dependency management and have the following:

      - restore_cache:
          key: yarn-{{ checksum "yarn.lock" }}
      - run:
          name: Yarn Install
          command: yarn install --cache-folder yarn-cache
      - save_cache:
          key: yarn-{{ checksum "yarn.lock" }}
          paths:
            - ~/youearnedit/yarn-cache

which results in the same Error untarring cache: exit status 2 error that others have been seeing.

Our build setup is

  build:
    working_directory: ~/youearnedit
    docker:
      - image: circleci/ruby:2.3.4-node-browsers
      - image: circleci/mongo:3.2.13
      - image: redis:3.2.3

Do you know why we’d be getting this error? Thank you!


#12

I found the build in question and the reason is because you switched images. The cached node_modules was in /root and then you moved to /home/circleci, so there’s a permissions issue. The solution is to prefix your cache name with v1- so you can change the cache name if it ever becomes corrupt.

I imagine we’ll have a better solution at some point to clear out the cache on 2.0, but today the only solution is to change the name of the key.

EDIT: @kmcq It’s also worth noting you don’t need to install yarn as it’s already installed;

$ yarn --version
0.24.4

Cache not cleared
#13

Ryan,

Thank you so much! We really appreciate you not only answering the question, but also digging into our specific instance! That is above and beyond :slight_smile:. Hopefully our experience will be helpful to others who find this forum.

Cheers,
Keith


#14

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.