TL;DR:
SCP from our Linux VM hangs after it reaches 100%.
The Setup
In the course of development, my team has created a CentOS VM which hosts an application that employs SSH (and SCP) in order to execute tasks on other
hosts. Originally, this was working perfectly fine.
We were originally using Oracle VirtualBox since it's recommended for VM development but our company decided that we should use Hyper-V for development
as well so we made the switch.
This application is still just in the development phase so the VM is just running on Hyper-V for Windows 10. We're using Vagrant to stand up the VM
very quickly and forwarding the port that the application is running on using a PowerShell command. We simply attach the VM to the default switch. This works as intended, the application is accessible on that port.
Issue with SSH
Very quickly our application was beginning to fail when it came to the SSH connection to other hosts. We had to modify the SSH configuration in order
to set the HMACs by going to /etc/ssh/ssh_config and uncommenting the HMAC line. This fixes the SSH issue and we're able to SSH to other hosts perfectly fine after this. It's odd considering that this was not an issue with VirtualBox but at least we have a
workaround.
Issue with SCP
After we got SSH working, we noticed that SCP was having issues. This one is a bit more odd. When attempting to SCP a file from our node to another,
the percentage indicator reaches 100% then it hangs indefinitely. This will successfully create the file on the target but that file will be empty. Increasing the verbosity of the SCP utility we see:
SCP Output:
scp -vvv tst.txt user@target.domain:/tmp/
...
debug1: Sending command: scp -v -t /tmp/
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 4
debug1: Remote: Missing locale support for LANG=en_US.UTF-8
debug2: channel 0: rcvd adjust 201600
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Sending file modes: C0664 12840 test.txt
test.txt 100% 13KB 0.1KB/s 02:52
strace:
It seems to be stuck in a loop because the following block is repeated in the strace until I kill the process with Ctrl + C:
...
write(1, "\rtest.txt "..., 185) = 185
rt_sigaction(SIGALRM, NULL, {0x555900a4ebf0, [], SA_RESTORER|SA_INTERRUPT, 0x7fc354919280}, 8) = 0
alarm(1) = 0
rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system call)
read(7, 0x7ffe718fdb0f, 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---```
...
Specs:
Host: Hyper-V Manager V10.0.17763.1 on Win 10 Enterprise (V1809)
Guest: CentOS 7.6 x64 (latest) using Default Switch