Reading cache from /usr/local/lib fails with permission denied
I'm trying to cache C shared libraries, that live in usr/local/lib. Writing the cache is working, but reading from it fails because the action is not able to untar the cache in /usr/local/lib. I wasn't able to find a way to specify permissions for this action, so I'm creating an issue for this.
This is my configuration:
- name: Cache Check Library
id: cache-libcheck
uses: actions/cache@v3
with:
path: /usr/local/lib/libcheck.so.0.0.0
key: ${{ runner.os }}-libcheck
And the error message:
Run actions/cache@v3
with:
path: /usr/local/lib/libcheck.so.0.0.0
key: Linux-libcheck
Received 82079 of 82079 (100.0%), 1.0 MBs/sec
Cache Size: ~0 MB (82079 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/ba336f98-3acc-438c-a90c-4196e66cecd3/cache.tzst -P -C /home/runner/work/powertwin/powertwin
/usr/bin/tar: ../../../../../usr/local/lib/libcheck.so.0.0.0: Cannot open: Permission denied
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Tar failed with error: The process '/usr/bin/tar' failed with exit code 2
This is the job setup:
Current runner version: '2.294.0'
Operating System
Ubuntu
20.04.4
LTS
Virtual Environment
Environment: ubuntu-20.04
Version: 20220626.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20220626.1/images/linux/Ubuntu2004-Readme.md
Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20220626.1
Virtual Environment Provisioner
1.0.0.0-main-20220616-1
GITHUB_TOKEN Permissions
Actions: write
Checks: write
Contents: write
Deployments: write
Discussions: write
Issues: write
Metadata: read
Packages: write
Pages: write
PullRequests: write
RepositoryProjects: write
SecurityEvents: write
Statuses: write
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:2541b1294d2704b0964813337f33b291d3f8596b)
Download action repository 'actions/cache@v3' (SHA:c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d)
Download action repository 'actions/upload-artifact@v3' (SHA:3cea5372237819ed00197afe530f5a7ea3e805c8)
Am I missing anything here or is this really an issue?
Thank you!
@leiferksn if you are using self-hosted runner then please ensure that the runner has access to this file.
For GitHub hosted runner, I tried to cache a random file (I did not see /usr/local/lib/libcheck.so.0.0.0 in there) in /usr/local/lib and it worked for me
- name: Cache Check Library
id: cache-libcheck
uses: actions/cache@v3
with:
path: /usr/local/lib/android/sdk/platforms/android-27/data/res/values-bs/strings.xml
key: ${{ runner.os }}-libcheck
I have the same problem: caching files in /usr/local doesn't work. The error message is the same. @bishal-pdMSFT we should probably reopen this because in your example you cached a file that always exists.
Example build: https://github.com/athenianco/athenian-api/actions/runs/3091205505/jobs/5000988782 (step "cache libsentry")
BTW, this is the workaround. Add the following step before the cache step:
- name: chown /usr/local/lib
run: sudo chown $(whoami) /usr/local/lib