Quantcast
Channel: Active questions tagged ssh - Ask Ubuntu
Viewing latest article 22
Browse Latest Browse All 856

scp copy to remote server fails: seems to overwrite with small file at the end of transfer

$
0
0

I have a strange problem with scp.

When sending a large file (mov file originally recorded on an iphone) from one computer on the network to another (same network), the file transfer progress seems to be fine and the file builds, then when it is finished, the file appears truncated/overwritten by a smaller file with the same name.

I am using a laptop running Ubuntu 24.04.2 to ssh on to a server running Raspbian OS to copy the file to an RPi running Batocera 41. The versions of ssh running on the client and server are different but from what I've found they handshake ok and it shouldn't be having an effect.

So the set up is:

Media server: Linux media-server 6.12.25+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.25-1+rpt1 (2025-04-30) aarch64;Ssh version: OpenSSH_9.2p1 Debian-2+deb12u6, OpenSSL 3.0.16 11 Feb 2025

Media client: Batocera 41 Linux 6.6.56Ssh version: Dropbear v2024.85

Note, authentication at the moment is with strong passwords. We set up with certs but they stopped working. We'll debug that separately.

The copy is initiated on the server with the command:scp -Cr /home/ToLocalize/* root@batocera.local:/media/LocalStore/transfer >~/log/scp.'date +"%Y-%m-%d_%H:%M:%S"'.log 2>&1

Now let's say there's a file called VideoConference.mov in the server ToLocalize directory that is 1.5GB in size. Using the command above, I can see a file called VideoConference.mov on the client that builds to 1.5GB.

When the command ends, the size of VideoConference.mov is 3.5MB. It seems to be the start of the MOV file but I'm not 100% sure.

I have tried removing the -C from the scp command in case it is a compression issue which doesn't change the behavior.

The log file was empty. I added -v to the command (still without -C) and the log file contains this:

Executing: program /usr/bin/ssh host batocera.local, user root, command sftpOpenSSH_9.2p1 Debian-2+deb12u6, OpenSSL 3.0.16 11 Feb 2025debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no filesdebug1: /etc/ssh/ssh_config line 21: Applying options for *debug1: Connecting to batocera.local [192.168.1.8] port 22.debug1: Connection established.debug1: identity file /home/mediaserver/.ssh/id_rsa type -1debug1: identity file /home/mediaserver/.ssh/id_rsa-cert type -1debug1: identity file /home/mediaserver/.ssh/id_ecdsa type -1debug1: identity file /home/mediaserver/.ssh/id_ecdsa-cert type -1debug1: identity file /home/mediaserver/.ssh/id_ecdsa_sk type -1debug1: identity file /home/mediaserver/.ssh/id_ecdsa_sk-cert type -1debug1: identity file /home/mediaserver/.ssh/id_ed25519 type -1debug1: identity file /home/mediaserver/.ssh/id_ed25519-cert type -1debug1: identity file /home/mediaserver/.ssh/id_ed25519_sk type -1debug1: identity file /home/mediaserver/.ssh/id_ed25519_sk-cert type -1debug1: identity file /home/mediaserver/.ssh/id_xmss type -1debug1: identity file /home/mediaserver/.ssh/id_xmss-cert type -1debug1: identity file /home/mediaserver/.ssh/id_dsa type -1debug1: identity file /home/mediaserver/.ssh/id_dsa-cert type -1debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u6debug1: Remote protocol version 2.0, remote software version dropbear_2024.85debug1: compat_banner: no match: dropbear_2024.85debug1: Authenticating to batocera.local:22 as 'root'debug1: load_hostkeys: fopen /home/mediaserver/.ssh/known_hosts2: No such file or directorydebug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directorydebug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directorydebug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: algorithm: curve25519-sha256debug1: kex: host key algorithm: ssh-ed25519debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: expecting SSH2_MSG_KEX_ECDH_REPLYdebug1: SSH2_MSG_KEX_ECDH_REPLY receiveddebug1: Server host key: ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXdebug1: load_hostkeys: fopen /home/mediaserver/.ssh/known_hosts2: No such file or directorydebug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directorydebug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directorydebug1: Host 'batocera.local' is known and matches the ED25519 host key.debug1: Found key in /home/mediaserver/.ssh/known_hosts:1debug1: ssh_packet_send2_wrapped: resetting send seqnr 3debug1: rekey out after 134217728 blocksdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: ssh_packet_read_poll2: resetting read seqnr 3debug1: SSH2_MSG_NEWKEYS receiveddebug1: rekey in after 134217728 blocksdebug1: Will attempt key: /home/mediaserver/.ssh/id_rsa debug1: Will attempt key: /home/mediaserver/.ssh/id_ecdsa debug1: Will attempt key: /home/mediaserver/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/mediaserver/.ssh/id_ed25519 debug1: Will attempt key: /home/mediaserver/.ssh/id_ed25519_sk debug1: Will attempt key: /home/mediaserver/.ssh/id_xmss debug1: Will attempt key: /home/mediaserver/.ssh/id_dsa debug1: SSH2_MSG_EXT_INFO receiveddebug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-256,ssh-rsa>debug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,passworddebug1: Next authentication method: publickeydebug1: Trying private key: /home/mediaserver/.ssh/id_rsadebug1: Trying private key: /home/mediaserver/.ssh/id_ecdsadebug1: Trying private key: /home/mediaserver/.ssh/id_ecdsa_skdebug1: Trying private key: /home/mediaserver/.ssh/id_ed25519debug1: Trying private key: /home/mediaserver/.ssh/id_ed25519_skdebug1: Trying private key: /home/mediaserver/.ssh/id_xmssdebug1: Trying private key: /home/mediaserver/.ssh/id_dsadebug1: Next authentication method: passwordAuthenticated to batocera.local ([192.168.1.8]:22) using "password".debug1: channel 0: new session [client-session] (inactive timeout: 0)debug1: Entering interactive session.debug1: pledge: filesystemdebug1: Sending environment.debug1: channel 0: setting env LC_ADDRESS = "en_US.UTF-8"debug1: channel 0: setting env LC_NAME = "en_US.UTF-8"debug1: channel 0: setting env LC_MONETARY = "en_US.UTF-8"debug1: channel 0: setting env LANG = "en_US.UTF-8"debug1: channel 0: setting env LC_PAPER = "en_US.UTF-8"debug1: channel 0: setting env LC_IDENTIFICATION = "en_US.UTF-8"debug1: channel 0: setting env LC_TELEPHONE = "en_US.UTF-8"debug1: channel 0: setting env LC_MEASUREMENT = "en_US.UTF-8"debug1: channel 0: setting env LC_TIME = "en_US.UTF-8"debug1: channel 0: setting env LC_NUMERIC = "en_US.UTF-8"debug1: Sending subsystem: sftpdebug1: SSH2_MSG_KEXINIT receiveddebug1: SSH2_MSG_KEXINIT sentdebug1: kex: algorithm: curve25519-sha256debug1: kex: host key algorithm: ssh-ed25519debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: expecting SSH2_MSG_KEX_ECDH_REPLYdebug1: rekeying in progressdebug1: rekeying in progressdebug1: rekeying in progressdebug1: rekeying in progressdebug1: rekeying in progressdebug1: rekeying in progressdebug1: SSH2_MSG_KEX_ECDH_REPLY receiveddebug1: Server host key: ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXdebug1: ssh_packet_send2_wrapped: resetting send seqnr 40509debug1: ssh_set_newkeys: rekeying out, input 1600580 bytes 179596 blocks, output 1070880804 bytes 133839643 blocksdebug1: rekey out after 134217728 blocksdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: ssh_packet_read_poll2: resetting read seqnr 40778debug1: SSH2_MSG_NEWKEYS receiveddebug1: ssh_set_newkeys: rekeying in, input 1600600 bytes 179598 blocks, output 1070880804 bytes 0 blocksdebug1: rekey in after 134217728 blocksscp: debug1: truncating at 25165824debug1: client_input_channel_req: channel 0 rtype exit-status reply 0debug1: channel 0: free: client-session, nchannels 1Transferred: sent 1509395880, received 2258432 bytes, in 86.0 secondsBytes per second: sent 17554380.1, received 26265.7debug1: Exit status 0

With the logfile lines (at the end) seeming interesting:

scp: debug1: truncating at 25165824

and

Transferred: sent 1509395880, received 2258432 bytes, in 86.0 seconds

The low received number seems to be contradicted by the fact the destination file builds to 1.5GB before snapping to 3.5MB when the command exits.

Additional points:I have tried looking here: Using scp to copy files from remote to home machineandhere: https://help.ubuntu.com/community/SSH/TransferFilesbut neither seem to address this issue.

Anyone have any idea what is going on and how to resolve?

I'd like to avoid going back to USB flash drives to move large files


Viewing latest article 22
Browse Latest Browse All 856

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>