Knowledge Base

neo4j-admin load causes "Not a valid Neo4j archive"

When using neo4j-admin load for loading a .dump file, following error is observerd:

$ neo4j-admin load --from=/var/lib/neo4j/neo4j.dump --database=neo4j --force --verbose
org.neo4j.cli.CommandFailedException: Not a valid Neo4j archive: /
Caused by: org.neo4j.dbms.archive.IncorrectFormat: /var/lib/neo4j/neo4j.dump
at org.neo4j.dbms.archive.Loader.openArchiveIn(
at org.neo4j.dbms.archive.Loader.load(
at org.neo4j.commandline.dbms.LoadCommand.load(
... 11 more
Caused by: Not in GZIP format

Sometimes this has nothing to do with the formatting of the .dump file as indicate by Not in GZIP format, but an OS setting interfering with a Java System property.

Java uses the System property and on most Linux flavor machines this usually defaults to /tmp. The location is a directory used by the JVM to create and store temporary files. Some system administrators when following security best practices in order to limit their attack surface, make sure that /tmp is mounted with noexec option. This option prompts the kernel to refuse to allow any code execution and or storage performed against this location.

One approach to troubleshoot:

Check if this option set. For example on a RHEL server:

$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,noexec,relatime,seclabel,size=524288k)

So on this machine /tmp is setup with noexec option.

Fix / Workaround:

Override default setting from /tmp to another location and then running neo4j-admin load.

For example:

$ export _JAVA_OPTIONS=""
$ neo4j-admin load --from=/var/lib/neo4j/neo4j.dump --database=neo4j --force
Done: 34 files, 971.0KiB processed.