Skip to content

Image build fails on windows: Error while validating rootfs: entrypoint lacks execute permissions #9

@nachomata

Description

@nachomata

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):
Image
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)
Image
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:
Image
test is the entrypoint. The permissions are preserved (and no local information like User is stored).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions