/opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
xenhaxumus
Posts: 17
Joined: Fri Mar 09, 2018 2:51 am

/opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by xenhaxumus »

Hello, I have the following error in zimbra (/opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory) that does not allow me to make configurations with zmprov. update with upgrade and then delete obsolete packages. I have reviewed but I can not solve the error

The version is zimbra is 8.7.11.GA.1854.UBUNTU16.64 UBUNTU16_64 FOSS edition
User avatar
msquadrat
Advanced member
Advanced member
Posts: 183
Joined: Mon Oct 14, 2013 10:09 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by msquadrat »

Looks like something is very broken/misconfigured in your setup. What does the command

Code: Select all

zmlocalconfig -q | grep '^zimbra.*home ='
return?
stevekk
Posts: 8
Joined: Fri Feb 08, 2019 7:41 pm

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by stevekk »

Maybe a permissions related error? Have you tried resetting the permissions?

Regards,
Steve
xenhaxumus
Posts: 17
Joined: Fri Mar 09, 2018 2:51 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by xenhaxumus »

zmlocalconfig -q | grep '^zimbra.*home ='
zimbra_home = /opt/zimbra
zimbra_java_home = /opt/zimbra/common/lib/jvm/java
User avatar
msquadrat
Advanced member
Advanced member
Posts: 183
Joined: Mon Oct 14, 2013 10:09 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by msquadrat »

xenhaxumus wrote:zmlocalconfig -q | grep '^zimbra.*home ='
zimbra_home = /opt/zimbra
zimbra_java_home = /opt/zimbra/common/lib/jvm/java
That's very odd. The issue is that somehow zmjava tries to execude /bin/java instead of the proper Zimbra java. And the line 56 in /opt/zimbra/bin/zmjava should be

Code: Select all

exec ${zimbra_java_home}/bin/java ${java_options}
And the value of zimbra_java_home is taken from zmlocalconfig. Which returns the proper value according to your output. I am confused :-)
xenhaxumus
Posts: 17
Joined: Fri Mar 09, 2018 2:51 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by xenhaxumus »

This error:

zimbra@:~$ exec ${zimbra_java_home}/bin/java ${java_options}

-su: /bin/java: No such file or directory


I can not execute any command with zmprov. This is the error:

zmprov ma jhon@kdjdknckdnc... zimbraAccountStatus active

[] INFO: I/O exception (javax.net.ssl.SSLKeyException) caught when processing request: RSA premaster secret error
[] INFO: Retrying request
ERROR: zclient.IO_ERROR (invoke RSA premaster secret error, server: localhost) (cause: javax.net.ssl.SSLKeyException RSA premaster secret error)
[/b]

Please help, I need to perform commands with zmprov and others
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 896
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 9.0.0_P39 NETWORK Edition

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by JDunphy »

xenhaxumus wrote:This error:

zimbra@:~$ exec ${zimbra_java_home}/bin/java ${java_options}

-su: /bin/java: No such file or directory
That is odd... I would investigate that 1) you haven't changed the default shell for zimbra and 2) that .bashrc is available.

Code: Select all

% su - zimbra
%  grep -i java .bashrc
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
export JAVA_HOME
PATH=/opt/zimbra/bin:${JAVA_HOME}/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:${PATH}
% which java
~/common/lib/jvm/java/bin/java
% type java
java is /opt/zimbra/common/lib/jvm/java/bin/java
% env |grep -i java
PATH=/opt/zimbra/bin:/opt/zimbra/common/lib/jvm/java/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
Very odd that JAVA _HOME appears to be empty and /bin/java as a result is executed in your example above.

Code: Select all

% su - zimbra
% cd bin
% source zmshutil 
% zmsetvars -f
% env |grep -i java 
...
zimbra_java_home=/opt/zimbra/common/lib/jvm/java
...
Last edited by JDunphy on Thu Feb 28, 2019 3:28 pm, edited 1 time in total.
User avatar
msquadrat
Advanced member
Advanced member
Posts: 183
Joined: Mon Oct 14, 2013 10:09 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by msquadrat »

JDunphy wrote:
xenhaxumus wrote:This error:

zimbra@:~$ exec ${zimbra_java_home}/bin/java ${java_options}

-su: /bin/java: No such file or directory
That is odd... I would investigate that 1) you haven't changed the default shell for zimbra and 2) that .bashrc is available.

Code: Select all

% su - zimbra
%  grep -i java .bashrc
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
export JAVA_HOME
PATH=/opt/zimbra/bin:${JAVA_HOME}/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:${PATH}
% which java
~/common/lib/jvm/java/bin/java
% type java
java is /opt/zimbra/common/lib/jvm/java/bin/java
% env |grep -i java
PATH=/opt/zimbra/bin:/opt/zimbra/common/lib/jvm/java/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
Very odd that JAVA _HOME appears to be empty and /bin/java as a result is executed in your example above.
On top of that, I have an idea. Could you please post the output of the following two commands? Make sure you remove any passwords if they appear.

Code: Select all

bash -x $(which zmprov) exit
bash -x /opt/zimbra/bin/zmjava com.zimbra.cs.account.ProvUtil exit
xenhaxumus
Posts: 17
Joined: Fri Mar 09, 2018 2:51 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by xenhaxumus »

Hello, I will go step by step. Based on what they tell me.

I execute this command

this is the result:

zimbra@:~$ grep -i java .bashrc
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
export JAVA_HOME
PATH=/opt/zimbra/bin:${JAVA_HOME}/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:${PATH}

and

zimbra@:~$ env |grep -i java

DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
PATH=/opt/zimbra/bin:/opt/zimbra/common/lib/jvm/java/bin:/opt/zimbra/common/bin:/opt/zimbra/common/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
JAVA_HOME=/opt/zimbra/common/lib/jvm/java
J2SDKDIR=/usr/lib/jvm/java-8-oracle
J2REDIR=/usr/lib/jvm/java-8-oracle/jre

and

zimbra@:~$ bash -x $(which zmprov) exit
+ source /opt/zimbra/bin/zmshutil
++ dirname /opt/zimbra/bin/zmprov
+ exec /opt/zimbra/bin/zmjava com.zimbra.cs.account.ProvUtil exit
[] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused)
[] INFO: Retrying request
ERROR: zclient.IO_ERROR (invoke Connection refused (Connection refused), server: localhost) (cause: java.net.ConnectException Connection refused (Connection refused))

and

zimbra@:~$ bash -x /opt/zimbra/bin/zmjava com.zimbra.cs.account.ProvUtil exit
++ dirname /opt/zimbra/bin/zmjava
+ source /opt/zimbra/bin/zmshutil
+ zmsetvars -f
+ '[' x-f = x-f ']'
+ shift
+ zmlocalconfig=/opt/zimbra/bin/zmlocalconfig
+ '[' '!' -x /opt/zimbra/bin/zmlocalconfig ']'
+ export zmsetvars=true
+ zmsetvars=true
+ '[' -d /jre ']'
+ JRE_EXT_DIR=/lib/ext
+ '[' -f .hotspot_compiler ']'
+ case "`uname`" in
++ uname
+ PATHSEP=:
+ ZIMBRA_EXTENSIONS='backup clamscanner network zimbra-license zimbrahsm zimbrasync twofactorauth com_zimbra_ssdb_ephemeral_store'
+ ZIMBRA_EXT_DIR=/opt/zimbra/lib/ext-common
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/backup ']'
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/clamscanner ']'
+ ZIMBRA_EXT_DIR=/opt/zimbra/lib/ext-common:/opt/zimbra/lib/ext/clamscanner
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/network ']'
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/zimbra-license ']'
+ ZIMBRA_EXT_DIR=/opt/zimbra/lib/ext-common:/opt/zimbra/lib/ext/clamscanner:/opt/zimbra/lib/ext/zimbra-license
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/zimbrahsm ']'
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/zimbrasync ']'
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/twofactorauth ']'
+ ZIMBRA_EXT_DIR=/opt/zimbra/lib/ext-common:/opt/zimbra/lib/ext/clamscanner:/opt/zimbra/lib/ext/zimbra-license:/opt/zimbra/lib/ext/twofactorauth
+ for i in '$ZIMBRA_EXTENSIONS'
+ '[' -d /opt/zimbra/lib/ext/com_zimbra_ssdb_ephemeral_store ']'
+ ZIMBRA_EXT_DIR=/opt/zimbra/lib/ext-common:/opt/zimbra/lib/ext/clamscanner:/opt/zimbra/lib/ext/zimbra-license:/opt/zimbra/lib/ext/twofactorauth:/opt/zimbra/lib/ext/com_zimbra_ssdb_ephemeral_store
+ java_options=-XX:ErrorFile=/opt/zimbra/log
+ '[' x = x ']'
+ zimbra_zmjava_java_library_path=/opt/zimbra/lib
+ '[' x = x ']'
+ zimbra_zmjava_java_ext_dirs=/lib/ext:/opt/zimbra/lib/jars:/opt/zimbra/lib/ext-common:/opt/zimbra/lib/ext/clamscanner:/opt/zimbra/lib/ext/zimbra-license:/opt/zimbra/lib/ext/twofactorauth:/opt/zimbra/lib/ext/com_zimbra_ssdb_ephemeral_store
+ javazimbra=/opt/zimbra/common/lib/jvm/java
+ log=-XX:ErrorFile=/opt/zimbra/log
+ exec /opt/zimbra/common/lib/jvm/java/bin/java -XX:ErrorFile=/opt/zimbra/log -client -Dzimbra.home=/opt/zimbra -Djava.library.path=/opt/zimbra/lib -Djava.ext.dirs=/lib/ext:/opt/zimbra/lib/jars:/opt/zimbra/lib/ext-common:/opt/zimbra/lib/ext/clamscanner:/opt/zimbra/lib/ext/zimbra-license:/opt/zimbra/lib/ext/twofactorauth:/opt/zimbra/lib/ext/com_zimbra_ssdb_ephemeral_store com.zimbra.cs.account.ProvUtil exit
[] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused)
[] INFO: Retrying request
ERROR: zclient.IO_ERROR (invoke Connection refused (Connection refused), server: localhost) (cause: java.net.ConnectException Connection refused (Connection refused))


Thankful for the help you give me
User avatar
msquadrat
Advanced member
Advanced member
Posts: 183
Joined: Mon Oct 14, 2013 10:09 am

Re: /opt/zimbra/bin/zmjava: line 56: /bin/java: No such file or directory

Post by msquadrat »

xenhaxumus wrote:zimbra@:~$ bash -x /opt/zimbra/bin/zmjava com.zimbra.cs.account.ProvUtil exit
++ dirname /opt/zimbra/bin/zmjava
+ source /opt/zimbra/bin/zmshutil
+ zmsetvars -f
+ '[' x-f = x-f ']'
+ shift
+ zmlocalconfig=/opt/zimbra/bin/zmlocalconfig
+ '[' '!' -x /opt/zimbra/bin/zmlocalconfig ']'
+ export zmsetvars=true
+ zmsetvars=true
+ '[' -d /jre ']'
+ JRE_EXT_DIR=/lib/ext


That part is odd. The correspoding code is

Code: Select all

    zmlocalconfig="/opt/zimbra/bin/zmlocalconfig"
    if [ ! -x "${zmlocalconfig}" ]; then
        echo Error: can not find zmlocalconfig program
        exit 1
    fi

    if ! eval `${zmlocalconfig} -q -m export`; then
        echo Error: executing: ${zmlocalconfig} -q -m export
        exit 1
    fi

    export zmsetvars='true'
The -x check for /opt/zimbra/bin/zmlocalconfig is ok, else it would error out. And we've called that command by hand and it worked. So the file is executable. But then should follow the call to zmlocalconfig -q -m export which should be eval'ed and that never happens. Instead it skips right thorugh to the export zmsetvars=true. That's why in the next call it checks for /jre and /lib/ext (zimbra_java_home is unset). Something is really at odds here but I can't wrap my head around what the issue might be.
Post Reply