Troubleshooting: Error Starting LogScale due to Exec permissions on /tmp

Condition or Error

LogScale fails to start, and report issues with incompatible version errors. The following may exist in the log:

2023-09-27T14:30:46.529+0300 [main] ERROR c.h.u.F.PosixFileUtilsJNAHolder -1 - Error initializing
java.lang.UnsatisfiedLinkError: /tmp/jna14786293502886134231.tmp: /tmp/jna14786293502886134231.tmp: failed to map segment from shared object
at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388) ~[?:?]
at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232) ~[?:?]

Causes

  • On some systems, the /tmp directory is mounted with the noexec option. This can cause LogScale to be unable to boot properly.

    You can verify whether your /tmp directory is mounted as noexec using this command:

    shell
    $ mount |grep /tmp

    The command will show something like this, if the directory is marked noexec:

    /tmp type ext4 (rw,noexec,noatime)

    The noexec tag prevents the operation of some of the libraries required by LogScale.

Solutions

  • For LogScale 1.111.0 and laeter, set the JVM_TMP_DIR Variable

    You must set the JVM_TMP_DIR variable within the launcher script.

    Set the JVM_TMP_DIR variable will set the temporary directory for the Java Virtual Machine. You should set this to a suitable directory on your system. The laucnher script sets this by default during execution.

  • For LogScale 1.0.0-1.110.0, set the jna.tmpdir value.

    The noexec flag prevents executable files from being run from the /tmp directory. Removing this flag is therefore not recommended.

    The solution is to create a directory on your machine that is not marked noexec, and then tell LogScale to use that for native libraries. Let's say the directory we've created is /logscale-native. You can then boot LogScale by adding the following to your configuration:

    ini
    HUMIO_OPTS="-Djna.tmpdir=/logscale-native"

    It may also be necessary to set the Java standard temporary directory, you will need to add:

    ini
    -Djava.io.tmpdir=/logscale-native

    For example:

    ini
    HUMIO_OPTS="-Djna.tmpdir=/logscale-native -Djava.io.tmpdir=/logscale-native"