ssh works but scp hangs, sometimes
For a while now I've not been able to scp to one of my Raspberry Pi's from my desktop. scp would appear to connect and then hang. I looked into it initially but gave up. I've been working around it by scp'ing to a third host when I want to copy files to the Pi.
Today I decided to get to the bottom of it.
I discovered that
ssh host w (replace
w with any command) showed the
same problem. Interestingly I discovered if I passed
command would succeed.
Googling for similar issues generally suggested the issue could be caused
by MTU settings or strange things in
~/.profile. Neither of
these were what was going on in my case.
My friend Robert Bisewski found the
solution. He found this
issue that sounded similar
to the behaviour I was seeing. Amazingly the idea in the issue solved the
IPQoS 0x00 to
/etc/ssh/sshd_config was all it took.
Contrary to what the Debian wiki
says, putting the
option in the client side config didn't help.
Why does this fix it? One thing we found was that there's no problem if I connect using my 2.4 GHz wireless network. It only happens when I'm on my 5 GHz network. I confirmed this by trying to connect from a second machine. Indeed the host I had been using as a go between happened to be on my 2.4 GHz network! Could there be a problem with the 5 GHz support in my router? Or in the Raspberry Pi 3 B (which is connected to the 5 GHz network). It's a mystery! I'm just glad I can scp again and there's at least a partial explanation.