Hi,
I’m trying to install and run any Java distribution on a PLCnext AXC 3152, but I can not get it to work. I want to run the AWS IoT Greengrass Core software on the controller. I do not want to run Greengrass inside a container, since I want to use it to launch other containers, which is not supported when running it as a container itself.
Goal:
My goal is to download a Java distribution and add its executables to PATH. To achieve this, I took the following steps. I used a freshly reset controller, where I only configured ntpd, for the correct system time and the controller is connected to the internet.
Steps:
-
Create a password for the root user:
sudo passwd -
Switch to the root user:
su2) Download a distribution:wget https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz3) Extract the archive:tar -xf amazon-corretto-17-x64-linux-jdk.tar.gz4) Move the archive to/usr/lib/jvm/:mv amazon-corretto-17.0.5.8.1-linux-x64 /usr/lib/jvm/5) Verify the archive is listed in the JVM folder: ls/usr/lib/jvm6) Create a new profile.d config to add the executables of the distribution to PATH:nano /etc/profile.d/java_home.sh. Content:#!/bin/sh
export JAVA_HOME=/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64
export PATH=$JAVA_HOME/bin:$PATH -
Restart controller as root:
reboot -
Execute java command as
adminuser:admin@axcf3152:~$ java --version
-sh: /usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin/java: No such file or directory
The problem and what I 've tried so farFrom the error above it seems, that as the admin user, it’s not possible to execute the java command, since the folder does not exist, but when running stat on the file, it shows that it is in fact there:
admin@axcf3152:~$ stat /usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64
File: /usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 0,21 Inode: 53799 Links: 9
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-10-25 14:17:25.375488766 +0000
Modify: 2022-10-13 05:07:51.000000000 +0000
Change: 2022-10-25 14:18:04.025766567 +0000
Birth: 2022-10-25 14:17:25.375488766 +0000
When running java --version as root we get the same error.
What I tried next was to execute the java binary directly, which does not work.
root@axcf3152:/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin# java/
-sh: java/: Not a directory
root@axcf3152:/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin# ./java
-sh: ./java: No such file or directory
root@axcf3152:/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin# sh ./java
./java: ./java: cannot execute binary file
root@axcf3152:/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin#
Running stat on the java executable, confirms that the file is executable and can be read by everyone.
root@axcf3152:/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin# stat java
File: java
Size: 12984 Blocks: 32 IO Block: 4096 regular file
Device: 179,1 Inode: 130092 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-10-25 14:17:36.848349701 +0000
Modify: 2022-10-13 05:05:56.000000000 +0000
Change: 2022-10-25 14:17:36.849349774 +0000
Birth: 2022-10-25 14:17:36.848349701 +0000
Running ldd on the java executable does not indicate, that any libraries are missing:
root@axcf3152:/usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin# ldd java
linux-vdso.so.1 (0x00007ffc1a9fd000)
libjli.so => /usr/lib/jvm/amazon-corretto-17.0.5.8.1-linux-x64/bin/./../lib/libjli.so (0x00007faf74e00000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007faf7543a000)
libdl.so.2 => /lib/libdl.so.2 (0x00007faf75435000)
libc.so.6 => /lib/libc.so.6 (0x00007faf74c00000)
/lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007faf7544a000)
A user on StackOverflow pointed out, that not being able to execute a binary could be a sign that the binary was compiled for a different architecture , but when running arch this does not seem to be the case.
root@axcf3152:~# arch
x86_64
What 's nextI’m currently trying to install binutils so that I can run readelf.
More details
So far I’ve tried the following distribution versions:
* OpenJDK 19
* Amazon Corretto 17
*
Controller Software information:
Firmware Version: 2022.6.1 (22.6.1.44)
* Hardware Version: 02
* FPGA Version: 1.1.14
Question
Did anyone manage to install and run Java on a PLCnext AXC 3152?