Terminal: How to enable scrollback when using tmux in ssh?

Created on 3 Aug 2020  路  21Comments  路  Source: microsoft/terminal

Windows build number: Microsoft Windows [Version 10.0.18362.778]
Windows Terminal version (if applicable): Version: 1.1.2021.0

When running tmux in an ssh session (connected to a Centos 7 machine) tmux works ok except that scrollback does not work.

Is there a way to enable scrollback when using tmux in Terminal?

(I think #381 may be relevant but I don't understand it).

Needs-Author-Feedback Needs-Tag-Fix Needs-Triage Resolution-External

All 21 comments

Does tmux support using the scrollback in _any_ terminal emulator? I was under the impression that it always maintained it's own internal scrollback, and didn't use the terminal emulator's, since there's no real way that you can use the terminal scrollback for multiple panes in a sensible way

This might be related to the issue where scrolling regions that take up the entire screen don't push lines off the top properly. I can't recall which that is at the moment.

@DavidA2014

When running tmux in an ssh session (connected to a Centos 7 machine) tmux works ok except that scrollback does not work.

Actually, you know what? I think I know what this is. tmux supports mouse scrolling using VT mouse mode.
David, are you using the version of ssh that comes with windows? Can you share the output of ssh -V?

@DHowett

>ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

That will do it! The version of SSH that comes with Windows doesn't support sending your mouse input to the other end of the wire (so tmux never knows you're trying to scroll.)

If you give a try to the newer version, 8.2+, from their releases page, does it work better?

@DHowett Thanks, but did you mean 8.2+? I can't see anything later than 8.1.

8.1 should be sufficient. Sorry about that, I forgot what version they were on :)

Thanks. I'm also a bit worried about installing a custom version, now that Windows comes with OpenSSH. I've tried the PowerShell installation commands for OpenSSH in the past and they've not worked for me. Any advice? (Don't worry if you haven't).

That's a fair concern. I'm not sure how best to install it or to make sure that it's working properly across your system.

If you want to give it a quick test just to verify before jumping in, you can just run ssh.exe right out of the zip file (or, well, extract it somewhere first :smile:).

https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH has always worked for me every release (minus firewall rules, which only need to be put in once.) You can also run through these scripts if something seems off afterwards: https://github.com/PowerShell/Win32-OpenSSH/wiki/OpenSSH-utility-scripts-to-fix-file-permissions. Ignore the module portion, that part has been officially depreciated.

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@WSLUser Thanks for your answer. We used the instructions that you linked to and successfully installed OpenSSH_for_Windows_8.1p1.

Just for the record, the default version of ssh provided by Windows is at:
C:\Windows\System32\OpenSSHssh.exe

The version installed by the instructions from https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH is at:
"C:\Program Files\OpenSSHssh.exe"

It seems that even with OpenSSH_for_Windows_8.1p1, scrollback is not working properly with tmux in Terminal.

How are you attempting to scroll to the scrollback - with the mouse wheel, or a keybinding in tmux? If you're trying to use the mouse, do you have mouse support enabled in your tmux config?

Does the scrollback work if you try ssh'ing from a vintage console window (i.e. cmd.exe)?

Just to take away another factor, did you uninstall the Optional Feature version of OpenSSH? In theory you should be able to use both but in practice it's better to use only one version, typically the latest in the case of OpenSSH. Your PATH may still be using the old version, so uninstalling it should help ensure that isn't the case. Also be sure to bump the 8.1 release near the top of your PATH (the UI is quite useful for this).

@WSLUser @zadjii-msft Thanks for your comments, I can't investigate further just at the moment.

@WSLUser what did you mean by:

(the UI is quite useful for this).

?

EnvVaredit

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Can confirm that installing latest of OpenSSH (v8.1 from the website) fixes the issue with tmux getting the mouse scroll wheel commands.

The path thing didn't work even when put at the top of the list (but perhaps I was missing a reboot in the middle) - by default I would still get the Windows 10 installed v7.2 when ssh from a command prompt.

I was perhaps a bit rash and just uninstalled the optional feature "SSH Client" but no issues - it worked fine and now a bear ssh from the command prompt will launch v8.1 and then testing out tmux and scrolls back in history fine.

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

It seems that even with OpenSSH_for_Windows_8.1p1, scrollback is not working properly with tmux in Terminal.

@WSLUser @zadjii-msft @DavidA2014

It's working fine for me using tmux in Windows Terminal. I didn't want to install it either, so all I did was copied the ssh.exe (and only that file) from the zip at:

https://github.com/powershell/win32-openssh/releases

Into a directory in my path so it's used rather than the installed version.

If it's not working for you, maybe check you tmux settings as indicated by zadjii-msft .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mdtauk picture mdtauk  路  3Comments

alabuzhev picture alabuzhev  路  3Comments

ghvanderweg picture ghvanderweg  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

carlos-zamora picture carlos-zamora  路  3Comments