wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.83k stars 798 forks source link

Wezterm error setting env vars on ssh session: [Session(-22)] Unable to complete request for channel-setenv #1015

Closed jaredramirez closed 3 years ago

jaredramirez commented 3 years ago

Describe the bug

When I ssh into a remote machine using wezterm's (with wezterm ssh ...) a handful of environment variables are not set on the remote machine. Specifically, WEZTERM_PANE, TERM_PROGRAM, TERM_PROGRAM_VERSION, and TERM.

Due to this, some commands such as wezterm cli split-pane fail with:

 2021-08-13T22:31:06.493Z ERROR wezterm > --pane-id was not specified and $WEZTERM_PANE is not set in the environment; terminating

The logs on the client machine are:

 2021-08-13T21:58:58.159Z INFO  wezterm_gui::termwindow > OpenGL initialized! Intel(R) Iris(TM) Plus Graphics OpenGL Engine 4.1 INTEL-16.4.5 is_context_loss_possible=false wezterm version: 20210502-154244-3f7122cb
 2021-08-13T21:58:58.169Z INFO  wezterm_ssh::auth       > pubkey_file immediately ok for /Users/../.ssh/id_rsa
 2021-08-13T21:58:58.192Z WARN  wezterm_ssh::pty        > ssh: setenv WEZTERM_PANE=0 failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:01:14.827Z WARN  wezterm_ssh::pty        > ssh: setenv WEZTERM_PANE=1 failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:08:37.051Z WARN  wezterm_ssh::pty        > ssh: setenv TERM_PROGRAM_VERSION=20210502-154244-3f7122cb failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:08:37.054Z WARN  wezterm_ssh::pty        > ssh: setenv TERM=xterm-256color failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:08:37.056Z WARN  wezterm_ssh::pty        > ssh: setenv WEZTERM_PANE=2 failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:08:37.060Z WARN  wezterm_ssh::pty        > ssh: setenv TERM_PROGRAM=WezTerm failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:05.963Z WARN  wezterm_ssh::pty        > ssh: setenv TERM=xterm-256color failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:05.965Z WARN  wezterm_ssh::pty        > ssh: setenv WEZTERM_PANE=3 failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:05.967Z WARN  wezterm_ssh::pty        > ssh: setenv TERM_PROGRAM_VERSION=20210502-154244-3f7122cb failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:05.969Z WARN  wezterm_ssh::pty        > ssh: setenv TERM_PROGRAM=WezTerm failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:16.584Z WARN  wezterm_ssh::pty        > ssh: setenv TERM_PROGRAM_VERSION=20210502-154244-3f7122cb failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:16.586Z WARN  wezterm_ssh::pty        > ssh: setenv TERM_PROGRAM=WezTerm failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:16.588Z WARN  wezterm_ssh::pty        > ssh: setenv TERM=xterm-256color failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:16.590Z WARN  wezterm_ssh::pty        > ssh: setenv WEZTERM_PANE=4 failed: [Session(-22)] Unable to complete request for channel-setenv
 2021-08-13T22:10:29.247Z WARN  wezterm_ssh::pty        > ssh: setenv WEZTERM_PANE=5 failed: [Session(-22)] Unable to complete request for channel-setenv

Environment (please complete the following information):

I've installed Wezterm through Nix, so I cannot confirm if this is occurring on nightly too

To Reproduce

  1. Install Wezterm on both a client & server
  2. Connect to server via wezterm ssh user@server
  3. Attempt to echo any of the above env vars and see that they are not there

Configuration

I don't believe this is relevant

Expected behavior

I expect using wezterm over ssh to work pretty much the same as using it locally.

Screenshots

Session Recording

Additional context

My nixpkgs rev is 97087745820218d37afb6360eebdc6063a21d93a My libssh2 version is 1.9.0

wez commented 3 years ago

This warning is because the server refused to set the requested environment variables; the AcceptEnv setting in sshd_config controls whether this is allowed, and defaults to not allowing anything other than TERM to be propagated.

jaredramirez commented 3 years ago

Gotcha, that fixed it. Thank you!

wez commented 3 years ago

7dd77a03 improves the error message to point folks at that config

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.