Image build fails on windows: Error while validating rootfs: entrypoint lacks execute permissions
@aegagros is already working on this.
Since Apr 29, 2025.
- Dominant language
- Go
- Stars
- 29
- Forks
- 12
- Avg merge
- 19h 37m
- Merged PRs (30d)
- 2
Description
When executing corteca build on Windows with the build output set to rootfs, the command fails with the following error:
Error while validating rootfs: entrypoint lacks execute permissions: C:\Users\<user>\AppData\Local\Temp\<tmp dir>\rootfs\bin\<entrypoint>
This issue seems to be caused by this line, where the Docker output is set to type=local. On Windows, when using this output type, file permissions are lost because Windows and Unix handle file permissions differently.
As a result, the validation step fails when checking for the executable bit on the entrypoint inside the rootfs.
In version 31.1.0, I was able to work around this by changing the Docker output type to tar and then adjusting the way that the .tar.gz archive was created. However, in version 32.0.0, validation for the tarball was added, meaning additional changes are needed to fix it - modifying the validation to check permissions directly within the .tar file without extracting it.
The same error also occurs when using the --rootfs <rootfs.tar.gz path> option, because in this line, the tarball is extracted, again causing the loss of permissions.
Since switching from local to tar output is a significant change and may have broader implications, I'm opening this issue to discuss potential alternatives rather than submitting a (not fully tested) pull request right away.
Tar generated with version 32.0.0 on Linux (WSL):
test is the entrypoint. The image is generated successfully. (Local information like User and Group is present, not sure if this is desirable)
Tar generated with version 31.1.0 on windows (on version 32.0.0 it fails before generating it as explained)
test is the entrypoint. We can see that the permissions are lost. Additionally the symbolic links will not work because of the use of \ instead of /. This can be solved changing this line, but since the proposed solution is to directly generate the tarball with Docker, this issue will be fixed too.
Tar generated with version 31.1.0 on windows with the (not fully tested) quick fix:
test is the entrypoint. The permissions are preserved (and no local information like User is stored).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.