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

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

Closed
alexlamsl opened this issue Dec 17, 2022 · 8 comments
Closed

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

alexlamsl opened this issue Dec 17, 2022 · 8 comments
Labels
bug Something isn't working bun.js Something to do with a Bun-specific API

Comments

@alexlamsl
Copy link
Contributor

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 alexlamsl added the bug Something isn't working label Dec 17, 2022
@Jarred-Sumner
Copy link
Collaborator

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

@alexlamsl
Copy link
Contributor Author

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

Will test out WSL v2 and report back.

@way-zer
Copy link

way-zer commented Apr 24, 2023

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

@Jarred-Sumner
Copy link
Collaborator

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

@tipiirai
Copy link

tipiirai commented Aug 4, 2023

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

@boredland
Copy link

boredland commented Sep 11, 2023

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)

@shaneosullivan
Copy link

shaneosullivan commented Sep 16, 2023

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)

@Electroid Electroid added the bun.js Something to do with a Bun-specific API label Oct 25, 2023
@Electroid
Copy link
Contributor

Duplicate of #5803

@Electroid Electroid marked this as a duplicate of #5803 Oct 25, 2023
@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun.js Something to do with a Bun-specific API
Projects
None yet
Development

No branches or pull requests

7 participants