Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EACCES: permission denied #1088

Closed
shuhaib-kk opened this issue Jun 20, 2024 · 12 comments
Closed

EACCES: permission denied #1088

shuhaib-kk opened this issue Jun 20, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@shuhaib-kk
Copy link

Am getting the following error.

EACCES: permission denied, mkdir '/home/gh-runner/actions-runner/_work/_tool/node/16.20.2'
Falling back to download directly from Node
Acquiring 16.20.2 - x64 from https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-x64.tar.gz
Extracting ...
/bin/tar xz --strip 1 --warning=no-unknown-keyword -C /home/gh-runner/actions-runner/_work/_temp/67e93bd8-a888-4871-b944-ff1884bf5c4a -f /home/gh-runner/actions-runner/_work/_temp/bb0f2a75-7344-4727-bcfe-ba452219c4af
Adding to the cache ...
Error: EACCES: permission denied, mkdir '/home/gh-runner/actions-runner/_work/_tool/node/16.20.2'

using actions/setup-node@v3

@shuhaib-kk shuhaib-kk added bug Something isn't working needs triage labels Jun 20, 2024
@JesusRamp
Copy link

Same issue here,
EACCES: permission denied, mkdir '/home/circleci/_work/_tool/node/18.20.3'
and I'm using actions/setup-node@v4.0.2

@orbi-ci-bot
Copy link

+1 I seem to be getting this error
Error: EACCES: permission denied, mkdir '/home/ec2-user/actions-runner/_work/_tool/node/16.20.2'

@brodriguez-eb
Copy link

+1
EACCES: permission denied, mkdir '/opt/hostedtoolcache/node/20.15.0'

@priyagupta108
Copy link
Contributor

Hello @shuhaib-kk,
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

@aparnajyothi-y aparnajyothi-y self-assigned this Jul 10, 2024
@aparnajyothi-y
Copy link
Contributor

Hello Everyone, we have investigated the issue and we are able to set up the above mentioned node versions 16.20.2, 18.20.0, 20.15.0 successfully on the github hosted runner ubuntu-latest in this workflow run.
Please share the repro link to investigate the issue and assist further as we are not able to reproduce the issue.

@orbi-ci-bot
Copy link

orbi-ci-bot commented Jul 16, 2024

Hi @aparnajyothi-y, I am unable to view the workflow you have shared. We are using a self hosted runner on EC2 with Amazon Linux 3. Here is the error.

Error: EACCES: permission denied, mkdir '/home/ec2-user/actions-runner/_work/_tool/node/16.20.2'

I have to delete the folder manually in my workflow before the node setup as a workaround with sudo permissions as I can't find any other way.

@aparnajyothi-y
Copy link
Contributor

Hello @orbi-ci-bot, Apologies,I have updated the visibility of this test workflow
The error EACCES: permission denied, mkdir '/home/ec2-user/actions-runner/_work/_tool/node/16.20.2' indicates a permissions issue with the self-hosted runner on EC2 using Amazon Linux 3.
The possible workarounds that we can try to resolve the issue are mentioned below

  • delete the problematic folder manually in your workflow before setting up Node.js with sudo permissions.
    jobs:
    build:
    runs-on: self-hosted
    steps:

    • name: Delete Node.js folder with sudo
      run: sudo rm -rf /home/ec2-user/actions-runner/_work/_tool/node/16.20.2

    • uses: actions/checkout@v4

    • name: Set up Node.js
      uses: actions/setup-node@v3
      with:
      node-version: '20'

  • Use the following commands to grant write permissions to the runner user:
    sudo chown -R ec2-user:ec2-user /home/ec2-user/actions-runner
    sudo chmod -R 755 /home/ec2-user/actions-runner

Please try this resolution and kindly let us know incase of any issues.

@aparnajyothi-y
Copy link
Contributor

Hello @orbi-ci-bot, Please update us about the resolution from your end and kindly let us know incase of any issues.

@orbi-ci-bot
Copy link

I had hoped for a solution without sudo permissions. I am already granting the permissions before running the setup step. Any idea why it doesn't have permissions automatically? Since GHA is creating the folder, it should have permissions to delete/modify it right?

@aparnajyothi-y
Copy link
Contributor

Hello @orbi-ci-bot, Thank you for the response and self-hosted runners for GitHub Actions do not automatically have the same permissions as the hosted runners because they run on the own customised infrastructure and therefore can be configured with different security and permission settings.
To grant the necessary permissions to the GitHub Actions on a self-hosted runner, need to:

  • Ensure the runner is running with a user account that has the necessary permissions.
  • Explicitly set permissions for the directories and files GHA need to access.
  • Adjust the security policies or user roles on the machine to allow the runner to perform required operations.

By properly configuring these permissions, you can ensure that your GitHub Actions workflows have the access they need to function correctly on self-hosted runners.
Please feel free to reach us in case of any further concerns.

@aparnajyothi-y
Copy link
Contributor

Hello @shuhaib-kk , @orbi-ci-bot, Please let us in know in case of any further concerns on the above information.

@aparnajyothi-y
Copy link
Contributor

Hello @shuhaib-kk, @orbi-ci-bot, Closing this issue for now as we haven't heard anything for a long time. Please feel free to reach out to us if you still have any concerns or need clarifications to reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants