0

I'm trying to fast copy some big directories from my remote Debian 9 server to my local Debian 9 on WSL (Windows Subsystem for linux; Windows 10 Pro) with ssh "tar" | tar pipe.

ssh user@example.com "cd /path/to/resource && tar czf - resource1 resource2" | tar xzvf -

When I run this command I get the error messages

gzip: stdin: not in gzip format
tar: Child died with signal 13
tar: Error is not recoverable: exiting now

If I do the same without the zparameter

ssh user@example.com "cd /path/to/resource && tar cf - resource1 resource2" | tar xvf -

I get these errors:

tar: This does not look like a tar archive
tar: Skipping to next header

with no prompt.

I've run this command several times before on different hardware and in this particular case I just have re-run this command from my bash_history from some days ago. It has been run then, but it doesn't run now.

If I use scp instead with compression enabled (which will be much slower)

scp -rC user@example.com:/path/to/resource/resource1 .

I get this error:

protocol error: mtime.sec not present

What can I do to make this work?

tar version
Local: tar (GNU tar) 1.29
Remote: tar (GNU tar) 1.29

bash version
Local: GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Remote: GNU bash, Version 4.4.12(1)-release (x86_64-pc-linux-gnu)

Linux version (cat /proc/version)
Local : Linux version 4.4.0-17134-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #523-Microsoft Mon Dec 31 17:49:00 PST 2018
Remote: Linux version 4.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)

  • 1
    Do you get any additional output when you connect via ssh to that host? a welcome message of some kind? – Gerald Schneider Feb 22 at 11:24
  • Your question led me in the right direction. I have a ~/.profile script which has an output that destroys the tar pipe – yunzen Feb 22 at 11:33
0

This was an error on the remote server. For some program I run there (tig) I need a 256 color xterm and I set it by this script. I only installed it recently.

if [ -e /usr/share/terminfo/x/xterm-256color ]; then
    export TERM='xterm-256color'
    echo TERM set to 256 colors
elif [ -e /usr/share/terminfo/x/xterm+256color ]; then
    export TERM='xterm-256color'
    echo TERM set to 256 colors
else
    export TERM='xterm-color'
    echo TERM set to color
fi

I needed to get rid of the echos and it runs again

if [ -e /usr/share/terminfo/x/xterm-256color ]; then
    export TERM='xterm-256color'
elif [ -e /usr/share/terminfo/x/xterm+256color ]; then
    export TERM='xterm-256color'
else
    export TERM='xterm-color'
fi

Thanks to Gerald Schneider for the hint

Please pay attention to chutz's comment below

  • 1
    If you are putting stuff like this in a .bashrc or .profile, which are sourced even for non-interactive shells, then you better make sure you only do this when the shell is interactive. An easy way to sort this is by putting this at the start [[ $- != *i* ]] && return – chutz Mar 1 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.