-
Notifications
You must be signed in to change notification settings - Fork 891
Using scp
to transfer a file to Coder workspace succeeds but returns non-zero exit code
#5038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm... I was not able to reproduce this on Coder v0.11.0 or latest (v0.12.6). I also tried:
Is there anything else about your scp environment that may be out of the ordinary? $ ssh -V
OpenSSH_8.6p1, LibreSSL 3.3.6
$ coder version
Coder v0.11.0+df89e2c Tue Oct 25 14:33:37 UTC 2022
https://github.com/coder/coder/commit/df89e2c3b01e3b5838d72f6a8659a116d44712a6
$ scp file.txt coder.wohoo:/home/coder/
file.txt 100% 6 4.4KB/s 00:00
$ echo $?
0 Verbose `scp` logs$ scp -rv idk coder.wohoo:/root/idk
Executing: program /usr/bin/ssh host coder.wohoo, user (unspecified), command scp -v -r -t /root/idk
OpenSSH_8.6p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/benpotter/.ssh/config
debug1: Reading configuration data /Users/benpotter/.colima/ssh_config
debug1: /Users/benpotter/.ssh/config line 34: Applying options for coder.wohoo
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Executing proxy command: exec /usr/local/bin/coder --global-config "/Users/benpotter/Library/Application Support/coderv2" ssh --stdio wohoo
debug1: identity file /Users/benpotter/.ssh/id_rsa type 0
debug1: identity file /Users/benpotter/.ssh/id_rsa-cert type -1
debug1: identity file /Users/benpotter/.ssh/id_dsa type -1
debug1: identity file /Users/benpotter/.ssh/id_dsa-cert type -1
debug1: identity file /Users/benpotter/.ssh/id_ecdsa type -1
debug1: identity file /Users/benpotter/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/benpotter/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/benpotter/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/benpotter/.ssh/id_ed25519 type -1
debug1: identity file /Users/benpotter/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/benpotter/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/benpotter/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/benpotter/.ssh/id_xmss type -1
debug1: identity file /Users/benpotter/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version Go
debug1: compat_banner: no match: Go
debug1: Authenticating to coder.wohoo:22 as 'benpotter'
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:kilZBn34OyN51Roq7t0h33VfuCOd1Bw0r8USBAl0ENo
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
Warning: Permanently added 'coder.wohoo' (RSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/benpotter/.ssh/id_rsa RSA SHA256:6udyLPM53Bpv4b5cSNb2tB8hq/N/wasp3jKAWqYYDq4
debug1: Will attempt key: /Users/benpotter/.ssh/id_dsa
debug1: Will attempt key: /Users/benpotter/.ssh/id_ecdsa
debug1: Will attempt key: /Users/benpotter/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/benpotter/.ssh/id_ed25519
debug1: Will attempt key: /Users/benpotter/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/benpotter/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentication succeeded (none).
Authenticated to coder.wohoo (via proxy).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: proc
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: Sending command: scp -v -r -t /root/idk
Entering directory: D0755 0 idk
Sink: D0755 0 idk
Sending file modes: C0644 6 file.txt
Sink: C0644 6 file.txt
file.txt 0% 0 0.0KB/s --:-- ETAscp: debug1: fd 0 clearing O_NONBLOCK
file.txt 100% 6 5.3KB/s 00:00
Entering directory: D0755 0 folder
Sink: D0755 0 folder
Sending file modes: C0644 0 idk.txt
Sink: C0644 0 idk.txt
idk.txt 100% 0 0.0KB/s 00:00 scp: debug1: fd 0 clearing O_NONBLOCK
Sink: E
Sink: E
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2132, received 2092 bytes, in 0.0 seconds
Bytes per second: sent 120092.4, received 117839.2
debug1: Exit status 0 Linux Verboseroot@coder-v2:~# scp -v wget-log coder.wohoo:/root
Executing: program /usr/bin/ssh host coder.wohoo, user (unspecified), command scp -v -t /root
OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n 15 Mar 2022
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 10: Applying options for coder.wohoo
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Executing proxy command: exec /usr/bin/coder --global-config /root/.config/coderv2 ssh --stdio wohoo
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
debug1: Remote protocol version 2.0, remote software version Go
debug1: no match: Go
debug1: Authenticating to coder.wohoo:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:kilZBn34OyN51Roq7t0h33VfuCOd1Bw0r8USBAl0ENo
Warning: Permanently added 'coder.wohoo' (RSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /root/.ssh/id_rsa RSA SHA256:6udyLPM53Bpv4b5cSNb2tB8hq/N/wasp3jKAWqYYDq4
debug1: Will attempt key: /root/.ssh/id_dsa
debug1: Will attempt key: /root/.ssh/id_ecdsa
debug1: Will attempt key: /root/.ssh/id_ecdsa_sk
debug1: Will attempt key: /root/.ssh/id_ed25519
debug1: Will attempt key: /root/.ssh/id_ed25519_sk
debug1: Will attempt key: /root/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentication succeeded (none).
Authenticated to coder.wohoo (via proxy).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: proc
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -t /root
Sending file modes: C0644 524 wget-log
Sink: C0644 524 wget-log
wget-log 0% 0 0.0KB/s --:-- ETAscp: debug1: fd 0 clearing O_NONBLOCK
wget-log 100% 524 10.0KB/s 00:00
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2456, received 1580 bytes, in 0.3 seconds
Bytes per second: sent 8442.8, received 5431.4
debug1: Exit status 0
root@coder-v2:~# echo $?
0 |
Thanks @bpmct for trying to reproduce it! I just noticed there is also this message in my verbose
I didn't notice it before because it looks like this message only appears if the file I'm copying doesn't already exist in the remote destination. I was previously just re-running the However, despite that message being shown, I confirmed the file is transferred successfully each time. 😵 And whether the file already exists at the remote destination path or not, the Here are the versions of SSH on my local machine (macOS 13.0.1):
And in my Coder workspace (Ubuntu 20.04):
Also one other thing I forgot to mention is that my |
@kconley-sq could you try running PS. More info can be discerned by adding more |
The fix has been merged and will be part of the next release. I tested this on macOS 13.0.1 using the built-in |
Thanks @mafredri! I can confirm that adding |
Version:
v0.11.0+df89e2c
I noticed this behavior when a shell function I wrote to automate transferring some files to my workspace via
scp
was failing early since I executeset -e
in that function. When I re-ranscp
with-v
to get more details, I saw this in the output:The text was updated successfully, but these errors were encountered: