vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

can't start remote SSH when remote Linux server uses fish shell

Open doj opened this issue 7 months ago • 11 comments

Type: Bug

I want to use the Remote-SSH extension to access the file system on a remote Linux server. My user account on the remote server is set up to use the fish shell https://fishshell.com/ This shell uses a different language than the regular bourne shell, typically used on Linux. When connecting, the SSH session is created successfully, but then simply times out. I assume that VSCode sends some commands to start the remote server which use bourne shell syntax, which then fails with the fish shell.

Extension version: 0.120.0 VS Code version: Code 1.100.2 (Universal) (848b80aeb52026648a8ff9f7c45a9b0a80641e2e, 2025-05-14T21:47:40.416Z) OS version: Darwin arm64 23.6.0 Modes: Remote OS version: Linux x64 5.15.0-119-generic

System Info
Item Value
CPUs Apple M2 (8 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.18GB free)
Process Argv --crash-reporter-id 27792d9b-e32e-4fbf-bbee-4c9d557b4aa1
Screen Reader no
VM 0%
Item Value
Remote SSH: vm
OS Linux x64 5.15.0-119-generic
CPUs Intel(R) Xeon(R) Platinum 8280 CPU @ 2.70GHz (8 x 0)
Memory (System) 31.27GB (28.62GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31309971
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
pylancecolorcf:31309109
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

doj avatar May 19 '25 15:05 doj

I'm working around the issue by creating a second user account which has bash configured as the system shell. then fiddled with the group configuration, so that both users can read and write each other's files.

What would help is, if when VS starts the SSH session that it sets an environment variable. My startup scripts can then check for such variable and start an alternative shell. Maybe it's already doing this, but I didn't find a log file in ~/.vscode-server/ that would show details of the SSH session.

doj avatar May 22 '25 16:05 doj

It is difficult to understand this issue without your SSH logs, could you please provide them? We execute an installation script on your remote machine, but we explicitly run this script in an sh or bash shell.

joshspicer avatar May 29 '25 22:05 joshspicer

Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

Happy Coding!

Is there a log file on the destination SSH server? Or only the terminal output from the Visual Studio Code program?

doj avatar May 30 '25 18:05 doj

I'm also affected by this.

Environment

  • Remote OS: Ubuntu 24.04
  • Local OS: Garuda Linux (Arch-based)
  • VS Code Remote SSH: Latest
  • Default shell on remote: fish

With fish as the default shell, VS Code hangs while setting up the remote server.


What I tried

I attempted to work around the issue by editing the remote ~/.config/fish/config.fish:

if test "$TERM_PROGRAM" = "vscode"
    exec bash -l
end

I also tried

Host proxy-vscode
    HostName <server-ip>
    User <username>
    IdentityFile ~/.ssh/id_rsa
    RemoteCommand bash -l
    IdentitiesOnly yes

The only reliable solution was to:

  • Change the default shell on the remote to bash using `chsh -s /bin/bash

If any further details are needed, please let me know.


Logs

I've attached my connection logs provided by vscode after failure

vscode.log

bugslayer01 avatar Jul 23 '25 20:07 bugslayer01

✅ bash ❎ fish

Well I think if one can explicitly execute the initialization script in fish, it would be quite straightforward to tell what is not compatible with fish.

TLCFEM avatar Aug 13 '25 14:08 TLCFEM

One workaround that works for me: set your shell to bash, and then switch to fish if bash is running in interactive mode:

# ~/.bash_profile

is_interactive() { [[ $- == *i* ]]; } 

if is_interactive; then 

    # If we're running in interactive mode, look for fish, and exec if it exists.
    
    FISH=$(env PATH="$HOME/local/bin:$HOME/local/homebrew/bin:/opt/homebrew/bin:$PATH" which fish)

    if [[ -x "$FISH" ]]; then
      exec env SHELL="$FISH" "$FISH" -i
    fi

fi

Seems wasteful for run bash every single time but well it works and doesn't cause any performance problems or otherwise. Also, this approach has been useful on other systems where fish is not available as a login shell.

ithinkihaveacat avatar Sep 26 '25 21:09 ithinkihaveacat

To switch it around and run bash in fish when connecting with ssh-remote, you can:

"remote.SSH.enableRemoteCommand": true

You can use a custom configuration in you ~/.ssh/ssh_config such as this:

Host vscode.domain.tld
   HostName ssh.domain.tld
   RemoteCommand /usr/bin/bash

KarlAmort avatar Oct 08 '25 08:10 KarlAmort

To switch it around and run bash in fish when connecting with ssh-remote, you can:要在连接 ssh-remote 时切换它并在鱼中运行 bash,您可以:

"remote.SSH.enableRemoteCommand": true

You can use a custom configuration in you ~/.ssh/ssh_config such as this:您可以在 ~/.ssh/ssh_config 中使用自定义配置,如下所示:

Host vscode.domain.tld
   HostName ssh.domain.tld
   RemoteCommand /usr/bin/bash

This works for me, thanks

canxin121 avatar Oct 22 '25 14:10 canxin121

Disabling 'Remote-SSH: Use Local Server' is useful for me.

MovFish avatar Oct 31 '25 11:10 MovFish