Permission denied creating tar for Apt files
See original GitHub issueBased on @joshmgross’s latest comment in https://github.com/actions/cache/issues/133#issuecomment-629381394, here’s my use case, same as @evandrocoan https://github.com/actions/cache/issues/133#issuecomment-602695437…
caching Apt list and package files in Ubuntu
Example workflow
The Apt step here takes about 35 seconds without caching. I’m hoping the cache will improve that. I’m also not 100% sure about the paths because I haven’t been able to test it yet.
- name: Use Apt lists cache
uses: actions/cache@v1
with:
path: /var/lib/apt/lists
key: ${{ runner.os }}-apt-lists
- name: Use Apt packages cache
uses: actions/cache@v1
with:
path: /var/cache/apt
key: ${{ runner.os }}-apt-packages
- name: Install Apt dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblua5.1-dev luarocks
Error during post job
Post job cleanup.
/bin/tar -cz -f /home/runner/work/_temp/207e89c2-b0e5-4443-915a-2eafc37bc59b/cache.tgz -C /var/cache/apt .
/bin/tar: ./archives/partial: Cannot open: Permission denied
/bin/tar: ./archives/lock: Cannot open: Permission denied
/bin/tar: Exiting with failure status due to previous errors
[warning]Tar failed with error: The process '/bin/tar' failed with exit code 2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:15 (5 by maintainers)
Top Results From Across the Web
"Cannot open: Permission denied" when creating a tar file
The problem is that you are executing the command inside /usr/src to which you do not have write permissions with your credentials.
Read more >How to fix 'permission denied' error in Linux? [Solutions]
Every file and directory has some permission or privilege (read, write, or execute) associated with them. If you are not authorized to access ......
Read more >NVM: Getting Permission denied with nvm install command
Posted an issue to nvm's repo. Turns out the problem was with curl and that I had installed it with snap instead of...
Read more >How to Fix Shell Script Permission Denied Error in Linux
To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode)...
Read more >tar creates 0-byte files and issues permission denied errors
yml: Cannot close: Permission denied tar: perl-5.30.1/.lgtm.yml: Cannot utime: Permission denied ... it goes on and on for every file. I think ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to at least successfully save a cache of the downloaded
.deb
packages with this step:However, when attempting to restore this cache, the attempt to extract these cached files still results in
Cannot open: Permission denied
errors for each file:If we could just have an option for running the
/bin/tar
command as sudo, that would make this tool significantly easier to use for caching system packages (like those installed by apt).I have a workflow that opens a Nix shell. It has a lot of small dependencies, and it takes about 4 minutes to download them from various Nix binary caches. Seems like it would be faster to restore from github’s cache. Is there some reason the restore can’t just run as root?