Restore_cache file system permission denied

cache
config
permissions

#1

I have been trying to install the python-pip apt package using the circleci/ruby:2.3.3-node image. Without a cache, the task will install correctly. The problem I encounter is a file permission issue when restoring the cache.

The error message that I see starts with:

Found a cache from build 11767 at python-pip-arch1-linux-amd64-6_62
Size: 14 MB
Cached paths:
  * /home/circleci/iqapp/pip.version
  * /usr/share/doc/python-pip
  * /usr/share/man/man1/pip.1.gz
  * /usr/lib/python2.7
  * /usr/bin/pip
  * /usr/bin/pip2
  * /usr/share/man/man1/pip2.1.gz

Downloading cache archive...
Validating cache...

Unarchiving cache...
tar: usr/share/doc/python-pip: Cannot mkdir: Permission denied
tar: usr/share/doc/python-pip: Cannot mkdir: Permission denied
tar: usr/share/doc/python-pip/README.Debian: Cannot open: No such file or directory
tar: usr/share/doc/python-pip: Cannot mkdir: Permission denied

And then just continues on with many more permission denied errors.

This is the task that I’m running:

  install_python_pip:
    <<: *defaults
    working_directory: ~/cache-keys
    steps:
      - restore_cache:
          key: python-pip-{{ arch }}
      - run: |
          if [ -z $(which pip) ] ; then
            sudo apt-get update && sudo apt-get install -y -qq python-pip
            dpkg -l python-pip | awk '{ print $3 }' | tail -n1 | cat > pip.version
          fi
      - save_cache:
          key: python-pip-{{ arch }}-{{ checksum "pip.version" }}
          # Installed file paths found with: dpkg-query -L python-pip
          paths:
            - pip.version
            - /usr/share/doc/python-pip
            - /usr/share/man/man1/pip.1.gz
            - /usr/lib/python2.7
            - /usr/bin/pip
            - /usr/bin/pip2
            - /usr/share/man/man1/pip2.1.gz

I am having problems with another task that also is trying to restore cache to a directory that normally would require sudo privileges to write to. Any ideas on how to address this permission problem would be greatly appreciated.


#2

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