Unable to run jshell on an x86-64 container image of OL 8.6 x86_64 running on rancher desktop in a m1 macbook pro using macOS 12.6
Steps to reproduce:
1) Install and configure rancher desktop on an m1 mac system.
2) Run a docker image requesting the x86_64 versions. e.g. The latest JDK version from oracle container registry, be sure to request a shell since the default application is jshell. If you fail to request a shell you will see the error but won't be able to test that the rest of the image works.
docker run --platform linux/amd64 --rm -it container-registry.oracle.com/java/jdk:latest /bin/bash
3) verify that you are using an x86-64 image.
[root@069da1114c35 /]# uname -m
x86_64
4)Verify that "java" works, in the current image using JDK 19.0.1
[root@395155b452c3 /]# java --version
java 19.0.1 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing
5) attempt to run jshell and you get the error:
[root@395155b452c3 /]# jshell
Oct 27, 2022 4:49:24 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
Launching JShell execution engine threw: FailOverExecutionControlProvider: FAILED: 0:jdi:hostname(127.0.0.1) --
Exception: java.lang.InternalError: Failed remote listen: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 84, exit value: 1 @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=44079, localAddress=localAddress=127.0.0.1}
jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:199)
jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:111)
jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
cause: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 84, exit value: 1
FailOverExecutionControlProvider: FAILED: 1:jdi:launch(true) --
Exception: java.lang.InternalError: Failed remote launch: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 88, exit value: 1 @ com.sun.jdi.CommandLineLaunch (defaults: home=/usr/java/jdk-19, options=, main=, suspend=true, quote=", vmexec=java, includevirtualthreads=n) -- {home=home=/usr/java/jdk-19, options=options=, main=main=jdk.jshell.execution.RemoteExecutionControl 39457, suspend=suspend=true, quote=quote=", vmexec=vmexec=java, includevirtualthreads=includevirtualthreads=n}
jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
jdk.jshell/jdk.jshell.execution.JdiInitiator.launchTarget(JdiInitiator.java:141)
jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:110)
jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
cause: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 88, exit value: 1
FailOverExecutionControlProvider: FAILED: 2:jdi --
Exception: java.lang.InternalError: Failed remote listen: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 91, exit value: 1 @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=36547, localAddress=localAddress=}
jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:199)
jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:111)
jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
cause: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 91, exit value: 1
The same image, with the same command to launch it, worked fine when using docker dekstop but I can no longer reproduce that as I have recently removed docker dekstop from my system.
Steps to reproduce:
1) Install and configure rancher desktop on an m1 mac system.
2) Run a docker image requesting the x86_64 versions. e.g. The latest JDK version from oracle container registry, be sure to request a shell since the default application is jshell. If you fail to request a shell you will see the error but won't be able to test that the rest of the image works.
docker run --platform linux/amd64 --rm -it container-registry.oracle.com/java/jdk:latest /bin/bash
3) verify that you are using an x86-64 image.
[root@069da1114c35 /]# uname -m
x86_64
4)Verify that "java" works, in the current image using JDK 19.0.1
[root@395155b452c3 /]# java --version
java 19.0.1 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing
5) attempt to run jshell and you get the error:
[root@395155b452c3 /]# jshell
Oct 27, 2022 4:49:24 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
Launching JShell execution engine threw: FailOverExecutionControlProvider: FAILED: 0:jdi:hostname(127.0.0.1) --
Exception: java.lang.InternalError: Failed remote listen: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 84, exit value: 1 @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=44079, localAddress=localAddress=127.0.0.1}
jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:199)
jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:111)
jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
cause: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 84, exit value: 1
FailOverExecutionControlProvider: FAILED: 1:jdi:launch(true) --
Exception: java.lang.InternalError: Failed remote launch: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 88, exit value: 1 @ com.sun.jdi.CommandLineLaunch (defaults: home=/usr/java/jdk-19, options=, main=, suspend=true, quote=", vmexec=java, includevirtualthreads=n) -- {home=home=/usr/java/jdk-19, options=options=, main=main=jdk.jshell.execution.RemoteExecutionControl 39457, suspend=suspend=true, quote=quote=", vmexec=vmexec=java, includevirtualthreads=includevirtualthreads=n}
jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
jdk.jshell/jdk.jshell.execution.JdiInitiator.launchTarget(JdiInitiator.java:141)
jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:110)
jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
cause: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 88, exit value: 1
FailOverExecutionControlProvider: FAILED: 2:jdi --
Exception: java.lang.InternalError: Failed remote listen: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 91, exit value: 1 @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=36547, localAddress=localAddress=}
jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:199)
jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:111)
jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
cause: java.io.IOException: Cannot run program "/usr/java/jdk-19/bin/java": error=0, Failed to exec spawn helper: pid: 91, exit value: 1
The same image, with the same command to launch it, worked fine when using docker dekstop but I can no longer reproduce that as I have recently removed docker dekstop from my system.