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

Illegal instruction on ARM Linux (raspberry pi) #5495

Closed
surdu opened this issue Feb 29, 2016 · 21 comments
Closed

Illegal instruction on ARM Linux (raspberry pi) #5495

surdu opened this issue Feb 29, 2016 · 21 comments
Labels
arm Issues and PRs related to the ARM platform.

Comments

@surdu
Copy link

surdu commented Feb 29, 2016

  • Version: v4.3.1 & v5.7.0
  • Platform: Linux raspberrypi 4.1.13+ _#_826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux

After installing nodejs using the package manager as instructed in the docs on raspbery pi, whenever I try to run either npm or node I get a Illegal instruction.

I realize that maybe more information are needed, but I don't know what else to add.

@surdu surdu changed the title Illegal instruction on Linux ARM (raspberry pi) Illegal instruction on ARM Linux (raspberry pi) Feb 29, 2016
@bnoordhuis
Copy link
Member

Can you turn on core dumps (ulimit -c unlimited) and run node -e 0? Open the core dump in gdb with gdb node <corefile> and type thread apply all backtrace full followed by disassemble $pc,+32. Please post the output here.

@bnoordhuis bnoordhuis added the arm Issues and PRs related to the ARM platform. label Feb 29, 2016
@surdu
Copy link
Author

surdu commented Feb 29, 2016

Sure thing:

gdb node core
Copyright and license bla bla bla
...
...
This GDB was configured as "arm-linux-gnueabihf".
...
...
Reading symbols from node...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New LWP 750]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `node -e 0'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x00339992 in BN_GF2m_mod_solve_quad ()

(gdb) thread apply all backtrace full

Thread 1 (Thread 0xb6f72440 (LWP 750)):
#0  0x00339992 in BN_GF2m_mod_solve_quad ()
No symbol table info available.

(gdb) disassemble $pc,+32
Dump of assembler code from 0x339992 to 0x3399b2:
=> 0x00339992 <BN_GF2m_mod_solve_quad+98>:  mov.w   r5, r5, lsr #1
   0x00339996 <BN_GF2m_mod_solve_quad+102>: beq.n   0x3399a4 <BN_GF2m_mod_solve_quad+116>
   0x00339998 <BN_GF2m_mod_solve_quad+104>: cmp r8, lr
   0x0033999a <BN_GF2m_mod_solve_quad+106>: it  gt
   0x0033999c <BN_GF2m_mod_solve_quad+108>: strgt.w r4, [r11, lr, lsl #2]
   0x003399a0 <BN_GF2m_mod_solve_quad+112>: add.w   lr, lr, #1
   0x003399a4 <BN_GF2m_mod_solve_quad+116>: subs    r4, #1
   0x003399a6 <BN_GF2m_mod_solve_quad+118>: cmp r4, r1
   0x003399a8 <BN_GF2m_mod_solve_quad+120>: bne.n   0x33998e <BN_GF2m_mod_solve_quad+94>
   0x003399aa <BN_GF2m_mod_solve_quad+122>: cmp r2, r0
   0x003399ac <BN_GF2m_mod_solve_quad+124>: sub.w   r1, r1, #32
   0x003399b0 <BN_GF2m_mod_solve_quad+128>: bne.n   0x33997e <BN_GF2m_mod_solve_quad+78>
End of assembler dump.

@silverwind silverwind added the openssl Issues and PRs related to the OpenSSL dependency. label Feb 29, 2016
@silverwind
Copy link
Contributor

Either you got a wrong binary or we have an issue with OpenSSL. To rule out a possible build issue on our side, can you build from source? Beware, these builds take around 6 hours on that hardware :)

@silverwind silverwind removed the openssl Issues and PRs related to the OpenSSL dependency. label Feb 29, 2016
@bnoordhuis
Copy link
Member

Quick check, does env OPENSSL_ppccap=0 node -e 0 work?

@apeeters
Copy link

apeeters commented Mar 2, 2016

@bnoordhuis Nope, same error here.

@apeeters
Copy link

apeeters commented Mar 2, 2016

For reference: all builds seem to fail, I tried several, up to nodejs_4.0.0-1nodesource1~jessie1_armhf.deb.

@bnoordhuis
Copy link
Member

Right, the armhf package is for ARMv7. The Raspberry Pi is ARMv6.

@apeeters
Copy link

apeeters commented Mar 2, 2016

That explains! For reference, node-v4.3.1-linux-armv6l.tar.gz works fine.

@silverwind
Copy link
Contributor

Yeah that download page does explicitly state that only ARMv7 and up are supported, so you guys got a wrong binary. You can download the correct ARMv6 ones at https://nodejs.org/en/download/stable/.

As for ARMv6 support in the install script, I'm not sure where to best post a issue, but it might be https://github.com/nodesource/distributions.

@surdu
Copy link
Author

surdu commented Mar 3, 2016

I'm trying to install this on a raspberry pi 2, which as far as I understand is ARMv7

@silverwind
Copy link
Contributor

@surdu your uname above says armv6l, isn't it a Rasperry Pi 1?

@surdu
Copy link
Author

surdu commented Mar 3, 2016

Nope, I ran all this on a raspberry pi 2.

@surdu
Copy link
Author

surdu commented Mar 8, 2016

I've also installed via nodesource on a raspberry pi 1, and I have the same error, or Segmentation fault, I don't remember exactly as I'm on a frantic install/uninstall in a desperate attempt to fix some twilight zone errors here.

@matt-n
Copy link

matt-n commented May 21, 2016

So, I am trying to install node.js using

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -

on an RPi 1b and everything seems to unpack and install fine... until I type node -v This results in: Illegal Instruction.

I type: node -e 0 and I get the same: Illegal Instruction.

Any ideas?

@bnoordhuis
Copy link
Member

@matt-n apt-get remove it, download the right .deb manually and install it with dpkg -i. If you still get the same error, please post the results of #5495 (comment).

@fivdi
Copy link

fivdi commented May 22, 2016

@matt-n @bnoordhuis The Raspberry Pi 1 is an ARMv6 machine but NodeSource only provides ARMv7 builds. The ARMv7 builds from NodeSource are predestined to result in Illegal Instructions on a Raspberry Pi 1. ARMv6 builds are available at https://nodejs.org/dist/, for example, the latest Node.js v6 build for the Raspberry Pi 1 is node-v6.2.0-linux-armv6l.tar.xz and can be found here.

@matt-n
Copy link

matt-n commented Jun 1, 2016

Thank you! This now works. I appreciate your help!

@chrispauley
Copy link

Hi. Could someone please re-open this issue and provide a distribution and instructions that work for the raspberry pi 3?

@silverwind
Copy link
Contributor

RPI3 can run ARMv7 (from nodesource) and ARMv8 (from https://nodejs.org/dist/). Note that you need a AArch64 kernel for ARMv8.

@chrispauley
Copy link

@silverwind thanks for your reply. I did try to install https://nodejs.org/dist/v6.2.1/node-v6.2.1-linux-armv7l.tar.gz
Wow. unzipped it, copied bins and libs and shared to the /usr directories. Yup, it worked. (Thanks). Then npm wouldn't work. After more thrashing, I found a solution on stackoverflow that allows NPM to reinstall and fix links:

wget https://npmjs.org/install.sh
chmod +x install.sh
sudo ./install.sh

This script actually worked!
hth someone else.

@rvagg
Copy link
Member

rvagg commented Jun 8, 2016

@chrispauley you should copy everything that comes with it in to /usr, (actually /usr/local is probably your safest bet and easier to clean up). There's only a couple of top-level files like README.md and LICENCE.md that could be excluded. I normally just tar -Jxf --strip-components=1 -C /usr/local node-whatever.tar.xz. Just make sure you don't have nodejs or npm packages installed from the upstream distro, that's what could be breaking stuff. Also, even easier would be to just use https://github.com/nodesource/distributions to install it, ARMv7 and above is supported and you get it all via apt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm Issues and PRs related to the ARM platform.
Projects
None yet
Development

No branches or pull requests

8 participants