Exception: java.lang.UnsatisfiedLinkError: no opensearchknn_common in java.library.path

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
2.17.1 and 2.18.0

Describe the issue:
I was able to spin GCP Ubuntu x64 instance, downloaded the OpenSearch 2.17.1 and 2.18.0, disable security (for now) and run the instance without any problems. When I create the index like this:

Blockquote
PUT /image_embeddings_hnsw_768d_l2
{
“settings”: {
“index”: {
“knn”: true,
“knn.algo_param.ef_search”: 100
}
},
“mappings”: {
“properties”: {
“embedding”: {
“type”: “knn_vector”,
“dimension”: 768,
“space_type”: “l2”,
“method”: {
“name”: “hnsw”,
“engine”: “nmslib”,
“parameters”: {
“ef_construction”: 128,
“m”: 24
}
}
},
“image_id”: {
“type”: “long”
}
}
}
}

I have plenty of RAM on that instance (128GB)

Only when I run the program to insert the embeddings I got the problem with UnsatisfiedLinkError.

Configuration:

Discovery settings for single-node setup

discovery.type: single-node

Disable security plugin if not needed

plugins.security.disabled: true

Node name (optional)

node.name: node-1
http.port: 9200
network.host: 0.0.0.0
plugins.security.ssl.http.enabled: false
plugins.security.ssl.transport.enabled: false

Relevant Logs or Screenshots:

2024-11-18T16:15:57,567][ERROR][o.o.b.OpenSearchUncaughtExceptionHandler] [node-1] fatal error in thread [opensearch[node-1][generic][T#4]], exiting
java.lang.UnsatisfiedLinkError: no opensearchknn_common in java.library.path: /usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2458) ~[?:?]
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916) ~[?:?]
at java.base/java.lang.System.loadLibrary(System.java:2063) ~[?:?]
at org.opensearch.knn.jni.JNICommons.lambda$static$0(JNICommons.java:26) ~[?:?]
at java.base/java.security.AccessController.doPrivileged(AccessController.java:319) ~[?:?]
at org.opensearch.knn.jni.JNICommons.(JNICommons.java:25) ~[?:?]
at org.opensearch.knn.index.codec.transfer.OffHeapFloatVectorTransfer.transfer(OffHeapFloatVectorTransfer.java:24) ~[?:?]
at org.opensearch.knn.index.codec.transfer.OffHeapVectorTransfer.transfer(OffHeapVectorTransfer.java:57) ~[?:?]
at org.opensearch.knn.index.codec.nativeindex.DefaultIndexBuildStrategy.buildAndWriteIndex(DefaultIndexBuildStrategy.java:70) ~[?:?]
at org.opensearch.knn.index.codec.nativeindex.NativeIndexWriter.buildAndWriteIndex(NativeIndexWriter.java:154) ~[?:?]
at org.opensearch.knn.index.codec.nativeindex.NativeIndexWriter.flushIndex(NativeIndexWriter.java:111) ~[?:?]
at org.opensearch.knn.index.codec.KNN990Codec.NativeEngines990KnnVectorsWriter.trainAndIndex(NativeEngines990KnnVectorsWriter.java:265) ~[?:?]
at org.opensearch.knn.index.codec.KNN990Codec.NativeEngines990KnnVectorsWriter.flush(NativeEngines990KnnVectorsWriter.java:87) ~[?:?]
at org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat$FieldsWriter.flush(PerFieldKnnVectorsFormat.java:115) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.VectorValuesConsumer.flush(VectorValuesConsumer.java:76) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.IndexingChain.flush(IndexingChain.java:296) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:445) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:496) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.DocumentsWriter.maybeFlush(DocumentsWriter.java:450) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:643) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3683) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:4131) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4093) ~[lucene-core-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]
at org.opensearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:2672) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.engine.InternalEngine.flush(InternalEngine.java:1965) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.engine.InternalEngine.recoverFromTranslogInternal(InternalEngine.java:589) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.engine.InternalEngine.recoverFromTranslog(InternalEngine.java:546) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.engine.InternalEngine.recoverFromTranslog(InternalEngine.java:146) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.shard.IndexShard.openEngineAndRecoverFromTranslog(IndexShard.java:2525) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.shard.IndexShard.openEngineAndRecoverFromTranslog(IndexShard.java:2491) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.shard.StoreRecovery.internalRecoverFromStore(StoreRecovery.java:751) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.shard.StoreRecovery.lambda$recoverFromStore$0(StoreRecovery.java:126) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.core.action.ActionListener.completeWith(ActionListener.java:344) ~[opensearch-core-2.17.1.jar:2.17.1]
at org.opensearch.index.shard.StoreRecovery.recoverFromStore(StoreRecovery.java:124) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.index.shard.IndexShard.recoverFromStore(IndexShard.java:2902) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.action.ActionRunnable$2.doRun(ActionRunnable.java:89) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1005) ~[opensearch-2.17.1.jar:2.17.1]
at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) ~[opensearch-2.17.1.jar:2.17.1]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
fatal error in thread [opensearch[node-1][generic][T#4]], exiting
java.lang.UnsatisfiedLinkError: no opensearchknn_common in java.library.path: /usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2458)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
at java.base/java.lang.System.loadLibrary(System.java:2063)
at org.opensearch.knn.jni.JNICommons.lambda$static$0(JNICommons.java:26)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
at org.opensearch.knn.jni.JNICommons.(JNICommons.java:25)
at org.opensearch.knn.index.codec.transfer.OffHeapFloatVectorTransfer.transfer(OffHeapFloatVectorTransfer.java:24)
at org.opensearch.knn.index.codec.transfer.OffHeapVectorTransfer.transfer(OffHeapVectorTransfer.java:57)
at org.opensearch.knn.index.codec.nativeindex.DefaultIndexBuildStrategy.buildAndWriteIndex(DefaultIndexBuildStrategy.java:70)
at org.opensearch.knn.index.codec.nativeindex.NativeIndexWriter.buildAndWriteIndex(NativeIndexWriter.java:154)
at org.opensearch.knn.index.codec.nativeindex.NativeIndexWriter.flushIndex(NativeIndexWriter.java:111)
at org.opensearch.knn.index.codec.KNN990Codec.NativeEngines990KnnVectorsWriter.trainAndIndex(NativeEngines990KnnVectorsWriter.java:265)
at org.opensearch.knn.index.codec.KNN990Codec.NativeEngines990KnnVectorsWriter.flush(NativeEngines990KnnVectorsWriter.java:87)
at org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat$FieldsWriter.flush(PerFieldKnnVectorsFormat.java:115)
at org.apache.lucene.index.VectorValuesConsumer.flush(VectorValuesConsumer.java:76)
at org.apache.lucene.index.IndexingChain.flush(IndexingChain.java:296)
at org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:445)
at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:496)
at org.apache.lucene.index.DocumentsWriter.maybeFlush(DocumentsWriter.java:450)
at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:643)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3683)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:4131)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4093)
at org.opensearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:2672)
at org.opensearch.index.engine.InternalEngine.flush(InternalEngine.java:1965)
at org.opensearch.index.engine.InternalEngine.recoverFromTranslogInternal(InternalEngine.java:589)
at org.opensearch.index.engine.InternalEngine.recoverFromTranslog(InternalEngine.java:546)
at org.opensearch.index.engine.InternalEngine.recoverFromTranslog(InternalEngine.java:146)
at org.opensearch.index.shard.IndexShard.openEngineAndRecoverFromTranslog(IndexShard.java:2525)
at org.opensearch.index.shard.IndexShard.openEngineAndRecoverFromTranslog(IndexShard.java:2491)
at org.opensearch.index.shard.StoreRecovery.internalRecoverFromStore(StoreRecovery.java:751)
at org.opensearch.index.shard.StoreRecovery.lambda$recoverFromStore$0(StoreRecovery.java:126)
at org.opensearch.core.action.ActionListener.completeWith(ActionListener.java:344)
at org.opensearch.index.shard.StoreRecovery.recoverFromStore(StoreRecovery.java:124)
at org.opensearch.index.shard.IndexShard.recoverFromStore(IndexShard.java:2902)
at org.opensearch.action.ActionRunnable$2.doRun(ActionRunnable.java:89)
at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1005)
at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)