SSH hangs after key is accepted on WSL Terminal

Viewed 1399

Pushing and Fetching from Git Repo's (Bitbucket and my web host) stopped working on WSL. I've discovered that connecting via ssh hangs just before the shell prompt used to appear. Using ssh -vvv shows this (I've removed things I didn't think important) :

debug1: Authentication succeeded (publickey).
Authenticated to XXX.XXXX ([XXX.XXX.XXX.XXX]:XX).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: open confirm rwindow 0 rmax 32768

It varies how much of the above is shown before hanging. This was working, but stopped. I've changed ISP and Router (I've gone from ADSL to NBN), and I thought this was the cause, but I can use PowerShell (using OpenSSH )to connect to the same server. I've tried creating new keys, but I get the same result. I just need some help on how to troubleshoot this.

I'm running Ubuntu 18.04.3 LTS on WSL 2 (Windows Build 18999, I've gone insider fast track to try and fix, wasn't working on slow track either). I'm running OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n on WSL; and OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 on PowerShell.

2 Answers

SSH hanging on WSL 2 (and hanging the terminal completely) is a widely known problem.
It has been reported multiple times on WSL GitHub (some of the issues were closed without actually fixing the problem).
An example of a currently open ticket is here: https://github.com/microsoft/WSL/issues/4690

Some people report that lowering down MTU on Ubuntu fixes this issue for them, but a lot (including me) don't see any difference.

You can check MTU for your connection on Windows:

netsh interface ipv4 show subinterfaces

And then set MTU on Ubuntu to a lower value (see this ticket: https://github.com/microsoft/WSL/issues/7197):

sudo ip link set dev eth0 mtu 1300

But it didn't actually work for me...
EDIT: This workaround started to partially work for me after I reinstalled WSL. I still get occasional hangs, but less frequent now.

Not really an answer, but I had something wrong with my .bash_profile or .bashrc. I ended up just Resetting my Ubuntu install, and was able to set things up again.

Related