`service neo4j start` gets stuck in a restart loop

I installed the neo4j Debian package from the debian.neo4j.org/repo stable/ repo on Ubuntu 18.04 and, after adding my TLS certs, it ends up getting stuck in a restart loop with no indication in the logs of what's making it shutdown:

2019-03-09 23:29:12.141+0000 INFO [o.n.k.a.DatabaseAvailabilityGuard] Fulfilling of requirement 'Database available' makes database graph.db available.
2019-03-09 23:29:12.142+0000 INFO [o.n.k.a.DatabaseAvailabilityGuard] Database graph.db is ready.
2019-03-09 23:29:12.142+0000 INFO [o.n.k.i.DatabaseHealth] Database health set to OK
2019-03-09 23:29:12.470+0000 INFO [o.n.g.f.GraphDatabaseFacadeFactory] Shutting down 'graph.db' database.
2019-03-09 23:29:12.470+0000 INFO [o.n.g.f.GraphDatabaseFacadeFactory] Shutdown started

It seems to work if I simply don't add the certs, so I thought they were the issue. Obviously, I don't want to run it in production without those certs, though. :-)

However, if I spin up the DB with neo4j start instead of service neo4j start, it works just fine — lets me use use Neo4j Browser with trusted HTTPS, doesn't hit the restart loop — so I don't think the certs themselves are actually the problem. I'd prefer to use the service / systemctl interface in case the box needs to be rebooted, but I can't figure out why they work differently. Has anyone else encountered this?

Hmm perhaps a permissions issue? Can you check the ownership and permissions on the cert files?

1 Like

That appears to be what it was. The symlinks were owned by root. chown -R neo4j /var/lib/neo4j/certificates /etc/letsencrypt/live /etc/letsencrypt/archive fixed it.

It looks like what was happening was that service neo4j start starts the process as the neo4j user, but neo4j start starts the main process as the current user (in my case, I was root on the box), which is where the discrepancy came from. Thanks @michael_hunger!

Ya never use neo4j start, it's a tricky one.

In the installation manual there is the pointer to sysctl start neo4j or service neo4j start