Navigation Menu

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

NodeJS 18 not working on Ubuntu 18.04 #1392

Closed
cobalt2727 opened this issue May 4, 2022 · 25 comments
Closed

NodeJS 18 not working on Ubuntu 18.04 #1392

cobalt2727 opened this issue May 4, 2022 · 25 comments

Comments

@cobalt2727
Copy link
Contributor

Looks like NodeJS 18 wasn't built properly for Ubuntu Bionic - it only has glibc 2.27...

(not my screenshot, but I can contact the uploader for any tests needed)

image

@JesusPaz
Copy link
Contributor

JesusPaz commented May 4, 2022

Node.js 18 is compatible with Linux distributions based on glibc 2.28 or later, for example, Debian 10, RHEL 8, and Ubuntu 20.04.

You can find more information in the release notes.

@JesusPaz JesusPaz closed this as completed May 4, 2022
@cobalt2727
Copy link
Contributor Author

cobalt2727 commented May 4, 2022

Yes, I've read the release update. But the problem is NodeJS 18 has a release file over here for an OS you're telling me it doesn't support.

A fix for this problem would be to build NodeJS 18 on Debian Stretch, RHEL 7, Ubuntu 16.04 (which is still under ESM), or 18.04 (which is still receiving maintenance updates and is still currently considered LTS, as detailed here). If that's not possible for some reason, then the documentation needs updating. Is glibc 2.28 a hard requirement for NodeJS 18, or is that simply a side effect of the build environment used?

@theofficialgman
Copy link

theofficialgman commented May 4, 2022

agreed @JesusPaz , you should at MINIMUM remove the dists from your repo that nodejs18 doesn't support
you currently host packages for:

Index of /node_18.x/dists/
[../](https://deb.nodesource.com/node_18.x/)
[bionic/](https://deb.nodesource.com/node_18.x/dists/bionic/)                                            03-May-2022 15:55       -
[bookworm/](https://deb.nodesource.com/node_18.x/dists/bookworm/)                                          03-May-2022 15:55       -
[bullseye/](https://deb.nodesource.com/node_18.x/dists/bullseye/)                                          03-May-2022 15:55       -
[buster/](https://deb.nodesource.com/node_18.x/dists/buster/)                                            03-May-2022 15:55       -
[focal/](https://deb.nodesource.com/node_18.x/dists/focal/)                                             03-May-2022 15:55       -
[groovy/](https://deb.nodesource.com/node_18.x/dists/groovy/)                                            03-May-2022 15:55       -
[hirsute/](https://deb.nodesource.com/node_18.x/dists/hirsute/)                                           03-May-2022 15:55       -
[impish/](https://deb.nodesource.com/node_18.x/dists/impish/)                                            03-May-2022 15:55       -
[jammy/](https://deb.nodesource.com/node_18.x/dists/jammy/)                                             03-May-2022 15:55       -
[sid/](https://deb.nodesource.com/node_18.x/dists/sid/)                                               03-May-2022 15:55       -
[stretch/](https://deb.nodesource.com/node_18.x/dists/stretch/)                                           03-May-2022 15:55       -
[xenial/](https://deb.nodesource.com/node_18.x/dists/xenial/)                                            03-May-2022 15:55

this is disingenuous, the majority of these will not work (xenial, stretch, buster, bionic)

@cobalt2727
Copy link
Contributor Author

@JesusPaz it's been about a week - when can we receive an update or an ETA on this?

@Botspot
Copy link

Botspot commented May 12, 2022

If Node.js 18 doesn't work at all on older systems, then information stating otherwise should be removed or at least clarified.

Right now, anyone who tries to install the Node.js package on an older OS will find that it's completely broken.

@cobalt2727
Copy link
Contributor Author

@chrislea Hi there - sorry if I'm pinging the wrong person, but would you be able to give us an update on what the plans are here?

@chrislea
Copy link
Contributor

Hi @cobalt2727. Sorry but I can't help here. I haven't worked at Nodesource in over three years and my access to any of the relevant build infrastructure that I'd need to see what's going on has long been revoked.

I can tell you from memory that when things like this (making newer versions of node work on older systems) happened back when I was dealing with it, the problem was usually that V8 started using some C++ feature that required a fairly modern C++ compiler, which in turn required a more modern version of libstdc++. Meaning that you simply couldn't compile or run V8 on systems that didn't have a sufficiently new libstdc++. In some cases, RedHat had provided modified versions of gcc that would somehow get around older libstdc++ limitations, but without those compilers, there simply wouldn't have been anything we could do. So it may just not be possible to do sanely, where by "sanely" I mean "without forcibly changing the version of libstdc++ on the target machine" which would likely have mountains of disastrous side effects.

Again, I need to stress that I don't know if that's what's going on here. I'm not in the node universe anymore really and haven't been for some time. That's just a guess based on what I remember from ~ 4 years ago.

@cobalt2727
Copy link
Contributor Author

Node.js 18 is compatible with Linux distributions based on glibc 2.28 or later, for example, Debian 10, RHEL 8, and Ubuntu 20.04.

You can find more information in the release notes.

@JesusPaz Good morning/afternoon/evening.

image

This issue needs to be reopened. No PPAs, external repos, or source builds (besides the building of NodeJS itself) were used in the process of bringing you the screenshot above. NodeJS 18 itself does not require glibc 2.28 or later to function. Saying so directly conflicts with NodeJS's official documentation, which lists off required dependencies that are all available just from Ubuntu 18.04's apt repository.

The decision to build NodeJS 18's binaries on newer environments needs to be fixed. As @Botspot and @theofficialgman pointed out above, it's resulting in critical installation failures with packages being built that are impossible to install on the intended system, as shown here.

There are two solutions to this.

  1. NodeJS 18+ packages from Nodesource get built on a build environment old enough to correctly support them - I'm willing to bet whatever you guys were building NodeJS 17 on probably still works, and if not, set up an extra build environment to handle all older systems still in use. I get it if you're not checking to make sure, say, Debian Jessie is being supported or anything, but 18.04 really still needs to be at least until it hits End of Life in April 2023, or maybe even April 2028 if that's possible.
  2. Nodesource stops listing distributions without glibc 2.28 as being compatible and leaves users on older systems on their own to just build things themselves.

One way or another, this part of the README is currently inaccurate and must be fixed.
image

@dominic-p
Copy link

Just got bit by this myself. It feels like the prebuilt Node v18 binaries should not be allowed to be installed on Ubuntu 18 since they simply won't run.

@cobalt2727
Copy link
Contributor Author

@dominic-p Until they fix this, you can build NodeJS yourself by following https://github.com/nodejs/node/blob/v18.x/BUILDING.md#unix-and-macos with two exceptions:
sudo apt install gcc-8 g++-8

And then while setting up the build:
C=/usr/bin/gcc-8 CXX=/usr/bin/g++-8 ./configure

This is a massive pain to update though given how long it takes to build on most hardware.

@dominic-p
Copy link

Thanks for sharing that! I considered trying to build it myself, but I figured it was going to be a massive pain, and there's no way I was going to figure out the exceptions above on my own. For now, Node v16 is sufficient for my needs until I can get around to upgrading the host OS.

I'm just kind of surprised that Nodesource is leaving this closed. This issue is definitely not resolved.

@cobalt2727
Copy link
Contributor Author

Hi @JesusPaz, any updates?

@TranNgocKhoa
Copy link

So current NodeJS LTS version will break on Ubuntu LTS 18.04. Is there any work around?

@cobalt2727
Copy link
Contributor Author

@dominic-p Until they fix this, you can build NodeJS yourself by following https://github.com/nodejs/node/blob/v18.x/BUILDING.md#unix-and-macos with two exceptions: sudo apt install gcc-8 g++-8

And then while setting up the build: C=/usr/bin/gcc-8 CXX=/usr/bin/g++-8 ./configure

This is a massive pain to update though given how long it takes to build on most hardware.

@TranNgocKhoa you'll have to either do this, stick to NodeJS 16, or get on a newer OS (if possible with your setup).

@grant541
Copy link

My server is down because I tried updating node and was unaware of the catastrophic failure resulting from installing node 18 on Ubuntu 18. Very sorry I updated node, now I need to go repair my server. Than ks!

@lehni
Copy link

lehni commented Oct 5, 2023

I've just managed to get Node 20 working on an Ubuntu 18 instance, by compiling my own version of glibc v2.28, installing it to /opt/glibc-2.28 and using patchelf to patch /usr/local/bin/node to use it. It works like a charm, and building glibc takes much less time than building node. Instructions (on a Jetson Nano, so the arch-related details will vary):

sudo -i

# Start by installing Node 20:

curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
bash n 20

# Node 20 is now at /usr/local/bin/node, but glibc 2.28 is missing:
# node: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
# /usr/local/bin/node: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/bin/node)

# Build and install glibc 2.28:
apt install -y gawk
cd ~
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -zxf glibc-2.28.tar.gz
cd glibc-2.28
../configure --prefix=/opt/glibc-2.28
make -j 4 # Use all 4 Jetson Nano cores for much faster building
make install
cd ..
rm -fr glibc-2.28 glibc-2.28.tar.gz
 
# Patch the installed Node 20 to work with /opt/glibc-2.28 instead: 
apt install -y patchelf
patchelf --set-interpreter /opt/glibc-2.28/lib/ld-linux-aarch64.so.1 --set-rpath /opt/glibc-2.28/lib/:/lib/aarch64-linux-gnu/:/usr/lib/aarch64-linux-gnu/ /usr/local/bin/node

# Et voilà:
node --version
v20.8.0

@riosje
Copy link
Contributor

riosje commented Oct 5, 2023

Hi @lehni shout outs to you for this instructions it looks pretty easy.
Not sure what would be the drawbacks of this.
Would you like to help us to create a Non official Installation guide on our wiki for node18 and node20 on unsupported distros.

@lehni
Copy link

lehni commented Oct 5, 2023

@riosje I can't see any downside so far, but will keep an eye out and report back if I see issues with this approach. I don't really have time to write the wiki article, but feel free to use the above and add it there.

@ShotSkydiver
Copy link

@lehni this works perfectly! Just as a note for others, on x64 Ubuntu, you'll have to replace aarch64-linux-gnu with x86_64-linux-gnu and ld-linux-aarch64.so.1 with ld-linux-x86-64.so.2.

@4KDA
Copy link

4KDA commented Nov 17, 2023

I slightly expanded the solution from @lehni and @ShotSkydiver (installing the necessary dependencies and fixing go to the directory for configurate), and here is the complete solution that worked for me:

sudo -i

# Start by installing Node 20:

sudo apt-get install python3 g++ make python3-pip gcc bison

curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
bash n 20

# Node 20 is now at /usr/local/bin/node, but glibc 2.28 is missing:
# node: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
# /usr/local/bin/node: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/bin/node)

# Build and install glibc 2.28:
apt install -y gawk
cd ~
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -zxf glibc-2.28.tar.gz
cd glibc-2.28
pwd
mkdir glibc-build
cd glibc-build
../configure --prefix=/opt/glibc-2.28
make -j 4 # Use all 4 Jetson Nano cores for much faster building
make install
cd ..
rm -fr glibc-2.28 glibc-2.28.tar.gz
 
# Patch the installed Node 20 to work with /opt/glibc-2.28 instead: 
apt install -y patchelf
patchelf --set-interpreter /opt/glibc-2.28/lib/ld-linux-x86-64.so.2 --set-rpath /opt/glibc-2.28/lib/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/ /usr/local/bin/node

# Et voilà:
node --version
v20.9.0

@microdou
Copy link

@lehni Thanks a million! Finally resolved my issue in installing NodeJS 20 on Ubuntu 18 ❤️

@RomanovaCute
Copy link

RomanovaCute commented Nov 29, 2023

@4KDA when i do "make install", an error appears. Maybe, you know how to fix it? i can't find

make[2]: *** No rule to make target '/root/glibc-2.28/glibc-build/mathvec/libmvec.so.1', needed by '/opt/glibc-2.28/lib/libm.so'. Stop.
make[2]: Leaving directory '/root/glibc-2.28/math'
Makefile:258: recipe for target 'math/subdir_install' failed
make[1]: *** [math/subdir_install] Error 2
make[1]: Leaving directory '/root/glibc-2.28'
Makefile:12: recipe for target 'install' failed
make: *** [install] Error 2

@aryamansharda
Copy link

@4KDA Thank you! That worked perfectly 🙏

@gaols
Copy link

gaols commented Dec 7, 2023

@lehni @4KDA compile error when run 'make -j 4',the error output is as follows:

/tmp/glibc-2.28/nss/nss_files/files-key.c:101: undefined reference to `xdecrypt'
collect2: error: ld returned 1 exit status
../Makerules:606: recipe for target '/tmp/glibc-2.28/glibc-build/nss/libnss_files.so' failed
make[2]: *** [/tmp/glibc-2.28/glibc-build/nss/libnss_files.so] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/glibc-2.28/nss'
Makefile:258: recipe for target 'nss/others' failed
make[1]: *** [nss/others] Error 2
make[1]: Leaving directory '/tmp/glibc-2.28'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2

how to fix it? My building env is ubuntu 18.04.

@adcb101
Copy link

adcb101 commented Jan 3, 2024

@lehni @4KDA compile error when run 'make -j 4',the error output is as follows:

/tmp/glibc-2.28/nss/nss_files/files-key.c:101: undefined reference to `xdecrypt' collect2: error: ld returned 1 exit status ../Makerules:606: recipe for target '/tmp/glibc-2.28/glibc-build/nss/libnss_files.so' failed make[2]: *** [/tmp/glibc-2.28/glibc-build/nss/libnss_files.so] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/tmp/glibc-2.28/nss' Makefile:258: recipe for target 'nss/others' failed make[1]: *** [nss/others] Error 2 make[1]: Leaving directory '/tmp/glibc-2.28' Makefile:9: recipe for target 'all' failed make: *** [all] Error 2

how to fix it? My building env is ubuntu 18.04.

Hi,i find another way ,you can try it,come from this article https://blog.csdn.net/Youning_Yim/article/details/129343107

  1. deb http://security.debian.org/debian-security buster/updates main
  2. sudo apt update # 更新软件源
  3. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A 54404762BBB6E853
  4. sudo apt list --upgradable
  5. sudo apt install libc6-dev /sudo apt install libc6
  6. strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_

after finish all steps ,you can install high version node on ubuntu 18.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests