Permission Denied when Building on Linux
Closed this issue · 6 comments
When attempting to build a sample spring native project, I am getting this error when building on a linux machine.
[INFO] [creator] # Printing build artifacts to: /layers/paketo-buildpacks_native-image/native-image/com.****.SpringNativeDemo.build_artifacts.txt
[INFO] [creator] Removing bytecode
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to remove /workspace/BOOT-INF
[INFO] [creator] unlinkat /workspace/BOOT-INF/lib/jackson-core-2.12.4.jar: permission denied
[INFO] [creator] ERROR: failed to build: exit status 1
I followed buildpack example provided in the Spring Native Documentation here: https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/
I have attempted to use both the tiny and base paketobuildpacks/builder images with the same result.
Checklist
- I have included log output.
- The log output includes an error message.
- I have included steps for reproduction.
The first thing here, please try to build using pack
and see if you encounter the same issue.
Second, please include any image config settings from your pom.xml/build.gradle file. These can impact how the build is executed, so we need to take them into account.
Third, include your full version of Spring Boot.
Fourth, include your Linux distro & version. In case we need to try and reproduce.
Thanks
I havent had a chance to try to use the pack command yet, but the same build does work using macOS.
Heres the full pom.xml:
`
4.0.0
<groupId>com.sample.test</groupId>
<artifactId>spring-native-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>11</java.version>
<spring.boot.version>2.5.4</spring.boot.version>
<spring.native.version>0.10.3</spring.native.version>
<docker-registry.host>*.*.com</docker-registry.host>
<docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<repositories>
<repository>
<id>spring-release</id>
<name>Spring release</name>
<url>https://repo.spring.io/release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-release</id>
<name>Spring release</name>
<url>https://repo.spring.io/release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-native</artifactId>
<version>${spring.native.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-aot-maven-plugin</artifactId>
<version>${spring.native.version}</version>
<executions>
<execution>
<id>test-generate</id>
<goals>
<goal>test-generate</goal>
</goals>
</execution>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>paketobuildpacks/builder:tiny</builder>
<name>${docker-registry.host}/${project.artifactId}:latest</name>
<pullPolicy>IF_NOT_PRESENT</pullPolicy>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
<BP_NATIVE_IMAGE_BUILD_ARGUMENTS>-H:+ReportExceptionStackTraces --verbose</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
</env>
</image>
</configuration>
<executions>
<execution>
<goals>
<goal>build-image</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
`
Linux Machine Info
NAME="Ubuntu" VERSION="18.04.2 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.2 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic
OK, thanks for that detail. Please update when you have a chance to run with pack
.
It'll be something like pack build -e BP_NATIVE_IMAGE=true -e BP_NATIVE_IMAGE_BUILD_ARGUMENTS='-H:+ReportExceptionStackTraces --verbose' --pull-policy=if-not-present -B paketobuildpacks/builder:tiny -p target/your-jar-file <image-name>
.
I know that there was a similar issue with permissions, but that should be fixed in your Spring Boot version, so I don't think that's it.
[INFO] [creator] unlinkat /workspace/BOOT-INF/lib/jackson-core-2.12.4.jar: permission denied
Could you also check to see if you have anything that might impact the permissions of that file? Check the original file permissions, but also check your /tmp
directory and possibly umask settings on your machine. The build process is going to add the contents of your application JAR into the container, and it has to extract the files. I'm not 100% sure if it's using /tmp
for storage as it does this, I'd need to check into it more, but if you can check for anything that might restrict permissions to be less than 644 for files and 755 for folders, that could give us some clues.
Just following up. Did you have a chance to run the command I suggested? Did you get this issue resolved? Thanks
Sorry for the late reply, but sudden priority changes have prevented me from troubleshooting this further. Unless anyone else has reported the problem I guess you can close the issue and I can re-open it later if necessary.