microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.11k stars 28.82k forks source link

Integrated terminal fails to launch: execvp(3) failed.: Permission denied #124968

Open Endyl opened 3 years ago

Endyl commented 3 years ago

We have written the needed data into your clipboard because it was too large to send. Please paste. Issue Type: Bug

When I try to open a new integrated terminal (bash) the terminal process fails to launch with error:

execvp(3) failed.: Permission denied

VS Code version: Code - Insiders 1.57.0-insider (4f3d865a6b46a4ead49cf83fe1c30d95d0a34220, 2021-05-31T05:13:16.692Z) OS version: Linux x64 4.15.0-143-generic

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz (24 x 1249)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|1, 1, 1| |Memory (System)|31.34GB (5.32GB free)| |Process Argv|--disable-extensions --crash-reporter-id a8517064-3fb8-42aa-bb9b-19f723e00b1c| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|unity| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|unity| |XDG_SESSION_TYPE|x11|
Extensions disabled
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368:30146709 vsreu685:30147344 python383cf:30185419 pythonvspyt602:30291494 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyt639:30291487 pythontb:30258533 vsc_aacf:30263846 vspre833cf:30267465 pythonptprofiler:30281269 vshan820:30294714 pythondataviewer:30285072 vscus158:30286553 pythonvsuse255:30303025 vscgsv2:30305091 vscorehov:30301224 vscod805:30301674 vscextlang:30310088 ```
vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

furai commented 3 years ago

Maybe related to this issue but if not I'll create a new one. I can't run sudo commands inside integrated terminal. Everything works on my system terminal

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

EDIT: Seems to be related to the recent trust workspace settings but the workspace I'm editing is trusted.

EDIT2: It seems it's fixed in the latest update.

EDIT3: My issue is unrelated to OP's.

Endyl commented 3 years ago
Still present in: 1e446dfadf588ec28b3fdba7ac083bfa1d45df3c ``` Version: 1.57.0-insider Commit: 1e446dfadf588ec28b3fdba7ac083bfa1d45df3c Date: 2021-06-01T05:13:45.931Z Electron: 12.0.9 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Linux x64 4.15.0-143-generic ```

Edit 1:

Still present in: 217f1a2f60a197807de78af362ecb832100fda96 ``` Version: 1.57.0-insider Commit: 217f1a2f60a197807de78af362ecb832100fda96 Date: 2021-06-02T05:13:37.201Z Electron: 12.0.9 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Linux x64 4.15.0-143-generic ```
Tyriar commented 3 years ago

I believe these are typically related to environment-specific problems.

Endyl commented 3 years ago

The integrated terminal runs fine in non insider build and previous insiders builds as well, and was broken by an insiders update. I think if something was wrong in my environment, it would break the integrated terminal in any version.

furai commented 3 years ago

I think @Tyriar might have based his answer on my log that was totally unrelated to your issue which I've stated in one of the edits.

Endyl commented 3 years ago
Now it arrived in the regular build... b4c1bd0a9b03c749ea011b06c6d2676c8091a70c
Version: 1.57.0
Commit: b4c1bd0a9b03c749ea011b06c6d2676c8091a70c
Date: 2021-06-09T17:18:42.895Z
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Linux x64 4.15.0-144-generic
yakumoklesk commented 3 years ago

Hi, I have put a bug, probably is duplicated of this. Has anyone tested having a remote host bashrc profile that source other tools like git_bash_prompt? I think thinks like this may be causing the issues.

Tyriar commented 3 years ago

This comment is revealing:

https://github.com/microsoft/vscode/issues/126017#issuecomment-861379341

FWIW - adding the following setting fixed things for me:

    "terminal.integrated.profiles.linux": {
        "bash": {
            "path": "/bin/bash"
        },

    },

Which by default just points to bash - without a path.

Happens on macOS and Linux, assigning to June if we have time to investigate.

Tyriar commented 3 years ago

Looked into this briefly but couldn't repro still, even with brew-installed shells that are symlinks. On my mac they are resolved correctly and get sent over to the ptyservice pre-resolved:

Screen Shot 2021-06-29 at 2 50 16 PM Screen Shot 2021-06-29 at 2 50 13 PM
idl0r commented 3 years ago

"The terminal process failed to launch: Path to shell executable "zsh" is not a file of a symlink."

% ls -la $(which zsh)
-rwxr-xr-x 2 root root 832712 Oct  5  2020 /bin/zsh

Worked fine until I upgraded from an older version (some months old). Selecting "bash" works for some reason:

% ls -la $(which bash)
-rwxr-xr-x 1 root root 936288 May 18 15:22 /bin/bash
Tyriar commented 3 years ago

Here's where that error is shown, the code looks correct:

https://github.com/Microsoft/vscode/blob/424a1166f37f10e11f8f88dbbb5d6930a8f9d3f9/src/vs/platform/terminal/node/terminalProcess.ts#L214-L216

Would need to be able to repro to investigate it further.

If anyone is willing that sees this, it would be useful to turn on trace logging, then toggle the shared process via the command palette (F1), open the terminal and then look for a log like this:

Screen Shot 2021-07-23 at 1 05 07 PM

The /usr/local/bin/bash above is the piece of info I'm after.

Tyriar commented 3 years ago

Might be same root cause as https://github.com/microsoft/vscode/issues/128564?

meganrogge commented 3 years ago

We believe this is fixed by the fix for #128564. Please let us know if you see this in tomorrow's insider's.

rzhao271 commented 3 years ago

@Endyl is the issue fixed for you on the latest Insiders? Edit: feel free to comment on this issue or create a new one if you are still seeing the error in the latest Insiders version.

meganrogge commented 3 years ago

I could not reproduce the original issue, so am marking this as verified

idl0r commented 3 years ago

Just tried code-insider-x64-1628233592 as well as code-stable-x64-1628120346. Both are still having the mentioned issues as in https://github.com/microsoft/vscode/issues/124968#issuecomment-885870195

zaverden commented 3 years ago

got this issue today in WSL2

solution from this comment helped: https://github.com/microsoft/vscode/issues/124968#issuecomment-870528245

everything worked yesterday, got broken after this morning update

Version: 1.59.1 (user setup)
Commit: 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
Date: 2021-08-19T11:56:46.957Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19042
zaverden commented 3 years ago

still get this error on the latest version

Version: 1.60.1 (user setup)
Commit: 83bd43bc519d15e50c4272c6cf5c1479df196a4d
Date: 2021-09-10T17:07:10.714Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043

same solution works: https://github.com/microsoft/vscode/issues/124968#issuecomment-870528245 not sure if this is on core, or on wsl-remote extension

kevnm67 commented 3 years ago

This comment is revealing:

#126017 (comment)

FWIW - adding the following setting fixed things for me:

    "terminal.integrated.profiles.linux": {
        "bash": {
            "path": "/bin/bash"
        },

    },

This helped me resolve the issue with the following variation

"terminal.integrated.profiles.osx": {
        "zsh": {
            "path": "/bin/zsh"
        },
    },
mckethanor commented 3 years ago

I've been running into this a long time, and I fixed it by running which zsh in an external terminal, and pasting the result of that into the settings, ala "terminal.integrated.profiles.osx": { "zsh": { "path": "/usr/local/bin/zsh" }, },

idl0r commented 3 years ago

That doesn't work for me.

hustzyd commented 2 years ago

This comment is revealing: #126017 (comment) FWIW - adding the following setting fixed things for me:

    "terminal.integrated.profiles.linux": {
        "bash": {
            "path": "/bin/bash"
        },

    },

This helped me resolve the issue with the following variation

"terminal.integrated.profiles.osx": {
        "zsh": {
            "path": "/bin/zsh"
        },
    },

works for me

JiaminL commented 10 months ago

I ran into the same issue today. Turns out it's a combination of two quirks:

The result is, VSCode tries to execvp(bash) with working directory = $HOME, causing the wrong bash file to be picked up.

To further readers: After trying the JSON edit solution above, make sure to come back and inspect your $PATH to see if an invalid file with the same name lies somewhere before the correct bash.

Co-authored-by: @iBug

Locoxella commented 8 months ago

Apparently, I am the only one dumb enough to hit this error, search for it, and try the proposed solution on this thread with out paying attention to what I was doing. If you are just like me, do yourself a favor and remember to uncompress the file you downloaded containing crc. The executable is inside, do not just pick the tar.xz file that you downloaded. VScode won't try to uncompress that for you, neither will not explicitly warn you about it not being the executable. It will fail with the above-mentioned error. So...

surak commented 7 months ago

In my case, it's something related to

If I connect to the same host in a different directory, it all work. If I connect to the directory containing a virtual environment, but without the python extension, it works. But as soon as I have this combination, things stop working.

As soon as I reinstall the python extension, I get this in a error message:

The terminal process "/bin/sh '-c', 'wget --version > /dev/null if [ $? -eq 0 ] then wget --connect-timeout=7 --tries=1 --dns-timeout=7 -q -O - http://169.254.169.254/latest/meta-data/instance-id else curl --version > /dev/null if [ $? -eq 0 ] then curl --connect-timeout 7 -s http://169.254.169.254/latest/meta-data/instance-id fi fi exit 0'" failed to launch (exit code: 1).

and the dreaded execvp(3) failed.: Argument list too long.

Worst part, I don't know how to change. it. The "Pty host" output shows me this:

2024-02-09 18:49:24.023 [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q --header='Metadata-Flavor:Google' -O - http://metadata.google.internal/computeMetadata/v1/instance/id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s --header='Metadata-Flavor:Google' http://metadata.google.internal/computeMetadata/v1/instance/id\n\tfi\nfi\nexit 0"]

And what is google doing here?

clemens-u-form commented 1 month ago

In my case, it's something related to

* Remote connection (ssh),

* The Python extension,

* Virtual Environments.

If I connect to the same host in a different directory, it all work. If I connect to the directory containing a virtual environment, but without the python extension, it works. But as soon as I have this combination, things stop working.

As soon as I reinstall the python extension, I get this in a error message:

The terminal process "/bin/sh '-c', 'wget --version > /dev/null if [ $? -eq 0 ] then wget --connect-timeout=7 --tries=1 --dns-timeout=7 -q -O - http://169.254.169.254/latest/meta-data/instance-id else curl --version > /dev/null if [ $? -eq 0 ] then curl --connect-timeout 7 -s http://169.254.169.254/latest/meta-data/instance-id fi fi exit 0'" failed to launch (exit code: 1).

and the dreaded execvp(3) failed.: Argument list too long.

Worst part, I don't know how to change. it. The "Pty host" output shows me this:

2024-02-09 18:49:24.023 [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q --header='Metadata-Flavor:Google' -O - http://metadata.google.internal/computeMetadata/v1/instance/id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s --header='Metadata-Flavor:Google' http://metadata.google.internal/computeMetadata/v1/instance/id\n\tfi\nfi\nexit 0"]

And what is google doing here?

Thanks for that input. Disabling the python extension also fixed my issue. Have you found a solution with an active python extension?