setup-node icon indicating copy to clipboard operation
setup-node copied to clipboard

EACCES: permission denied

Open shuhaib-kk opened this issue 1 year ago • 7 comments

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 avatar Jun 20 '24 04:06 shuhaib-kk

Same issue here, EACCES: permission denied, mkdir '/home/circleci/_work/_tool/node/18.20.3' and I'm using actions/[email protected]

JesusRamp avatar Jul 04 '24 20:07 JesusRamp

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

orbi-ci-bot avatar Jul 05 '24 03:07 orbi-ci-bot

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

brodriguez-eb avatar Jul 05 '24 20:07 brodriguez-eb

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.

priyagupta108 avatar Jul 08 '24 05:07 priyagupta108

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.

aparnajyothi-y avatar Jul 12 '24 12:07 aparnajyothi-y

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.

orbi-ci-bot avatar Jul 16 '24 08:07 orbi-ci-bot

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 avatar Jul 18 '24 12:07 aparnajyothi-y

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

aparnajyothi-y avatar Jul 31 '24 14:07 aparnajyothi-y

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?

orbi-ci-bot avatar Aug 05 '24 04:08 orbi-ci-bot

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 avatar Aug 06 '24 05:08 aparnajyothi-y

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

aparnajyothi-y avatar Aug 21 '24 13:08 aparnajyothi-y

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.

aparnajyothi-y avatar Sep 05 '24 05:09 aparnajyothi-y