Skip to content

Permission denied error when debugging as default vscode user #38

@danofiveo

Description

@danofiveo

Problem

After cloning this repo in a remote host via SSH and selecting the "Reopen in Container" command, the container is configured as expected. However, when I attempt to debug, I'm presented with the following output:

Running `cargo build --bin=hello_remote_world --package=hello_remote_world --manifest-path=Cargo.toml --message-format=json`...
error: failed to open: /workspaces/vscode-remote-try-rust/target/debug/.cargo-lock

Caused by:
  Permission denied (os error 13)
Error: Cargo invocation failed.
        at t.Cargo.getCargoArtifacts (/home/vscode/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/extension.js:1:14881)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Object.open (/home/vscode/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/extension.js:1:13191)
Caused by: Error: exit code: 101.
        at ChildProcess.<anonymous> (/home/vscode/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/extension.js:1:16548)
        at ChildProcess.emit (node:events:518:28)
        at maybeClose (node:internal/child_process:1105:16)
        at ChildProcess._handle.onexit (node:internal/child_process:305:5)
 *  The terminal process failed to launch (exit code: 1). 

Also, if I edit one of the included files and attempt to save it, I'm presented with the following error:

Failed to save 'devcontainer.json': Unable to write file 'vscode-remote://dev-container+<omitted for brevity>@ssh-remote+debian-machine/workspaces/vscode-remote-try-rust/.devcontainer/devcontainer.json' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/workspaces/vscode-remote-try-rust/.devcontainer/devcontainer.json')

How can the default vscode user have a full developer experience as expected?

The Docker engine is running as non-root user (rootless mode).

Workaround

Uncomment the "remoteUser": "root" line in the devcontainer.json file.
Run the container as root.
Debugging proceeds without permission errors.

Tried So Far

Changing owner and group:

vscode ➜ /workspaces/vscode-remote-try-rust $ sudo chown -R vscode:vscode .

Results in different errors when attempting to debug:

/workspaces/vscode-remote-try-rust/target/debug/hello_remote_world: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /workspaces/vscode-remote-try-rust/target/debug/hello_remote_world)
/workspaces/vscode-remote-try-rust/target/debug/hello_remote_world: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /workspaces/vscode-remote-try-rust/target/debug/hello_remote_world)
/workspaces/vscode-remote-try-rust/target/debug/hello_remote_world: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /workspaces/vscode-remote-try-rust/target/debug/hello_remote_world)

Am I missing something?
What should I do to be able to debug Rust running as the default vscode user?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions