Issue with connecting to SQLiteDB

We have some instances of SQLite DB on our Linux server where Metabase is setup.

When connecting to sqlitedb we get the following error:

java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V

Is this a known issue/error?

Hi @Rafal
Which version of Metabase?
Do you see more descriptive errors in the log?

Error:
05-01 08:26:07 INFO metabase.core :: Metabase Initialization COMPLETE
Failed to load native library:sqlite-3.21.0.1-aece0d01-de08-4307-8faa-0dfb7cb7e526-libsqlitejdbc.so. osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: /tmp/sqlite-3.21.0.1-aece0d01-de08-4307-8faa-0dfb7cb7e526-libsqlitejdbc.so: /tmp/sqlite-3.21.0.1-aece0d01-de08-4307-8faa-0dfb7cb7e526-libsqlitejdbc.so: failed to map segment from shared object: Operation not permitted
05-01 08:26:44 ERROR metabase.driver :: Failed to connect to database: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V
05-01 08:26:44 DEBUG metabase.middleware :: POST /api/database 400 (239 ms) (0 DB calls).
{:valid false, :dbname “java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V”, :message “java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V”}

05-01 08:26:44 DEBUG metabase.middleware :: GET /api/database 200 (30 ms) (4 DB calls). Jetty threads: 8/50 (4 busy, 3 idle, 0 queued)

You’re on version v0.31.2

Built on 2018-12-05

I’m not sure if there’s a bug in driver version 3.21.0.1 (which is included in Metabase 0.31.2) - it seems like some people are having issues, while it’s working for others.
https://github.com/metabase/metabase/issues?utf8=âś“&q=is%3Aissue+_open_utf8

Metabase 0.32.5 has SQLite driver 3.25.2, so I would recommend that you try the new version. Always remember to backup before trying to upgrade.

You’re on version v0.32.5

Built on 2019-04-20

05-01 09:10:12 DEBUG middleware.log :: POST /api/database 400 3 ms (0 DB calls) Jetty threads: 8/50 (4 busy, 5 idle, 0 queued) (60 total active threads)
{:valid false, :dbname “java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V”, :message “java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V”}

05-01 09:10:12 DEBUG middleware.log :: GET /api/database 200 4 ms (3 DB calls) Jetty threads: 8/50 (4 busy, 5 idle, 0 queued) (60 total active threads)

yes, went through the blog posts about the same error. It is strange but we still get the same error in the new version.

Are you using the docker or JAR-file? If JAR, which OS and Java version?
Could it be a permission issue, where the user used to execute Metabase doesn’t have enough rights to the SQLite?

I just did a quick test on 0.32.5 with a sample database and it loads:

05-01 01:26:20 INFO metabase.driver :: Initializing driver :sqlite...
05-01 01:26:20 DEBUG plugins.classloader :: Setting current thread context classloader to shared classloader clojure.lang.DynamicClassLoader@68b70470...
05-01 01:26:20 INFO plugins.classloader :: Added URL file:/opt/metabase/plugins/sqlite.metabase-driver.jar to classpath
05-01 01:26:20 DEBUG plugins.init-steps :: Loading plugin namespace metabase.driver.sqlite...
05-01 01:26:20 INFO metabase.driver :: Registered driver :sqlite (parents: :sql-jdbc) 
05-01 01:26:20 DEBUG plugins.jdbc-proxy :: Registering JDBC proxy driver for class org.sqlite.JDBC...
Load lazy loading driver :sqlite took 419 ms
05-01 01:26:21 DEBUG plugins.classloader :: Setting current thread context classloader to shared classloader clojure.lang.DynamicClassLoader@68b70470...
05-01 01:26:21 DEBUG middleware.log :: POST /api/database 200 743 ms (7 DB calls) Jetty threads: 8/50 (3 busy, 4 idle, 0 queued) (62 total active threads)
...

Do you see two files in /tmp, which should look something like this? First one is the library and second one is the lock file.

-rwxr--r-- 1 metabase metabase 1022912 May  1 01:26 sqlite-3.25.2-d7b46e47-0585-45e9-89a7-3316294cd516-libsqlitejdbc.so
-rw-r--r-- 1 metabase metabase       0 May  1 01:26 sqlite-3.25.2-d7b46e47-0585-45e9-89a7-3316294cd516-libsqlitejdbc.so.lck

EDIT:
And are you allowed to execute from /tmp? Check /etc/fstab and make sure /tmp does not have a noexec option.

OS version: Redhat
$ uname -r
3.10.0-957.5.1.el7.x86_64

java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

I tried to run it with the sample database and it gives the same error.

So you only have 1 file? Did you see the edit about have exec permissions on /tmp?

file /etc/fstab had a noexec error

Now it is removed:
/dev/mapper/rootvg-tmplv /tmp xfs nosuid,nodev 0 0

it looks like we have to reload/refresh it:

Even better - change your Java temporary directory to something other than /tmp, so you don’t have to mess with fstab - see more here:

yes, it worked! Changed the parameter of Java temp directory instead.

Thank you so much for help!

1 Like