fork/exec /usr/bin/java: no such file or directory

1,755 views
Skip to first unread message

Roman Ivanov

unread,
Oct 21, 2015, 10:33:00 AM10/21/15
to Nomad
Got this message trying to start jar
[ERR] client: failed to start task 'stats' for alloc '5c68008d-4dc2-3ebd-1b78-8df418499de7': failed to start source: Failed to execute user command: Error starting user command: fork/exec /usr/bin/java: no such file or directory

from agent start log:
[DEBUG] client: available drivers [docker exec java]

[ec2-user@ip ~]$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[ec2-user@ip ~]$ which java
/usr/bin/java
[ec2-user@ip ~]$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 окт 21 14:08 /usr/bin/java -> /etc/alternatives/java

job file:
task "stats" {
driver = "java"

config {
jar_source = "http://path/to/stats.jar"
args = ""
}
driver.java.version = "1.8.0_45"

Michael Fischer

unread,
Oct 21, 2015, 10:34:15 AM10/21/15
to Roman Ivanov, Nomad
/etc/alternatives/java is probably a symlink too, which might not be pointing to a real binary.  Try:

ls -L /usr/bin/java

--Michael

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/cf17cd2a-5b10-4265-b0a6-98b7c5e4e0fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Fischer

unread,
Oct 21, 2015, 10:35:25 AM10/21/15
to Roman Ivanov, Nomad
Err, never mind.  Read that too fast.  Sorry!

Alex Dadgar

unread,
Oct 21, 2015, 4:50:43 PM10/21/15
to Michael Fischer, Roman Ivanov, Nomad
Hey would you mind describing your environment? On Linux we enter a chroot which may be causing the problems but even that should be following symlinks.

Thanks,
Alex

Roman Ivanov

unread,
Oct 22, 2015, 2:45:28 AM10/22/15
to Nomad
I am running Amazon Linux.

Nomad is failing to start jar with this bug when using oracle jdk:
[ec2-user@ip ~]$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 окт 21 14:08 /usr/bin/java -> /etc/alternatives/java
[ec2-user@ip ~]$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 34 окт 21 14:08 /etc/alternatives/java -> /usr/java/jdk1.8.0_45/jre/bin/java
[ec2-user@ip ~]$ ls -l /usr/java/jdk1.8.0_45/jre/bin/java
-rwxr-xr-x 1 root root 7734 апр 10  2015 /usr/java/jdk1.8.0_45/jre/bin/java

I also tried to set /usr/bin/java as direct symlink to /usr/java/jdk1.8.0_45/jre/bin/java. That does not help. Got the same fork error.

Switching to openjdk gives another error:
[ERR] client: failed to complete task 'stats' for alloc '60c23451-078e-92bf-baee-e44b8543523a': 1 error(s) occurred:
* Wait failed on pid 6905: exit status 1

openjdk:
[ec2-user@ip ~]$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 окт 22 06:30 /usr/bin/java -> /etc/alternatives/java
[ec2-user@ip ~]$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 46 окт 22 06:30 /etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

At the same time I can run this jar from command line using both idk:
java -jar stats.jar

Q: Is there any way to see stdout and stderr of the java process running by nomad?

Thanks,
Roman.

среда, 21 октября 2015 г., 23:50:43 UTC+3 пользователь Alex Dadgar написал:

Roman Ivanov

unread,
Oct 23, 2015, 4:21:23 AM10/23/15
to Nomad
So, no issues to run jar outside of nomad, but

With oracle jdk
[ERR] client: failed to start task 'stats' for alloc '348bc36a-29ab-7c2c-0005-350d8b1be0a9': failed to start source: Failed to execute user command: Error starting user command: fork/exec /usr/bin/java: no such file or directory

With java-1.8.0-openjdk-1.8.0.51
# cat stats.stderr
Error: dl failure on line 893
Error: failed /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-1.b16.6.amzn1.x86_64/jre/lib/amd64/server/libjvm.so, because libstdc++.so.6: cannot open shared object file: No such file or directory


четверг, 22 октября 2015 г., 9:45:28 UTC+3 пользователь Roman Ivanov написал:

Alex Dadgar

unread,
Oct 23, 2015, 1:05:46 PM10/23/15
to Nomad
Okay this is definitely an issue with the chroot. Would you mind filing a bug with these details? If you are running a publicly available AMI could you add that too so hopefully we can reproduce it! 

Thanks,
Alex

Roman Ivanov

unread,
Oct 24, 2015, 4:53:43 AM10/24/15
to Nomad
Reply all
Reply to author
Forward
0 new messages