Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to locate libssl.so.1.1 on Gentoo #20822

Open
Sommmmy opened this issue Aug 23, 2023 · 10 comments
Open

Failing to locate libssl.so.1.1 on Gentoo #20822

Sommmmy opened this issue Aug 23, 2023 · 10 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. team/schema Issue for team Schema. topic: openssl

Comments

@Sommmmy
Copy link

Sommmmy commented Aug 23, 2023

Bug description

The following output occurs upon invoking prisma version -v, it shows that it is finding libssl.so.1.1 via ldconfig yet seemingly loses it right after:

$ [project]/node_modules/.bin/prisma version -v
prisma:warn Prisma doesn't know which engines to download for the Linux distro "gentoo". Falling back to Prisma engines built "debian".
Please report your experience by creating an issue at https://github.com/prisma/prisma/issues so we can add your distro to the list of known supported distros.
prisma:warn Prisma doesn't know which engines to download for the Linux distro "gentoo". Falling back to Prisma engines built "debian".
Please report your experience by creating an issue at https://github.com/prisma/prisma/issues so we can add your distro to the list of known supported distros.
Error: Unable to require([project]/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node).
Prisma cannot find the required libssl system library in your system. Please install openssl-1.1.x and try again.

Details: libssl.so.1.1: cannot open shared object file: No such file or directory
at loadLibrary ([project]/node_modules/prisma/build/index.js:107672:11)
at getEngineVersion2 ([project]/node_modules/prisma/build/index.js:107685:16)
prisma : 5.2.0
@prisma/client : Not found
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : E_CANNOT_RESOLVE_VERSION (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Schema Engine : schema-engine-cli 2804dc98259d2ea960602aca6b8e7fdc03c1758f (at node_modules/@prisma/engines/schema-engine-debian-openssl-1.1.x)
Schema Wasm : @prisma/prisma-schema-wasm 5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f
Default Engines Hash : 2804dc98259d2ea960602aca6b8e7fdc03c1758f
Studio : 0.494.0

the library indeed exists:
image

prisma version:
latest, 5.2.0

openssl version:
dev-libs/openssl-1.1.1t-r1

How to reproduce

  1. Install dev-libs/openssl-1.1.1t-r1
  2. Make a project and add prisma (yarn add prisma)
  3. Run yarn prisma version -v (or yarn prisma generate)
  4. See error trying to use /usr/lib64/libssl.so.1.1 library

Expected behavior

For it to be able to use libssl.so.1.1

Prisma information

problem doesn't seem to be related to a particular project

Environment & setup

  • OS: Gentoo
  • Database: PostgreSQL
  • Node.js version: 19.5.0
  • Node package manager: Yarn 3.4.1

Prisma Version

5.2.0
@Sommmmy Sommmmy added the kind/bug A reported bug. label Aug 23, 2023
@bazuka5801
Copy link

Also having this issue

@Sommmmy
Copy link
Author

Sommmmy commented Aug 24, 2023

Issue was resolved by removing openssl 1.1 and emerging openssl 3.0, although I'm not sure if i should close it as the error message is quite deceiving (1.1.x doesn't work)

@jkomyno jkomyno added topic: openssl bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. team/schema Issue for team Schema. labels Aug 25, 2023
@Jolg42 Jolg42 added the team/client Issue for team Client. label Aug 25, 2023
@jkomyno
Copy link
Contributor

jkomyno commented Aug 25, 2023

Hey @Sommmmy, could you please run DEBUG="prisma:get-platform" npx prisma -v and report back the whole output you get? Thanks.

@Sommmmy
Copy link
Author

Sommmmy commented Aug 25, 2023

@jkomyno
In fixed state (with openssl 3):

  prisma:get-platform  Found distro info:
{
  "originalDistro": "gentoo"
} +0ms
  prisma:get-platform  Don't know any platform-specific paths for "undefined" on x64 (x86_64) +2ms
  prisma:get-platform  Falling back to "ldconfig" and other generic paths +0ms
  prisma:get-platform  Command "ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | grep -v "libssl.so.0"" successfully returned "libssl3.so
libssl.so
libssl.so.3
" +56ms
  prisma:get-platform  Found libssl.so file using "ldconfig" or other generic paths: libssl3.so
libssl.so
libssl.so.3
 +1ms
  prisma:get-platform  The parsed libssl version is: 3.0.x +2ms
prisma:warn Prisma doesn't know which engines to download for the Linux distro "gentoo". Falling back to Prisma engines built "debian".
Please report your experience by creating an issue at https://github.com/prisma/prisma/issues so we can add your distro to the list of known supported distros.
  prisma:get-platform  Found distro info:
{
  "originalDistro": "gentoo"
} +8ms
  prisma:get-platform  Don't know any platform-specific paths for "undefined" on x64 (x86_64) +0ms
  prisma:get-platform  Falling back to "ldconfig" and other generic paths +0ms
  prisma:get-platform  Command "ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | grep -v "libssl.so.0"" successfully returned "libssl3.so
libssl.so
libssl.so.3
" +46ms
  prisma:get-platform  Found libssl.so file using "ldconfig" or other generic paths: libssl3.so
libssl.so
libssl.so.3
 +0ms
  prisma:get-platform  The parsed libssl version is: 3.0.x +0ms
Environment variables loaded from .env
  prisma:get-platform  Found distro info:
{
  "originalDistro": "gentoo"
} +0ms
  prisma:get-platform  Don't know any platform-specific paths for "undefined" on x64 (x86_64) +2ms
  prisma:get-platform  Falling back to "ldconfig" and other generic paths +2ms
  prisma:get-platform  Command "ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | grep -v "libssl.so.0"" successfully returned "libssl3.so
libssl.so
libssl.so.3
" +55ms
  prisma:get-platform  Found libssl.so file using "ldconfig" or other generic paths: libssl3.so
libssl.so
libssl.so.3
 +1ms
  prisma:get-platform  The parsed libssl version is: 3.0.x +1ms
prisma:warn Prisma doesn't know which engines to download for the Linux distro "gentoo". Falling back to Prisma engines built "debian".
Please report your experience by creating an issue at https://github.com/prisma/prisma/issues so we can add your distro to the list of known supported distros.
prisma                  : 5.2.0
@prisma/client          : 5.2.0
Current platform        : debian-openssl-3.0.x
Query Engine (Node-API) : libquery-engine 2804dc98259d2ea960602aca6b8e7fdc03c1758f (at ../../node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Schema Engine           : schema-engine-cli 2804dc98259d2ea960602aca6b8e7fdc03c1758f (at ../../node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x)
Schema Wasm             : @prisma/prisma-schema-wasm 5.2.0-25.2804dc98259d2ea960602aca6b8e7fdc03c1758f
Default Engines Hash    : 2804dc98259d2ea960602aca6b8e7fdc03c1758f
Studio                  : 0.494.0

In broken state (with openssl 1.1.1)

> prisma:get-platform  Found distro info:
> {
>   "originalDistro": "gentoo"
> } +0ms
>   prisma:get-platform  Don't know any platform-specific paths for "undefined" on x64 (x86_64) +0ms
>   prisma:get-platform  Falling back to "ldconfig" and other generic paths +1ms
>   prisma:get-platform  Command "ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | grep -v "libssl.so.0"" successfully returned "[libssl3.so](https://libssl3.so/)
> [libssl.so](https://libssl.so/)
> libssl.so.1.1
> " +16ms
>   prisma:get-platform  Found [libssl.so](https://libssl.so/) file using "ldconfig" or other generic paths: [libssl3.so](https://libssl3.so/)
> [libssl.so](https://libssl.so/)
> libssl.so.1.1
>  +0ms
>   prisma:get-platform  The parsed libssl version is: 1.1.x +0ms
> prisma:warn Prisma doesn't know which engines to download for the Linux distro "gentoo". Falling back to Prisma engines built "debian".
> Please report your experience by creating an issue at https://github.com/prisma/prisma/issues so we can add your distro to the list of known supported distros.
> Error: Unable to require(`[project]node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node`).
> Prisma cannot find the required libssl system library in your system. Please install openssl-1.1.x and try again.
> 
> Details: [libssl.so](https://libssl.so/).1.1: cannot open shared object file: No such file or directory
>     at loadLibrary ([project]node_modules/prisma/build/index.js:85527:11)
>     at getEngineVersion ([project]node_modules/prisma/build/index.js:85540:16)
> prisma                  : 5.1.1
> [@prisma](https://t.me/prisma)/client          : 5.1.1
> Current platform        : debian-openssl-1.1.x
> Query Engine (Node-API) : E_CANNOT_RESOLVE_VERSION (at ../../node_modules/[@prisma](https://t.me/prisma)/engines/libquery_engine-debian-openssl-1.1.x.so.node)
> Schema Engine           : schema-engine-cli 6a3747c37ff169c90047725a05a6ef02e32ac97e (at ../../node_modules/[@prisma](https://t.me/prisma)/engines/schema-engine-debian-openssl-1.1.x)
> Schema Wasm             : [@prisma](https://t.me/prisma)/prisma-schema-wasm 5.1.1-1.6a3747c37ff169c90047725a05a6ef02e32ac97e
> Default Engines Hash    : 6a3747c37ff169c90047725a05a6ef02e32ac97e
> Studio                  : 0.492.0

@jkomyno jkomyno added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Aug 28, 2023
@aqrln
Copy link
Member

aqrln commented Aug 28, 2023

@Sommmmy thanks for the logs, could you please also post the output of ldconfig -p | grep libssl on your system? Thank you!

@Sommmmy
Copy link
Author

Sommmmy commented Aug 29, 2023

@aqrln On openssl 3 system:
libssl3.so (libc6,x86-64) => /usr/lib64/libssl3.so
libssl.so.3 (libc6,x86-64) => /usr/lib64/libssl.so.3
libssl.so (libc6,x86-64) => /usr/lib64/libssl.so
I don't have the old environment anymore, but it was libssl.so.1.1 instead of libssl.so.3, essentially something like this:
libssl3.so => /usr/lib64/libssl3.so
libssl.so => /usr/lib64/libssl.so
libssl.so.1.1 => /usr/lib64/libssl.so.1.1
which is also proven by the logs sent previously.

Also for anyone who might face this problem in future, just installing openssl 3 was not enough, I also needed to make sure there is no more so.1.1 in my system and nothing depends on it (or it will get auto-preserved by gentoo), as it was detected as the openssl version even with v3 being the installed version.

@markbugatti
Copy link

markbugatti commented Dec 16, 2023

@Sommmmy looks similar to issue #20686. But here is more advanced fixes that helped me

  1. Add binary targets to schema.prisma file:
generator client {
  provider = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}
  1. install openssl on image. I used debian (find how install this package to Gentoo), so the command was next:
    apt update && apt install openssl
  2. make sure that openssl version in binary target debian-openssl-3.0.x is the same as you installed to your image/linux. In my case it was 3.0.0
  3. Regenerate prisma stuff:
    npx prisma generate

I applied these changes in my docker file and it helped:

...
RUN apt update
RUN apt install openssl -y
...
RUN npx prisma generate
...

@henil0604
Copy link

I had similar issue when using node:20-slim as base image in Dockerfile. Previously i was using node:20-alpine and there was no issue. I think the slim version does not include openssl by default.

@Jolg42
Copy link
Member

Jolg42 commented Jan 22, 2024

@henil0604 indeed, see nodejs/docker-node#1919
What would help in that case is what we mention since 4.16.0:

Please manually install OpenSSL via apt-get update -y && apt-get install -y openssl and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.

@navicstein
Copy link

also having this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. team/schema Issue for team Schema. topic: openssl
Projects
None yet
Development

No branches or pull requests

8 participants