bun icon indicating copy to clipboard operation
bun copied to clipboard

`Bun.spawn[Sync]()` not working (on WSL)

Open alexlamsl opened this issue 2 years ago • 2 comments

What version of Bun is running?

0.3.0 / 0.3.1 --canary

What platform is your computer?

Linux 4.4.0-17763-Microsoft x86_64 x86_64

What steps can reproduce the bug?

$ cat test.js
const { stdout } = Bun.spawnSync({
  cmd: ["bun", "-v"],
  stdout: "pipe",
});
console.log(stdout?.toString());

What is the expected behavior?

$ bun test.js
0.3.1
$

What do you see instead?

$ bun test.js
1 | const { stdout } = Bun.spawnSync({
  cmd: ["bun", "-v"],
  stdout: "pipe"
});
                      ^
ENOSYS: Function not implemented
syscall: "open"
  errno: -38

Additional information

Also tried Bun.spawn() and various examples under README.md to no avail.

alexlamsl avatar Dec 17 '22 04:12 alexlamsl

I think this is a Linux kernel version issue. Bun uses features from Linux kernel 5.3 or so (pidfd)

You can upgrade to a later Linux kernel via Windows Update

Jarred-Sumner avatar Dec 17 '22 04:12 Jarred-Sumner

Looks like I can't change/upgrade the Linux kernel on WSL v1 😅

Will test out WSL v2 and report back.

alexlamsl avatar Dec 17 '22 05:12 alexlamsl

Happen with Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-208-generic x86_64) and Bun 0.5.9

way-zer avatar Apr 24 '23 06:04 way-zer

The Linux kernel must be >= 5.13 or so due to using pidfd https://man7.org/linux/man-pages/man2/pidfd_open.2.html

Jarred-Sumner avatar Apr 24 '23 06:04 Jarred-Sumner

I have the same issue with 4.15.0-200-generic so kernel upgrade needed. Just not fun on production server.

tipiirai avatar Aug 04 '23 08:08 tipiirai

Apparently Vercel uses a similar runtime, seeing:

ENOSYS: Function not implemented
--
syscall: "open"
    errno: -38

       at /vercel/path0/scripts/smesc.ts:26:2
       at processTicksAndRejections (:1:2602)

boredland avatar Sep 11 '23 13:09 boredland

Apparently Vercel uses a similar runtime, seeing:

Yes, I get the following when running Bun.build() using v1.0.2 on Vercel just now

error: "pidfd_open(2)" system call is not supported by your Linux kernel
To fix this error, either:
- Upgrade your Linux kernel to a newer version (current: 5.10.186-frame descriptor�Hea)
- Ensure the seccomp filter allows "pidfd_open"
      at node:child_process:171:46
      at node:child_process:214:44
      at /vercel/path0/scripts/build-browser-bun.js:65:0
      at globalThis (/vercel/path0/scripts/build-browser-bun.js:359:12)

shaneosullivan avatar Sep 16 '23 17:09 shaneosullivan

Duplicate of #5803

Electroid avatar Oct 25 '23 22:10 Electroid