Remove the /etc/default/opennms from Debian/Ubuntu installs
Description
Acceptance / Success Criteria
is triggering
Lucidchart Diagrams
Activity
Benjamin Reed July 31, 2019 at 2:24 PM
It occurs to me we can detect JDK vs JRE just by looking for javac in $JAVA_HOME. Simplifies things a lot.
Ronny Trommer July 25, 2019 at 8:58 AMEdited
I did a plain install from stable 24.1.2 from our Debian packages with the procedure from here.
The problematic step is systemctl start opennms
which throws the following error message:
Job for opennms.service failed because the control process exited with error code.
See "systemctl status opennms.service" and "journalctl -xe" for details.
Getting the error message details with journalctl -u opennms
gives me the following:
root@debian:/usr/share/opennms# journalctl -u opennms
-- Logs begin at Wed 2019-07-24 02:14:13 EDT, end at Thu 2019-07-25 04:45:14 EDT. --
Jul 25 04:45:14 debian systemd[1]: Starting LSB: OpenNMS - Open Source Network Management System...
Jul 25 04:45:14 debian opennms[12498]: $JAVA_HOME is not set. Set it in /etc/default/opennms or run `/usr/share/opennms/bin/runjava -s` to autoconfigure.
Jul 25 04:45:14 debian systemd[1]: opennms.service: Control process exited, code=exited, status=1/FAILURE
Jul 25 04:45:14 debian systemd[1]: opennms.service: Failed with result 'exit-code'.
Jul 25 04:45:14 debian systemd[1]: Failed to start LSB: OpenNMS - Open Source Network Management System.
We use a legacy LSB script to start OpenNMS with systemd in /etc/init.d/opennms
. I've set it to debug with set -x
and gives the following output:
Jul 25 04:50:35 debian systemd[1]: Starting LSB: OpenNMS - Open Source Network Management System...
Jul 25 04:50:35 debian opennms[12592]: + [ -f /etc/default/opennms ]
Jul 25 04:50:35 debian opennms[12592]: + . /etc/default/opennms
Jul 25 04:50:35 debian opennms[12592]: + [ -z ]
Jul 25 04:50:35 debian opennms[12592]: + find /usr/lib/jvm/java-1.11.0-openjdk-amd64 /usr/lib/jvm/java-11-openjdk-amd64 /usr/lib/jvm/openjdk-11 -maxdepth 0 -type d
Jul 25 04:50:35 debian opennms[12592]: + grep -E java-(8|11)
Jul 25 04:50:35 debian opennms[12592]: + sort -u -r
Jul 25 04:50:35 debian opennms[12592]: + [ -d /usr/lib/jvm/java-11-openjdk-amd64 -a -f /usr/lib/jvm/java-11-openjdk-amd64/lib/tools.jar ]
Jul 25 04:50:35 debian opennms[12592]: + [ -z ]
Jul 25 04:50:35 debian opennms[12592]: + echo $JAVA_HOME is not set. Set it in /etc/default/opennms or run `/usr/share/opennms/bin/runjava -s` to autoconfigure.
Jul 25 04:50:35 debian opennms[12592]: $JAVA_HOME is not set. Set it in /etc/default/opennms or run `/usr/share/opennms/bin/runjava -s` to autoconfigure.
Jul 25 04:50:35 debian opennms[12592]: + exit 1
Jul 25 04:50:35 debian systemd[1]: opennms.service: Control process exited, code=exited, status=1/FAILURE
Jul 25 04:50:35 debian systemd[1]: opennms.service: Failed with result 'exit-code'.
Jul 25 04:50:35 debian systemd[1]: Failed to start LSB: OpenNMS - Open Source Network Management System.
The problematic part seems to be the test for the tools.jar
which doesn't exist anymore since Java 9. Running with Java 9 onwards will not set JAVA_HOME and will fail this test and falls back to rely on /etc/default/opennms
.
Benjamin Reed July 24, 2019 at 9:25 PM
I'm confused how this would happen, as we explicitly remove that stuff in the post-installation on configure:
# NEVER override JAVA_HOME in /etc/default/opennms, let java.conf do its job
( grep -v JAVA_HOME /etc/default/opennms || : ) > /etc/default/opennms.new
mv /etc/default/opennms.new /etc/default/opennms
# try to detect java if possible
if [ ! -e /etc/opennms/java.conf ]; then
/usr/share/opennms/bin/runjava -s || :
fi
Can you describe more specifically what's happening? Is java.conf
not getting created? Is JAVA_HOME
being set in /etc/default/opennms
after the fact despite this code to remove it?
Details
Assignee
Benjamin ReedBenjamin ReedReporter
Ronny TrommerRonny TrommerComponents
Sprint
NoneFix versions
Affects versions
Priority
Major
Details
Details
Assignee
Reporter
Components
Sprint
Fix versions
Affects versions
Priority
PagerDuty
PagerDuty Incident
PagerDuty
PagerDuty Incident
PagerDuty

When installing OpenNMS on Ubuntu/Debian the file
/etc/default/opennms
is required to be set manually to set toJAVA_HOME=/path/to/java-home
. The way to set the Java environment is done by${OPENNMS_HOME}/bin/runjava
which sets the used Java version in${OPENNMS_HOME}/etc/java.conf
.