Ubuntu nodejs package isn't ABI compatible with mainline nodejs.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nodejs (Debian) |
Fix Released
|
Unknown
|
|||
nodejs (Ubuntu) |
Fix Released
|
Medium
|
Dan Streetman | ||
Trusty |
Invalid
|
Undecided
|
Unassigned | ||
Xenial |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Dan Streetman | ||
Cosmic |
Fix Released
|
Medium
|
Dan Streetman |
Bug Description
[impact]
Pre-built addons for nodejs built against the 8.10 version, which is what is included in Bionic, will fail to load on Bionic because the version of nodejs there is built using a newer ABI-incompatible openssl version.
[test case]
1. Run 'sudo apt install nodejs npm'
2. Run 'mkdir /tmp/lp.1779863'
3. Run 'cd /tmp/lp.1779863'
4. Run 'npm install grpc'
5. Note that it mentions installing a prebuilt binary from remote.
6. Run 'node' and enter the following code:
> const grpc = require('grpc')
> const creds = grpc.ServerCred
> const server = new grpc.Server()
> server.
7. Observe that this results in a crash, with an error like:
node: symbol lookup error:
/tmp/lp.
undefined symbol: SSL_library_init
8. Run 'npm install node-webcrypto-
9. Observe that compilation fails due to a header expectation mismatch.
10. Install nodejs from -proposed.
11. Repeat steps 6-9 and observe that the commands succeed without errors.
[regression potential]
Although this SRU changes the ABI of nodejs that is exposed to binary add-ons, the practical regression potential for this ABI change is minimal. The archive has been scanned to confirm there are no reverse-
Thus, the greatest risk of regression is from someone manually working around this gyp incompatibility in order to build an add-on which uses these symbols. This risk is negligible.
Changing this to use openssl1.0 assumes that the security team will maintain security patches for openssl1.0.
There is no risk of regression in protocol compatibility by switching back from openssl 1.1 to openssl 1.0, because TLS 1.3 support has not yet landed in the openssl package in 18.04.
[other info]
alternately, this could be fixed by upgrading the nodejs package in Bionic (and Cosmic) to a newer nodejs - Debian has version 10.4.0 in experimental.
also debian 904274 has quite a bit of discussion.
original bug description below.
---
Background:
NodeJS has a native extension API: https:/
It's fairly understood by developers that NodeJS's ABI is stable, and that one module built using a version of nodejs should work on another semantically version compatible of nodejs.
NodeJS exposes various third party libraries to the native module developers. Quote from the addons developers page: "Node.js includes a number of other statically linked libraries including OpenSSL. These other libraries are located in the deps/ directory in the Node.js source tree. Only the libuv,i OpenSSL, V8 and zlib symbols are purposefully re-exported by Node.js and may be used to various extents by Addons."
It's fairly understood by developers that native modules have the same ABI guarantee than the rest of the node API.
The NodeJS ecosystem uses native modules extensively, and it's fairly common for developers to publish precompiled versions of their extensions so that the typical end-user can simply npm install their dependencies without worrying about having a compiler installed. Some packages will do their own thing (see for instance https:/
Problem with the Ubuntu nodejs package:
Put simply, it breaks prebuilt packages that depend on OpenSSL. NodeJS 8.10.0 officially comes with OpenSSL 1.0.2n, while the NodeJS 8.10.0 that comes with the Ubuntu package exposes OpenSSL 1.1.0g.
Since there are ABI breakages between OpenSSL 1.0.2 and 1.1.0, these ABI breakages are bubbling up to any prebuilt native addon.
Here is an example:
https:/
If you build this package under the mainline nodejs, it will try to import the following symbols from OpenSSL 1.0.2:
. SSL_library_init
. SSLeay_version
Whereas if you build it under Ubuntu's nodejs, it will try to import the following symbols instead from OpenSSL 1.1.0:
. OPENSSL_init_ssl
. OpenSSL_version
Therefore, trying to load one prebuilt module from one version of the runtime to another will result in a symbol loading error:
node: symbol lookup error: /home/pixel/
Incidentally, nodejs 10.5.0 uses OpenSSL 1.1.0h, and compiling the same demo module with this version of node will try to import the proper symbols. Obviously, since the module will be built for the wrong version of the nodejs runtime, it won't load, but the SSL symbols are now proper.
This creates weird bug reports for nodejs extension developers, such as https:/
Another example is uws. Trying to use uws in ubuntu's nodejs will result in the same sort of failures. Which means there are at least two packages available out there that are affected by this issue.
I don't think this is easily solvable, and all of my suggestions for fixing it have severe cons. Ubuntu won't want to downgrade their system's OpenSSL for this. Maybe there's a way to get another openssl package for 1.0.2, and have the nodejs runtime for Ubuntu depend on it. Another possible solution would be to radically upgrade nodejs to 10, so that the ABI of OpenSSL will then match properly. But this may be viewed as a too radical upgrade.
One sort of mitigation option would be to get node-pre-gyp and prebuild to recognize that it's running with this version of the nodejs runtime, so that it can recognize and take actions, such as downloading an ubuntu-specific version of the prebuilt extension, or recompiling from sources. This obviously would help mitigating the issue for a good portion of existing packages that are using node-pre-gyp and prebuild, but for packages that are doing their own thing such as uws, this solution wouldn't work properly.
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: nodejs 8.10.0~dfsg-2
ProcVersionSign
Uname: Linux 4.15.0-24-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue Jul 3 05:34:28 2018
EcryptfsInUse: Yes
InstallationDate: Installed on 2017-03-08 (482 days ago)
InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
XDG_RUNTIME_
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: nodejs
UpgradeStatus: Upgraded to bionic on 2018-05-10 (54 days ago)
Changed in nodejs (Debian): | |
status: | Unknown → New |
Changed in nodejs (Ubuntu Bionic): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in nodejs (Ubuntu Cosmic): | |
assignee: | nobody → Dan Streetman (ddstreet) |
description: | updated |
tags: | added: patch |
description: | updated |
Changed in nodejs (Ubuntu Bionic): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in nodejs (Ubuntu Cosmic): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in nodejs (Debian): | |
status: | New → Fix Released |
tags: | added: bionic-openssl-1.1 |
I think I don't quite understand the use case fully - the problem here is some binary packages, provided not by Ubuntu but through NPM, aren't binary-compatible with nodejs due to openssl lib ABI differences with the NPM-built binary? If you can provide a bit more detail on this, maybe with a specific example or way to reproduce seeing the error, it would help a lot.
Also for bionic, the openssl1.0 version is available:
$ sudo apt install openssl1.0 libssl1.0.0
$ apt-cache policy libssl1.0.0 us.archive. ubuntu. com/ubuntu bionic-updates/main amd64 Packages security. ubuntu. com/ubuntu bionic- security/ main amd64 Packages dpkg/status 0.2n-1ubuntu5 500 us.archive. ubuntu. com/ubuntu bionic/main amd64 Packages
libssl1.0.0:
Installed: 1.0.2n-1ubuntu5.1
Candidate: 1.0.2n-1ubuntu5.1
Version table:
*** 1.0.2n-1ubuntu5.1 500
500 http://
500 http://
100 /var/lib/
1.
500 http://
Is the issue here that nodejs is statically built with the newer openssl lib?