f



Write failed: Broken pipe

Hi all,

I don't know if it's appropriate to ask this question in this group.  If 
not, sorry for my message.

I login to a remote ssh server with my username and passwd and then I 
copy some files for another user's home.  But I meet the following issue 
when do the coping operation:

-----------
zhaohongsheng@node32:~> cp  -fr ../linxueling/test .
Write failed: Broken pipe
werner@debian:~$ 
-------------

Could someone please give me some hints?  Thanks in advance.

Regards.
-- 
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
0
hongyi.zhao (503)
10/13/2011 4:16:07 AM
comp.unix.shell 15484 articles. 3 followers. Post Follow

4 Replies
1908 Views

Similar Articles

[PageSpeed] 51

On 2011-10-13, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> Hi all,
>
> I don't know if it's appropriate to ask this question in this group.  If 
> not, sorry for my message.
>
> I login to a remote ssh server with my username and passwd and then I 
> copy some files for another user's home.  But I meet the following issue 
> when do the coping operation:
>
> -----------
> zhaohongsheng@node32:~> cp  -fr ../linxueling/test .
> Write failed: Broken pipe
> werner@debian:~$ 
> -------------

This looks like some network problem, unrelated to the copy operation.

You get kicked off the remote system and are back at your
"werner@debian" shell, right?

How long does the copy take? Maybe some firewall timed out your
connection due to inactivity.

Does the broken pipe happen spontaneously or is it after you hit a key?
How long was that from the time you started the copy?

If this happens a lot, try configuring keepalive pings within SSH.

Look through the ssh_config documentation for these options:

  ServerAliveInterval
  ServerAliveCountMax

0
kaz15 (1143)
10/13/2011 4:39:49 AM
On Thu, 13 Oct 2011 04:39:49 +0000, Kaz Kylheku wrote:

> On 2011-10-13, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>> Hi all,
>>
>> I don't know if it's appropriate to ask this question in this group. 
>> If not, sorry for my message.
>>
>> I login to a remote ssh server with my username and passwd and then I
>> copy some files for another user's home.  But I meet the following
>> issue when do the coping operation:
>>
>> -----------
>> zhaohongsheng@node32:~> cp  -fr ../linxueling/test .
>> Write failed: Broken pipe werner@debian:~$
>> -------------
> 
> This looks like some network problem, unrelated to the copy operation.
> 
> You get kicked off the remote system and are back at your
> "werner@debian" shell, right?

Yes, I really meet this thing when the issue occurs.

> 
> How long does the copy take? Maybe some firewall timed out your
> connection due to inactivity.

The contents in the source directory is about 2.2 G, and it take me 2 
minutes or so when I meet this issue.  You can know the volume of source 
directory from the following command's output:

linxueling@node32:~> du -h test
2.2G	test

> 
> Does the broken pipe happen spontaneously or is it after you hit a key?

In my mind, it looks like when I double click on the gnome terminal’s 
banner bar from within which I login into the ssh server, the issue will 
occur. 

> How long was that from the time you started the copy?

About 2 minutes or so, just as I've told you above.  But I'm not so 
sure.  Because if I double click on the gnome terminal’s banner bar 
shortly after the copying operation is started, the issue will not 
happen.  

Another issue is:

Currently I found I can do the copy operation successfully ;-)  

But I cann't figure out the reason that cause the *Broken pipe* issue.  I 
give some more explanations for my case, hopefully you can give me some 
more hints on this issue:

Yesterday, when I do the copying operation, I think perhaps there may 
have some files locked by some processs, considering that the files under 
that directory is a VASP's job -- VASP is DFT code for computational 
physics.  But even so, I don't know how to judge whether some files are 
locked when I do the copying opertion, furthermore, this is just my guess 
and I do not know whether it makes sense ;-)    


> 
> If this happens a lot, try configuring keepalive pings within SSH.
> 
> Look through the ssh_config documentation for these options:
> 
>   ServerAliveInterval ServerAliveCountMax

If I want to config this only for myself, i.e., not changing the global 
configuration file, should I change the following file:

 ~/.ssh/config

Furthermore, what values are appropriate for the above two arguments?  
Could you please give me some hints?  Thanks in advance. 

Regards
-- 
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
0
hongyi.zhao (503)
10/14/2011 7:48:33 AM
On 2011-10-14, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> On Thu, 13 Oct 2011 04:39:49 +0000, Kaz Kylheku wrote:
>> Does the broken pipe happen spontaneously or is it after you hit a key?
>
> In my mind, it looks like when I double click on the gnome terminal’s 
> banner bar from within which I login into the ssh server, the issue will 
> occur. 

Depending on what window manager you are using, this could resize the
window, which would send something over the ssh connection (remote
processes need to get resize notifications).

Once ssh wants to send something, it will get the broken connection.

>> How long was that from the time you started the copy?
>
> About 2 minutes or so, just as I've told you above.  But I'm not so 
> sure.  Because if I double click on the gnome terminal’s banner bar 
> shortly after the copying operation is started, the issue will not 
> happen.  

It really looks like an issue with some network element between you and
the remote host timing out.

I suspect you are going through a network address translating firewall,
which has a short timeout (less than two minutes) for expiring idle
mappings from its translation table. Once your mapping expires, then
your connection is gone.

Short timeouts in a firewall are fine for HTTP requests which are
typically either short-lived or quite active over their lifetimes
without long pauses, so web surfers won't notice too many problems (and
when they do they just accept it as flaky web behavior and hit refresh).

>> If this happens a lot, try configuring keepalive pings within SSH.
>> 
>> Look through the ssh_config documentation for these options:
>> 
>>   ServerAliveInterval ServerAliveCountMax
>
> If I want to config this only for myself, i.e., not changing the global 
> configuration file, should I change the following file:
>
>  ~/.ssh/config
>
> Furthermore, what values are appropriate for the above two arguments?  
> Could you please give me some hints?  Thanks in advance. 

The values depend on how strict the timeout is, so you may have to
experiment. I would try one minute, and if it doesn't work, lower to
30 seconds.

I think ServerAliveCountMax doesn't matter; you can leave that default.
Basically all that is needed is the side-effect of generating periodic
traffic on the connection to prevent a timeout.
0
kaz15 (1143)
10/14/2011 4:11:28 PM
On Fri, 14 Oct 2011 07:48:33 +0000, Hongyi Zhao wrote:
> On Thu, 13 Oct 2011 04:39:49 +0000, Kaz Kylheku wrote:
>> On 2011-10-13, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
....
>>> I login to a remote ssh server with my username and passwd and then I
>>> copy some files for another user's home.  But I meet the following
>>> issue when do the coping operation:

>>> zhaohongsheng@node32:~> cp  -fr ../linxueling/test .
>>> Write failed: Broken pipe werner@debian:~$ 

>> This looks like some network problem, unrelated to the copy operation.
>> 
>> You get kicked off the remote system and are back at your
>> "werner@debian" shell, right?
> 
> Yes, I really meet this thing when the issue occurs.

What do you mean?  That sentence is completely unclear.

>> How long does the copy take? Maybe some firewall timed out your
>> connection due to inactivity.
> 
> The contents in the source directory is about 2.2 G, and it take me 2
> minutes or so when I meet this issue.  You can know the volume of source
> directory from the following command's output:
> 
> linxueling@node32:~> du -h test
> 2.2G	test
....

I don't know what the problem is caused by, and suggest you briefly
state why you want (or need, whichever) to copy the files.  

An alternative to copying all those files is to copy only the ones
that you will be modifying.  Create symbolic links (via  ln -s) to 
directories with no files you'll modify, and create a directory 
structure with links to other files that are in the same directory
where there are files you'll need to modify.  If you figure out
that this approach would meet your needs, you then can request some
help here about making a script to do the job.

Another alternative, if what you are doing is periodically 
synchronizing your set of files to linxueling's files, is 
rsync instead of  cp.  Note that you can run either rsync or
scp from your local computer to do the remote copy or update
and this may bypass timeout issues, if that actually is the
underlying problem.

-- 
jiw
0
not121 (114)
10/14/2011 10:31:12 PM
Reply: