[SOLVED] "rsync error: error in rsync protocol data stream (code 12)"

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
rickNS
Level 9
Level 9
Posts: 2977
Joined: Tue Jan 25, 2011 11:59 pm

[SOLVED] "rsync error: error in rsync protocol data stream (code 12)"

Post by rickNS »

Yesterday while trying to send a folder to a remote machine I get this error;

"rsync error: error in rsync protocol data stream (code 12)"

from this command, run from the "host".

Code: Select all

rsync -ahv ~/send/ 192.168.0.101:~/send
Researching the error here;
https://bobcares.com/blog/rsync-error-code-12/

The reasons given;
1, insufficient disk space
2, missing remote rsync
3, failure due to idle connection

None of those reasons are the case here.
Somewhere else suggested a mismatch in rsync versions, IDK if that is the case as the "host" machine is Mint 19, and the "client" is Mint 21, and rsync is a slightly different version.

The funny thing is I was able to "pull" the folder via the client from the host by reversing the command,
This worked from the client.

Code: Select all

rsync -ahv 192.168.0.100:~/send/ ~/send
And funnier still, I tried the same command today, from the host, and got a different error,

Code: Select all

ssh: connect to host 192.168.0.100 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
Can anyone explain, is it the different versions of rsync, (3.1.2-2 on M19, and 3.2.3-8 on M21) or something else ?
Last edited by LockBot on Wed May 24, 2023 10:00 pm, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: "rsync error: error in rsync protocol data stream (code 12)"

Post by Termy »

Given you got an SSH error, I don't think it's an rsync(1) version mismatch. Try with scp(1), if you're using SSH under the hood anyway; be interesting to see if that yields a similar naff result. Usually when I get something like that with SSH, it's because it's ill-configured, either the firewall or SSH itself.

Hang on, with that command you used, is it normal to not specify a username? Because that would be an issue with SSH, unless the server has the same username and it's available.
I'm also Terminalforlife on GitHub.
rickNS
Level 9
Level 9
Posts: 2977
Joined: Tue Jan 25, 2011 11:59 pm

Re: "rsync error: error in rsync protocol data stream (code 12)"

Post by rickNS »

Termy wrote: Sat Nov 26, 2022 3:50 pm ...
Thanks Termy,
About same result with scp, "connection refused"

Code: Select all

scp -r ~/send2/ 192.168.0.100:~/send2
ssh: connect to host 192.168.0.100 port 22: Connection refused
lost connection
Again I was able to pull the folder using same (reversed) command from the remote machine.

1, there are no firewall activated on either (any) machine.

"is it normal to not specify a username?"

The <USERNAME>@ part is not needed if same user on both machines.

You are correct about the version of rsync NOT being the cause as I just did a send to another machine with Mint 21...no problem there.

I have occasionally noticed this kind of error in the past, but never looked into it.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: "rsync error: error in rsync protocol data stream (code 12)"

Post by Termy »

Wracking my brains trying to remember times I've had this issue.

Just in-case there's an issue with the SSH Daemon service, run systemctl status ssh on the remote machine, then share the output. I think that would be a different error message, but I can't remember off-hand. My brain pretty much just comes back to firewall, authentication issues (IE: bad key), service stuff, and SSH configuration. I know you said you don't have the firewall enabled on any of the machines, so if you're certain of that, I'll take your word for it. Are you using keys or passwords?
I'm also Terminalforlife on GitHub.
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

Re: "rsync error: error in rsync protocol data stream (code 12)"

Post by deepakdeshp »

If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
rickNS
Level 9
Level 9
Posts: 2977
Joined: Tue Jan 25, 2011 11:59 pm

Re: "rsync error: error in rsync protocol data stream (code 12)"

Post by rickNS »

Termy wrote: Sat Nov 26, 2022 8:29 pm run systemctl status ssh on the remote machine, then share the output.

Code: Select all

rick@x200;~$ systemctl status ssh
Unit ssh.service could not be found
A bit strange as I "thought" I had installed all the same software on all my machines...anyway.

So I installed openssh-server
then ran systemctl start ssh.service
Termy wrote: Sat Nov 26, 2022 8:29 pm Are you using keys or passwords?
No passwords, but there are "keys", or "fingerprints" which sometimes change, perhaps due to updates ? (one more reason I don't like updates)

So trying to run the rsync command again I get;

Code: Select all

rick@t420 ~ $ rsync -ahv ~/send2/ 192.168.0.100:~/send2
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:1LxuIHiU8J9CB2rZPHAOPCdam26Iz8ZscSSayy76BMg.
Please contact your system administrator.
Add correct host key in /home/rick/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/rick/.ssh/known_hosts:4
  remove with:
  ssh-keygen -f "/home/rick/.ssh/known_hosts" -R "192.168.0.100"
ECDSA host key for 192.168.0.100 has changed and you have requested strict checking.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
This error I have also seen before.
Follow the on screen directions, and now it works as should.
Will have to test after a reboot though....

Yes works after reboot
SOLVED.
Thank you very much.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: [SOLVED] "rsync error: error in rsync protocol data stream (code 12)"

Post by Termy »

You're welcome. You just forgot to actually install the SSH server on the remote machine. I'll be honest, I've made the same mistake before. :roll:

BTW, updates should never ever do anything to your SSH keys.
I'm also Terminalforlife on GitHub.
Locked

Return to “Software & Applications”