checkout: Error: File was unable to be removed Error: EACCES: permission denied, rmdir '/opt/actions-runner/_work/...

When I run checout second+ times I have error like this on the title on my ubuntu self-hosted runner. A config is very simple like

on:
  push:
    branches: [ "production", "developing" ]
  pull_request:
    branches: [ "production", "developing" ]
  workflow_dispatch:

env:
  IMAGE_NAME: ${{ github.repository }}

jobs:
  testing:
    runs-on: self-hosted

    permissions:
      contents: write

    steps:
      - uses: actions/checkout@v4

      - uses: hoverkraft-tech/compose-action@v1.5.1
        with:
          up-flags: "--build"
      - name: testing
        run: "docker compose exec app pytest"
...

This command can help, but just once. After on the next running of job I see the same errors:

sudo chmod -R u+w /opt/actions-runner/_work/
sudo chown -R <username>:<group> /opt/actions-runner/_work/

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 23
  • Comments: 17

Commits related to this issue

Most upvoted comments

The only way I have been able to resolve this issue when installing the service as non-root was to:

  • Add the actions-runner user to the Docker group.
  • Update /etc/subuid and /etc/subgid to map the actions-runner UID and GID correctly.
  • Configure Docker’s daemon to use user namespace remapping with the actions-runner user.

Also getting this issue. I’m using this workaround with some success.

- uses: actions/checkout@v4
   with:
     path: ${{ github.sha }}

This worked for one of our pipelines that had two jobs running on a single self hosted server runner. The first job always succeeded but the second job would fail until we added path: ${{ github.sha }}

Also getting this issue. I’m using this workaround with some success.

- uses: actions/checkout@v4
   with:
     path: ${{ github.sha }}

I faced same issue. But the following code resolve this issue:

./svc.sh install root

sudo ./svc.sh start

(please uninstall existing service, first)

@seniordev-ca Nothing better than this yet

This command can help, but just once. After on the next running of job I see the same errors:

sudo chmod -R u+w /opt/actions-runner/_work/ sudo chown -R <username>:<group> /opt/actions-runner/_work/