Unable to install libmongocrypt for Debian

Looking for some assistance installing libmongocrypt to take advantage of Client Side Field Level Encryption. We use the mongo-go-driver and it is my understanding that this doesn’t come packaged with libmongocrypt, so we are required to install this separately.

Our version of Debian is bullseye.

I followed the install steps in the docs but I’m running into issues (see logs below).

#16 0.425 deb https://libmongocrypt.s3.amazonaws.com/apt/debian bullseye/libmongocrypt/1.8 main
#16 0.501 Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
#16 0.582 Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
#16 0.604 Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
#16 0.624 Ign:4 https://libmongocrypt.s3.amazonaws.com/apt/debian bullseye/libmongocrypt/1.8 InRelease
#16 0.718 Get:5 http://deb.debian.org/debian bullseye/main arm64 Packages [8071 kB]
#16 0.780 Get:6 https://libmongocrypt.s3.amazonaws.com/apt/debian bullseye/libmongocrypt/1.8 Release [1142 B]
#16 0.838 Get:7 https://libmongocrypt.s3.amazonaws.com/apt/debian bullseye/libmongocrypt/1.8 Release.gpg [866 B]
#16 5.579 Get:8 http://deb.debian.org/debian-security bullseye-security/main arm64 Packages [241 kB]
#16 5.707 Get:9 http://deb.debian.org/debian bullseye-updates/main arm64 Packages [14.9 kB]
#16 6.117 Fetched 8537 kB in 6s (1507 kB/s)
#16 6.117 Reading package lists...
#16 6.394 Reading package lists...
#16 6.659 Building dependency tree...
#16 6.734 Reading state information...
#16 6.784 E: Unable to locate package libmongocrypt

Is anyone able to assist me? Thanks

Hi Kevin,

Thank you for posting. This thread shows an alternative method for installing libmongocrypt that may be helpful and solved the issue for another user.



1 Like

@Kevin_Rathgeber the package name on Debian is libmongocrypt-dev (not libmongocrypt). Try using sudo apt-get install -y libmongocrypt-dev.

The documentation will be updated to fix the package name.

1 Like

@Kevin_Albertson That seems to have solved the issue but now I’m getting the following error when building:

#17 102.5 # go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:296:16: could not determine kind of name for C.mongocrypt_crypt_shared_lib_version
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:305:20: could not determine kind of name for C.mongocrypt_crypt_shared_lib_version_string
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:169:11: could not determine kind of name for C.mongocrypt_ctx_rewrap_many_datakey_init
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:263:12: could not determine kind of name for C.mongocrypt_ctx_setopt_contention_factor
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:159:11: could not determine kind of name for C.mongocrypt_ctx_setopt_key_material
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:257:12: could not determine kind of name for C.mongocrypt_ctx_setopt_query_type
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:72:3: could not determine kind of name for C.mongocrypt_setopt_append_crypt_shared_lib_search_path
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:64:3: could not determine kind of name for C.mongocrypt_setopt_bypass_query_analysis
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:404:11: could not determine kind of name for C.mongocrypt_setopt_encrypted_field_config_map
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:77:4: could not determine kind of name for C.mongocrypt_setopt_set_crypt_shared_lib_path_override
#17 102.5 /root/go/pkg/mod/go.mongodb.org/mongo-driver@v1.11.7/x/mongo/driver/mongocrypt/mongocrypt.go:81:2: could not determine kind of name for C.mongocrypt_setopt_use_need_kms_credentials_state

That error suggests the version of libmongocrypt is older than is supported by the Go driver.

I expect Go driver 1.11.7 requires libmongocrypt 1.5.2 or higher.

Try confirming the version of libmongocrypt with pkg-config:

$ pkg-config --modversion libmongocrypt

If the version of libmongocrypt shows as older, it may be due to another conflicting install of libmongocrypt. That may have happened if libmongocrypt was installed through the main package repository. Debian 11 packages libmongocrypt 1.1.0

@Kevin_Albertson Yep, it looks like it installed version 1.1.0

root@68b18b5afa62:/# pkg-config --modversion libmongocrypt

What’s the best way to get a newer version? For install, I followed these instructions you linked on another thread. Thanks!

Edit: I think I figured out my issue. I’m running this docker build locally to test but I’m on arm64 so it’s not finding the right version (since it’s amd64) and just installing the default shipped with bullseye. When I spun up a docker container with linux/amd64, it appears to have installed the correct version.

root@9b981271015b:/# pkg-config --modversion libmongocrypt

Edit 2:
So far so good, i was able to build this now that I’m on the right platform. Thanks for all the help @Kevin_Albertson and @Cynthia_Braund!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.