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

VS Code ignores RemoteCommand #6598

Closed
DebajyotiS opened this issue Apr 11, 2022 · 16 comments
Closed

VS Code ignores RemoteCommand #6598

DebajyotiS opened this issue Apr 11, 2022 · 16 comments
Labels
polish ssh Issue in vscode-remote SSH
Milestone

Comments

@DebajyotiS
Copy link

DebajyotiS commented Apr 11, 2022

  • VSCode Version: 1.66.1
  • Local OS Version: Windows 11
  • Remote OS Version:CentOS Linux 7
  • Remote Extension/Connection Type: SSH
  • Logs:

I am trying to SSH into a remote machine, however the remote command seems to be ignored. This works fine if I run it on a shell.

My SSH config:

Host clr~*
    RemoteCommand cd /some/path && singularity shell --nv -B /some/other/path/ /path/to/image.sif
    RequestTTY yes

Host baobab
    HostName login.baobab.address
    User senguptd
    IdentityFile /path/to/id_rsa
        
Host nodebaobab
    HostName gpu017
    User senguptd
    ProxyJump baobab
    IdentityFile /path/to/id_rsa

Host nodebaobab clr~nodebaobab
    HostName gpu017
    User senguptd
    ProxyJump baobab
    IdentityFile /path/to/id_rsa

Relevant remote.SSH settings:

    "remote.SSH.connectTimeout": 30,
    "remote.SSH.useLocalServer": true,
    "remote.SSH.remoteServerListenOnSocket": true,
    "remote.SSH.enableRemoteCommand": true,
    "remote.SSH.logLevel": "trace",
    "python.formatting.provider": "black",
    "editor.formatOnSave": true,
    "autoDocstring.docstringFormat": "numpy",
    "remote.WSL.useShellEnvironment": true

(Interesting to note for me useLocalServer can only be set to true iff remoteServerListenOnSocket is simulatanously set to true)

log output:

[14:56:09.378] Using SSH config file "C:\Users\admin\.ssh\config"
[14:56:09.378] Running script with connection command: ssh -T -D 52208 -o RemoteCommand=none -F "C:\Users\admin\.ssh\config" "clr~nodebaobab" bash

However as I say, this works fine through a cmd shell. Any clue as to why VSCode might be ignoring the remoteCommand?

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Apr 11, 2022
@quetant
Copy link

quetant commented Apr 11, 2022

Hi,

I have the exact same issue:

  • VSCode Version: 1.66.1
  • Local OS Version: Windows 10
  • Remote OS Version: CentOS Linux 7
  • Remote Extension/Connection Type: SSH

SSH config file:

Host pt~*
  RemoteCommand module load <necessary modules> && singularity shell -B </some/path> </some/image.sif
  RequestTTY yes

Host somehost pt~somehost
  HostName <some.host.address>
  User <username>

remote.SSH settings:

"remote.SSH.remoteServerListenOnSocket": false,
"remote.SSH.enableRemoteCommand": true,
"remote.SSH.connectTimeout": 30,

Connecting to pt~somehost via the remote-SSH extension through VS code gives RemoteCommand=none thus not loading the Singularity image.

However, connecting directly through the command line via ssh pt~somehost works perfectly fine.

@tanhakabir
Copy link

Do you have the settings remote.SSH.useLocalServer and remote.SSH.enableRemoteCommand set to true?

If it still doesn't work could you share your Remote SSH logs?

@tanhakabir tanhakabir added the info-needed Issue requires more information from poster label Apr 11, 2022
@DebajyotiS
Copy link
Author

DebajyotiS commented Apr 12, 2022

Hi,

Yes, as the remote.SSH.settings show, both settings remote.SSH.useLocalServer and remote.SSH.enableRemoteCommand are set to true for me.
The remoteSSHlog is as attached below.
Also, as I mentioned,

(Interesting to note for me useLocalServer can only be set to true iff remoteServerListenOnSocket is simulatanously set to true)


remotesshlog.txt

Looking at the logs though, it looks like localserver is set to 0. I believe this is because I have Remote Server Listen on Socket set to true.

@tanhakabir
Copy link

Yes we have this longstanding issue where you can't use remoteListenOnSocket along with useLocalServer: #6086

If you're able to not use remoteListenOnSocket then you will be able to use Remote Command currently

@DebajyotiS
Copy link
Author

Are there any patches for this?
I am not sure why I can't simply just have useLocalServer set to true, (if remoteListenOnSocket is false). It simply doesn't connect to the remote in that case.

@quetant
Copy link

quetant commented Apr 13, 2022

Hi,

Actually I tried with these settings:

"remote.SSH.useLocalServer": true,
"remote.SSH.remoteServerListenOnSocket": false,
"remote.SSH.enableRemoteCommand": true,

and this config file:

Host pt~*
  RemoteCommand module load <necessary modules> && singularity shell -B </some/path> </some/image.sif
  RequestTTY yes

Host somehost pt~somehost
  HostName <some.host.address>
  User <username>

Host node.somehost pt~node.somehost
  HostName <node.some.host.address>
  User <username>
  ProxyJump somehost

It's able to connect to pt~somehost, but still RemoteCommand=none.

However, it fails to connect to both node.somehost and pt~node.somehost when "remote.SSH.useLocalServer": true.

@tanhakabir
Copy link

@quetant could you share your Remote SSH logs?

@DebajyotiS no there's no patch out. My only recommendation is to follow #6086 for an eventual patch

@github-actions
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@lmh91
Copy link

lmh91 commented May 4, 2022

I had the same issue for quite some time.
RemoteCommand was ignored when connecting from my Windows machine onto some Linux server.
My remote ssh specific settings were (are):

"remote.SSH.useLocalServer": true,
"remote.SSH.enableRemoteCommand": true,

I finally found out was caused the issue for me.
I looked into the logs and found:

[09:13:11.621] Cannot use RemoteCommand if you have this remote in your "remote.SSH.remotePlatform" setting

I commented out the corresponding line for the Linux remote in settings.json
and it worked after killing and restarting the remote vscode server.

So maybe this information that remotePlatform cannot be used in combination with RemoteCommand should go into the documentation for RemoteCommand.

@DebajyotiS
Copy link
Author

Hi @lmh91 , can you share more details about your local and remote? I have the remote.Platform bit commented out. But I still cannot connect at all if I have listenOnSocket set to false, and if I set it to true - remoteCommand is ignored.

@lmh91
Copy link

lmh91 commented May 4, 2022

  • Local OS: Windows 11
  • VS Code: v1.66.2
  • Remote SSH Ext.: v0.78.0

listenOnSocket is not activated. See full settings:

My full VS Code settings:

{
    // "remote.SSH.remotePlatform": {
    //     "cslg-01-container": "linux",
    // },
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": false,
    "workbench.startupEditor": "none",
    "window.restoreWindows": "none",
    "terminal.integrated.commandsToSkipShell": [
        "language-julia.interrupt"
    ],
    "julia.symbolCacheDownload": true,
    "security.workspace.trust.enabled": false,
    "julia.execution.codeInREPL": true,
    "editor.inlineSuggest.enabled": true,
    // "remote.SSH.showLoginTerminal": true,
    // "remote.SSH.logLevel": "trace",
    // "remote.SSH.connectTimeout": 30,
    "remote.SSH.useLocalServer": true,
    "remote.SSH.enableRemoteCommand": true,
    // "remote.SSH.suppressWindowsSshWarning": true,
    // "remote.SSH.remoteServerListenOnSocket": false,
}

My ssh config: (Maybe RequestTTY is also necessary?)

Host cslg-01-container
    HostName XXXXX
    User XXXXX
    IdentityFile C:\Users\XXXXX\.ssh\id_rsa
    RequestTTY yes
    RemoteCommand cenv ubuntu

(cenv is some script to enter some ubuntu container via singularity)

@lmh91
Copy link

lmh91 commented May 4, 2022

Strangely it can't parse the path to my config file now.

C:Usersadmin.sshconfig where the setting in json goes as: "remote.SSH.configFile": "C:\\Users\\admin\\.ssh\\config",

I think you need to use: C:\\\\Users\\\\admin\\\\.ssh\\\\config

But you don't need it as it is the default? I don't have specified it.

@DebajyotiS
Copy link
Author

Thanks a lot! I think it works now. For me the issues were:

  1. path to ssh config file. C:\\Users\\path\\ --> C:/Users/Path/ (or as I see from your comment as I type this)
  2. RequestTTY to be set to true in one of the HostName specification.

@lmh91
Copy link

lmh91 commented May 4, 2022

Just to be clear about "works now":

You are now also able to use RemoteCommand from Windows onto some Linux machine (and enter directly into the container)?

With just

"remote.SSH.useLocalServer": true,
"remote.SSH.enableRemoteCommand": true,

and no settings for "remote.SSH.remotePlatform"

and RequestTTY yes in the SSH config?

@DebajyotiS
Copy link
Author

Exactly so. I have remote.Platform commented out (which I agree should be mentioned in the docs). Then the only other issue was my path to ssh config file, which I then corrected.

@tanhakabir
Copy link

Thanks for the feedback on the docs! I'll add a note about this now

@tanhakabir tanhakabir added polish and removed info-needed Issue requires more information from poster labels May 9, 2022
@tanhakabir tanhakabir added this to the May 2022 milestone May 9, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
polish ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

4 participants