[GH-ISSUE #2374] Permission denied error when downloading Java #1091

Open
opened 2026-03-01 21:48:49 +03:00 by kerem · 4 comments
Owner

Originally created by @just-dev-creator on GitHub (Jun 21, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2374

Bug report info

act version:            0.2.63
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/justus/.config/act/actrc:
		-P ubuntu-latest=catthehacker/ubuntu:full-latest
		-P ubuntu-22.04=catthehacker/ubuntu:full-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:full-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:full-18.04
Build info:
	Go version:            go1.22.3
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-buildmode:           pie
		-compiler:            gc
		-trimpath:            true
		DefaultGODEBUG:       httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
		CGO_ENABLED:          1
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
Docker Engine:
	Engine version:        26.1.4
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Artix Linux
	OS type:               linux
	OS version:            
	OS arch:               x86_64
	OS kernel:             6.9.4-artix1-1
	OS CPU:                12
	OS memory:             15897 MB
	Security options:
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act

Describe issue

When downloading java via the setup-java@v4 action, the step fails with a permission denied error. This is no problem when running the action on GH directly.

https://github.com/just-dev-creator/etb-plugin/

Workflow content

name: Build spigot plugin
on: [push]
jobs:
  build:
    name: Build using maven
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          distribution: "adopt"
          java-version: "21"
      - name: Build using maven
        run: mvn clean package
      - uses: actions/upload-artifact@v4
        with:
          path: target/*.jar

Relevant log output

[Build spigot plugin/Build using maven]   💬  ::debug::Checking tar --version
[Build spigot plugin/Build using maven]   💬  ::debug::tar (GNU tar) 1.34%0ACopyright (C) 2021 Free Software Foundation, Inc.%0ALicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.%0AThis is free software: you are free to change and redistribute it.%0AThere is NO WARRANTY, to the extent permitted by law.%0A%0AWritten by John Gilmore and Jay Fenlason.
| [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/20e695cc-5b57-4a4e-9dfa-64ea098fec3c -f /tmp/3ebeda1e-fae6-486a-a879-df45305329f3
[Build spigot plugin/Build using maven]   💬  ::debug::Caching tool Java_Adopt_jdk 21.0.3-9.0.LTS x64
[Build spigot plugin/Build using maven]   💬  ::debug::source dir: /tmp/20e695cc-5b57-4a4e-9dfa-64ea098fec3c/jdk-21.0.3+9
[Build spigot plugin/Build using maven]   💬  ::debug::destination /opt/hostedtoolcache/Java_Adopt_jdk/21.0.3-9.0.LTS/x64
[Build spigot plugin/Build using maven]   ❗  ::error::EACCES: permission denied, mkdir '/opt/hostedtoolcache/Java_Adopt_jdk/21.0.3-9.0.LTS'
[Build spigot plugin/Build using maven]   ❌  Failure - Main actions/setup-java@v4
[Build spigot plugin/Build using maven] exitcode '1': failure
[Build spigot plugin/Build using maven] ⭐ Run Post actions/setup-java@v4
[Build spigot plugin/Build using maven]   🐳  docker exec cmd=[node /var/run/act/actions/actions-setup-java@v4/dist/cleanup/index.js] user= workdir=
[Build spigot plugin/Build using maven]   ✅  Success - Post actions/setup-java@v4
[Build spigot plugin/Build using maven] 🏁  Job failed

Additional information

No response

Originally created by @just-dev-creator on GitHub (Jun 21, 2024). Original GitHub issue: https://github.com/nektos/act/issues/2374 ### Bug report info ```plain text act version: 0.2.63 GOOS: linux GOARCH: amd64 NumCPU: 12 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/justus/.config/act/actrc: -P ubuntu-latest=catthehacker/ubuntu:full-latest -P ubuntu-22.04=catthehacker/ubuntu:full-22.04 -P ubuntu-20.04=catthehacker/ubuntu:full-20.04 -P ubuntu-18.04=catthehacker/ubuntu:full-18.04 Build info: Go version: go1.22.3 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: pie -compiler: gc -trimpath: true DefaultGODEBUG: httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1 CGO_ENABLED: 1 GOARCH: amd64 GOOS: linux GOAMD64: v1 Docker Engine: Engine version: 26.1.4 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Artix Linux OS type: linux OS version: OS arch: x86_64 OS kernel: 6.9.4-artix1-1 OS CPU: 12 OS memory: 15897 MB Security options: name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act ``` ### Describe issue When downloading java via the `setup-java@v4` action, the step fails with a permission denied error. This is no problem when running the action on GH directly. ### Link to GitHub repository https://github.com/just-dev-creator/etb-plugin/ ### Workflow content ```yml name: Build spigot plugin on: [push] jobs: build: name: Build using maven runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: "adopt" java-version: "21" - name: Build using maven run: mvn clean package - uses: actions/upload-artifact@v4 with: path: target/*.jar ``` ### Relevant log output ```sh [Build spigot plugin/Build using maven] 💬 ::debug::Checking tar --version [Build spigot plugin/Build using maven] 💬 ::debug::tar (GNU tar) 1.34%0ACopyright (C) 2021 Free Software Foundation, Inc.%0ALicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.%0AThis is free software: you are free to change and redistribute it.%0AThere is NO WARRANTY, to the extent permitted by law.%0A%0AWritten by John Gilmore and Jay Fenlason. | [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/20e695cc-5b57-4a4e-9dfa-64ea098fec3c -f /tmp/3ebeda1e-fae6-486a-a879-df45305329f3 [Build spigot plugin/Build using maven] 💬 ::debug::Caching tool Java_Adopt_jdk 21.0.3-9.0.LTS x64 [Build spigot plugin/Build using maven] 💬 ::debug::source dir: /tmp/20e695cc-5b57-4a4e-9dfa-64ea098fec3c/jdk-21.0.3+9 [Build spigot plugin/Build using maven] 💬 ::debug::destination /opt/hostedtoolcache/Java_Adopt_jdk/21.0.3-9.0.LTS/x64 [Build spigot plugin/Build using maven] ❗ ::error::EACCES: permission denied, mkdir '/opt/hostedtoolcache/Java_Adopt_jdk/21.0.3-9.0.LTS' [Build spigot plugin/Build using maven] ❌ Failure - Main actions/setup-java@v4 [Build spigot plugin/Build using maven] exitcode '1': failure [Build spigot plugin/Build using maven] ⭐ Run Post actions/setup-java@v4 [Build spigot plugin/Build using maven] 🐳 docker exec cmd=[node /var/run/act/actions/actions-setup-java@v4/dist/cleanup/index.js] user= workdir= [Build spigot plugin/Build using maven] ✅ Success - Post actions/setup-java@v4 [Build spigot plugin/Build using maven] 🏁 Job failed ``` ### Additional information _No response_
Author
Owner

@tholu commented on GitHub (Jul 16, 2024):

Seeing the same problem with Java 17. @just-dev-creator Have you found a solution?

<!-- gh-comment-id:2231602532 --> @tholu commented on GitHub (Jul 16, 2024): Seeing the same problem with Java 17. @just-dev-creator Have you found a solution?
Author
Owner

@just-dev-creator commented on GitHub (Jul 24, 2024):

Hi @tholu,
no, sadly not. In my case, I went ahead and debugged my GitHub actions in a seperate branch on GitHub (the way I did it before using act).
I'm sorry that I don't have better news for you at this point.

<!-- gh-comment-id:2248594680 --> @just-dev-creator commented on GitHub (Jul 24, 2024): Hi @tholu, no, sadly not. In my case, I went ahead and debugged my GitHub actions in a seperate branch on GitHub (the way I did it before using act). I'm sorry that I don't have better news for you at this point.
Author
Owner

@NathanDWalsh commented on GitHub (Nov 7, 2024):

Hi, I had a similar issue with Python. Check the permissions on the /opt/hostedtoolcache/Java_Adopt_jdk/ directory (in my case, the /opt/hostedtoolcache/Python/ directory), for me, owner:group was root:root. The workaround I applied was to chown this folder to runner:runneradmin. This served as a workaround as this directory and it's permissions are retained between container instances (/opt/hostedtoolcache/ mounts to a directory in docker-desktop-data.)

<!-- gh-comment-id:2461758839 --> @NathanDWalsh commented on GitHub (Nov 7, 2024): Hi, I had a similar issue with Python. Check the permissions on the /opt/hostedtoolcache/Java_Adopt_jdk/ directory (in my case, the /opt/hostedtoolcache/Python/ directory), for me, owner:group was root:root. The workaround I applied was to chown this folder to runner:runneradmin. This served as a workaround as this directory and it's permissions are retained between container instances (/opt/hostedtoolcache/ mounts to a directory in docker-desktop-data.)
Author
Owner

@dougdonohoe commented on GitHub (May 7, 2025):

I ran into this issue too, trying to upgrade from Java 17 to Java 21. The issue is related to the use of the Docker volume named act-toolcache, which act used to store download tools. My cache had Java 11 and Java 17, and had been around for several months. You can inspect what is in it via:

docker run -v act-toolcache:/opt/hostedtoolcache -it --rm catthehacker/ubuntu:runner-latest bash

$ ls -l /opt/hostedtoolcache/

I resolved this issue by deleting the act-toolcache volume (to allow it to be recreated fresh using latest images):

docker volume rm act-toolcache

This will fail if any act containers are hanging around, so you will need to delete those first.

As to the root cause? My guess is something changed in one of the tool dependencies for downloading and having an old volume was confusing it.

<!-- gh-comment-id:2859056727 --> @dougdonohoe commented on GitHub (May 7, 2025): I ran into this issue too, trying to upgrade from Java 17 to Java 21. The issue is related to the use of the Docker volume named `act-toolcache`, which `act` used to store download tools. My cache had Java 11 and Java 17, and had been around for several months. You can inspect what is in it via: ``` docker run -v act-toolcache:/opt/hostedtoolcache -it --rm catthehacker/ubuntu:runner-latest bash $ ls -l /opt/hostedtoolcache/ ``` I resolved this issue by deleting the `act-toolcache` volume (to allow it to be recreated fresh using latest images): ``` docker volume rm act-toolcache ``` This will fail if any `act` containers are hanging around, so you will need to delete those first. As to the root cause? My guess is something changed in one of the tool dependencies for downloading and having an old volume was confusing it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1091
No description provided.