Skip to content

nodejs not working, exec format error #8151

@wangqr

Description

@wangqr

Version

Microsoft Windows [Version 10.0.19044.1586]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

4.4.0-19041-Microsoft

Distro Version

Arch

Other Software

No response

Repro Steps

Install nodejs from Archlinux repo with pacman -S nodejs, and run node

Expected Behavior

nodejs starts

Actual Behavior

nodejs does not start. exec format error.

wangqr@ocalhost:~$ node
zsh: exec format error: node

Diagnostic Logs

nodejs can start if we manually invoke ld-linux, although it is already the interpreter in the ELF.

wangqr@ocalhost:~$ /usr/bin/node
zsh: exec format error: /usr/bin/node
wangqr@ocalhost:~$ strace /usr/bin/node
execve("/usr/bin/node", ["/usr/bin/node"], 0x7ffff42aefa0 /* 25 vars */) = -1 ENOEXEC (Exec format error)
strace: exec: Exec format error
+++ exited with 1 +++
wangqr@ocalhost:~$ /lib/ld-linux-x86-64.so.2 /usr/bin/node
Welcome to Node.js v17.7.1.
Type ".help" for more information.
>
wangqr@ocalhost:~$ /lib64/ld-linux-x86-64.so.2 /usr/bin/node
Welcome to Node.js v17.7.1.
Type ".help" for more information.
>
wangqr@ocalhost:~$ file /usr/bin/node
/usr/bin/node: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=10ec67f51a763d04ac6e1fe305ce214fb40eabda, for GNU/Linux 4.4.0, stripped
wangqr@ocalhost:~$ readelf -h /usr/bin/node
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - GNU
  ABI Version:                       0
  Type:                              DYN (Position-Independent Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x6aa570
  Start of program headers:          64 (bytes into file)
  Start of section headers:          34087608 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         16
  Size of section headers:           64 (bytes)
  Number of section headers:         30
  Section header string table index: 29

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions