Skip to content

Ruby LSP Extension Fails to Spawn Bash in Dev Container (ENOENT Error) #3829

@ohaleck

Description

@ohaleck

Description

The Ruby LSP extension fails to start in a Dev Container environment with the error: Automatic Ruby environment activation with custom failed: spawn /bin/bash ENOENT. The extension cannot spawn /bin/bash even though bash exists and is executable at both /bin/bash and /usr/bin/bash.

Environment

  • Extension Version: [email protected]
  • Editor: Cursor 2.0.77 (VS Code 1.99.3 fork)
  • Environment: Dev Container (Docker/OrbStack)
  • Ruby Version: 3.3.8 (via RVM)
  • Ruby LSP Gem Version: 0.26.4
  • Ruby Version Manager: RVM
  • OS: Linux (aarch64, Ubuntu-based container) hosted on MacOS 15.7.2 (Darwin arm64 24.6.0)

Configuration

.devcontainer/devcontainer.json:

{
  "name": "AB",
  "dockerComposeFile": "compose.yaml",
  "service": "ab",
  "workspaceFolder": "/workspace",
  "containerEnv": {
    "BUNDLE_PATH": "/bundle/vendor"
  },
  "customizations": {
    "vscode": {
      "extensions": [
        "Shopify.ruby-lsp"
      ],
      "settings": {
        "rubyLsp.rubyVersionManager": {
          "identifier": "rvm"
        },
        "rubyLsp.bundleGemfile": "${workspaceFolder}/Gemfile",
        "rubyLsp.shell": "/bin/bash"
      }
    }
  }
}

.vscode/settings.json:

{
  "rubyLsp.rubyVersionManager": {
    "identifier": "rvm"
  },
  "rubyLsp.bundleGemfile": "${workspaceFolder}/Gemfile",
  "rubyLsp.shell": "/bin/bash",
  "rubyLsp.useBundler": true
}

Error Message

Automatic Ruby environment activation with custom failed: spawn /bin/bash ENOENT

Ruby LSP Output Logs

2025-11-21 10:46:53.849 [info] (workspace) Running command: `/usr/local/rvm/bin/rvm-auto-ruby -EUTF-8:UTF-8 '/home/vscode/.cursor-server/extensions/shopify.ruby-lsp-0.9.32-universal/activation.rb'` in /workspace/${workspaceFolder} using shell: /bin/bash

Steps to Reproduce

  1. Set up a Dev Container with RVM and Ruby 3.3.8
  2. Install Ruby LSP extension ([email protected])
  3. Configure extension to use RVM identifier
  4. Set rubyLsp.shell to /bin/bash (or /usr/bin/bash)
  5. Reload window or restart Ruby LSP server
  6. Observe error: spawn /bin/bash ENOENT

Expected Behavior

The Ruby LSP extension should successfully spawn bash to run the activation script and start the language server.

Actual Behavior

The extension fails with spawn /bin/bash ENOENT error, preventing the language server from starting. This breaks features like "Go to Definition" (Cmd+Click) navigation.

Verification

Bash exists and is executable:

$ ls -la /bin/bash /usr/bin/bash
-rwxr-xr-x 1 root root 1543048 Mar 31  2024 /bin/bash
-rwxr-xr-x 1 root root 1543048 Mar 31  2024 /usr/bin/bash

$ which bash
/usr/bin/bash

$ /bin/bash --version
GNU bash, version 5.2.21(1)-release (aarch64-unknown-linux-gnu)

The command the extension is trying to run works when executed manually:

$ /bin/bash -c '/usr/local/rvm/bin/rvm-auto-ruby -EUTF-8:UTF-8 -e "puts \"test\""'
test

Node.js can successfully spawn bash:

$ node -e "const {spawn} = require('child_process'); const proc = spawn('/bin/bash', ['--version']); proc.stdout.on('data', d => console.log(d.toString()));"
GNU bash, version 5.2.21(1)-release (aarch64-unknown-linux-gnu)

Attempted Solutions

  1. ✅ Set rubyLsp.shell to /bin/bash and /usr/bin/bash - no effect
  2. ✅ Configured terminal shell settings - no effect
  3. ✅ Tried both custom and rvm identifiers - same error
  4. ✅ Created wrapper scripts - extension still tries to spawn bash
  5. ✅ Rebuilt Dev Container multiple times - issue persists
  6. ✅ Verified bash exists and is executable - confirmed
  7. ✅ Tested manual execution of the command - works fine

Additional Context

  • The extension correctly identifies and tries to use /usr/local/rvm/bin/rvm-auto-ruby
  • The issue appears to be specifically with how the extension spawns the shell process
  • The error occurs even though bash is accessible and executable
  • This may be related to the extension running in a restricted context within the Dev Container
  • The same configuration works outside of Dev Container (on host machine)

Related Issues

Workaround

None found. The extension cannot start the language server, so Ruby language features are unavailable in Dev Container.

Request

Please investigate why the extension cannot spawn /bin/bash in Dev Container environments even when bash exists and is executable. This appears to be a bug in how the extension spawns processes in containerized environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp-wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions