error with raspberrypi4-64-ubuntu Image

Hi Team,

Just few days before I started looking on the balena and I am very much like this concept.

I installed the open balena in my server(vps) and installed a Java application on my raspberry-4. I could successfully deploy application in my RPi. When the application started I am blinking an LED bulb which is attached to the Pi. So I used Pi4J lib for controlling the GPIO ports. This is worked in Raspbian OS before. But when I deployed in balena I am getting the exception like “java.lang.UnsatisfiedLinkError: ‘int com.pi4j.wiringpi.Gpio.wiringPiSetup()’” because another exception throwing before this which is “ERROR com.pi4j.util.NativeLibraryLoader - Unable to load [] using path: [/lib/raspberrypi/dynamic/]”

I think this is because of the missing of “wiringpi”. I installed it in the image,but still getting the same exception. I pasted the content of Dockerfile below. Please verify I am not sure I followed the correct steps.

For Raspbian the wiringpi is already installed. In this case I used the base image “balenalib/raspberrypi4-64-ubuntu-openjdk:11”.

My question is, Can I use any image with raspbian os which works in the Balena Engine?

If it is NOT, any solution for this issue?


FROM maven:3.5-jdk-8-alpine AS build
RUN apk update
RUN apk add --no-cache git
ADD settings.xml /root/.m2/settings.xml
COPY . /build
RUN mvn -f /build/pom.xml clean package -DskipTests

FROM balenalib/raspberrypi4-64-ubuntu-openjdk:11
RUN apt-get update && apt-get install -y git && apt-get install -y build-essential
RUN git clone wiringpi && cd wiringpi && git checkout tags/final_official_2.50 && ./build
RUN cd …
RUN apt-get install -y maven
RUN git clone pi4j && cd pi4j && mvn clean install

#RUN gpio -v
WORKDIR my-device
COPY --from=build /build/target/my-device-1.0.jar my-device.jar
ENTRYPOINT [“java”, “-jar”, “my-device.jar”]

Thanks & Regards
Anoop John

Hi there,

I think the first place to start is to dive into the Balena base images documentation here:

Looking at your dockerfile I would advice for installing packages you should use RUN install_packages if possible. docs here The install_packages command does some nice things regarding retry logic.

Also it looks like the second FROM line should be: FROM balenalib/raspberrypi4-64-ubuntu-openjdk:11-jdk or FROM balenalib/raspberrypi4-64-ubuntu-openjdk:11-jre

Let me know if changing those things help you further