Ubuntu 18: /install -dis fail

Try to work with openNMS compiled from sources (from git today, last commit: 0f5514764275b985f7489043ae0c0a8892840ff8 (HEAD -> develop, origin/develop, origin/HEAD)

Merge: 5b331db8e6a 248bd6e3383
Author: Atlassian Bamboo <bamboo@opennms.org>
Date:   Sat Jan 4 10:28:49 2020 -0500

    [bamboo] Automated branch merge (from release-25.1.2:248bd6e33833e69c4640defe595bc28d78e658d1)
========================================================

compilation completed successfully, java configure also done without errors, but  initialize/update of database failed:

==============================================================================
OpenNMS Installer
==============================================================================

Configures PostgreSQL tables, users, and other miscellaneous settings.

DEBUG: Platform is IPv6 ready: true
- searching for libjicmp.so:
  - trying to load /usr/lib/jni/libjicmp.so: OK
- searching for libjicmp6.so:
  - trying to load /usr/lib/jni/libjicmp6.so: OK
- searching for libjrrd.so:
  - trying to load /usr/lib/jni/libjrrd.so: OK
- searching for libjrrd2.so:
  - trying to load /usr/lib/jni/libjrrd2.so: OK
17:37:58.086 [Main] WARN  org.opennms.install.Installer - Could not create file: /home/george_z/src/opennms/target/opennms-26.0.0-SNAPSHOT/etc/libraries.properties
- using SQL directory... /home/george_z/src/opennms/target/opennms-26.0.0-SNAPSHOT/etc
- using create.sql... /home/george_z/src/opennms/target/opennms-26.0.0-SNAPSHOT/etc/create.sql
* using 'postgres' as the PostgreSQL user for OpenNMS
* using 'opennms' as the PostgreSQL database name for OpenNMS
- checking if database "opennms" is unicode... ALREADY UNICODE
- checking if time of database "opennms" is matching system time... OK
- Checking for old import files in /home/george_z/src/opennms/target/opennms-26.0.0-SNAPSHOT/etc... DONE
- Running migration for changelog: URL [jar:file:/home/george_z/src/opennms/target/opennms-26.0.0-SNAPSHOT/lib/org.opennms.core.schema-26.0.0-SNAPSHOT-liquibase.jar!/changelog.xml]
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.opennms.bootstrap.Bootstrap$4.run(Bootstrap.java:527)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.opennms.core.schema.MigrationException: unable to migrate the database
	at org.opennms.core.schema.Migrator.migrate(Migrator.java:457)
	at org.opennms.install.Installer.install(Installer.java:276)
	at org.opennms.install.Installer.main(Installer.java:995)
	... 6 more
Caused by: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:289)
	at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:207)
	at liquibase.Liquibase.update(Liquibase.java:184)
	at liquibase.Liquibase.update(Liquibase.java:179)
	at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353)
	at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:305)
	at org.opennms.core.schema.Migrator.migrate(Migrator.java:455)
	... 8 more
Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at liquibase.lockservice.StandardLockService.isDatabaseChangeLogLockTableInitialized(StandardLockService.java:173)
	at liquibase.lockservice.StandardLockService.init(StandardLockService.java:121)
	at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:246)
	... 14 more
Caused by: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:70)
	at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:138)
	at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:146)
	at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:154)
	at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:169)
	at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:190)
	at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:185)
	at liquibase.lockservice.StandardLockService.isDatabaseChangeLogLockTableInitialized(StandardLockService.java:162)
	... 16 more
Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
	at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224)
	at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatement(JdbcExecutor.java:419)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
	... 23 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "databasechangeloglock" already exists
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:125)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:109)
	at liquibase.lockservice.StandardLockService.init(StandardLockService.java:97)
	... 15 more

Any ideas?
Please, please assist!!!

Regards,
Alex

Welcome @AlexF in and first of all congratulations to get the achievement unlocked compiling OpenNMS from source :slight_smile:

The first thing I noted is, you build from the branch develop which is the latest 26.0.0-SNAPSHOT and will become Horizon 26.0.0 in the future.

When we do changes in an earlier release branch we merge these commits forward to the development branch. If you want to build 25.1.2 from source you have to switch to the release-25.1.2 branch. You find some hints to get started in our project Community Welcome Guide.

Ok nevertheless, you’ve built 26.0.0-SNAPSHOT, you should be able to initialize the database. So what happens when you run ./install -dis. It tries to do the following things related to PostgreSQL:

  • Create the database and initialize the schema if it not exist, this why you need to add administrative credentials in your opennms-datasources.xml.
  • Updates and migrates database when you do an update

To make sure the database initialization works, I would do the following things:

  • Drop the opennms database
  • Ensure you have set up PostgreSQL the same way as described in our installation guide (verify on your distribution, it varies a little if you run on Ubuntu/Debian).
  • Ensure your credentials are correct in your opennms-datasources.xml and try to recreate the database schema.

In hope, this helps.