RSYNC port not working in weewx.conf ?

330 views
Skip to first unread message

Chris Alemany

unread,
Jan 1, 2022, 6:43:48 PM1/1/22
to weewx-user
Hello all,

I just switched web hosts and they use port 27 for their SSH/RSYNC connections.  I dutifully entered port = 27 into my RSYNC section (previously there was no port line specified) put the log is reporting that it is trying on port 22.

Thoughts?

Cheers, and Happy New Year,
Chris

gjr80

unread,
Jan 1, 2022, 7:20:01 PM1/1/22
to weewx-user
Hi,

As far as WeeWX is concerned setting the port config option should be all that's needed. Something like (untested):

[StdReport]
    ....
    [[RSYNC]]
        ....
        port = 27

If that is not working I suggest you edit weewx.conf and set debug = 1. Save and restart WeeWX. Have a look at the log, the rsync command line being used by WeeWX should appear in the log.

If the log shows that port 27 is being used by WeeWX then I would be looking elsewhere. Can you rsync with port 27 from the command line? From another machine? Are there any firewalls blocking port 27?

Gary

Chris Alemany

unread,
Jan 1, 2022, 8:10:34 PM1/1/22
to weewx-user
Hi Gary,
Thanks.
Yes I've confirmed rsync works on that port on the computer and from the account needed as well as other computers. I have a cronjob using it as well.
Here's the Debug with the command. It doesn't seem to mention any port so is it ignoring the config for some reason?
I wonder if this is an issue with the Weather34 skin as it appears to be the weather34 specific command that it is failing on. (Note I removed the IP address of my server from the command.

"Jan  1 16:58:03 weewx-pi weewx[17961] DEBUG weeutil.rsyncupload: rsyncupload: cmd: [['rsync', '--archive', '--stats', '-e ssh', '/tmp/weather34/serverdata/', 'us...@changed.ip.for.privacy:/home/user/public_html/weather34/serverdata']]

Jan  1 16:58:03 weewx-pi weewx[17961] ERROR weeutil.rsyncupload: [['rsync', '--archive', '--stats', '-e ssh', '/tmp/weather34/serverdata/', 'us...@changed.ip.for.privacy/home/user/public_html/weather34/serverdata']] reported errors: ssh: connect to host changed.ip.for.privacy 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.3]


Tom Keffer

unread,
Jan 1, 2022, 8:25:27 PM1/1/22
to weewx-user
I just tried setting port = 27 and it worked. 

Either you are using a different weewx.conf than you think you are using, or it was not set correctly in the [[RSYNC]] section

It would really help if you posted the full log. It will tell you which copy of weewx.conf it is using.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/1d922b4e-66d1-4a3e-a20c-1aed297fea1an%40googlegroups.com.

Chris Alemany

unread,
Jan 2, 2022, 12:28:35 AM1/2/22
to weewx-user
I think I've determined the issue.

The rsync command being generated is missing the quotes:
I am working with the weather34 folks and they added some debug in the code so we could see the port being issued, which it does but when I issue the command at the command line I get:
sudo rsync --archive --stats -e ssh -p 27 /var/www/html/weewx/ us...@alberniweather.ca:/home/user/public_html

It is incorrect, the port needs to be in quotes or it ignores -e and uses 22.
The correct command should be:

sudo rsync --archive --stats -e 'ssh -p 27' /var/www/html/weewx/ us...@alberniweather.ca:/home/user/public_html

gjr80

unread,
Jan 2, 2022, 1:34:23 AM1/2/22
to weewx-user
I just browsed through the WeeWX Weather 34 code and saw calls to the WeeWX rsync upload code with the port forced to None. That will cause the rsync uploader (used by the Weather 34 code) to always use port 22. Setting the port number under [StdReport] [[RSYNC]] only affects rsync reports runs under the WeeWX StdReport service (ie it will have no impact on the Weather 34 code).

So yes in all likelihood your issue is with the Weather 34 code and not WeeWX.

Gary

Chris Alemany

unread,
Jan 2, 2022, 1:46:38 AM1/2/22
to weewx-user

I will pass that along, it occurred to me as well that the Standard skin had been updating fine through all of this, so it was definitely weather34 specific. Thanks Gary! 

Tom Keffer

unread,
Jan 2, 2022, 7:53:22 AM1/2/22
to weewx-user
So, it sounds like there are two problems: the weewx code does not include quotes around the -e argument, and the weather34 code doesn't honor the port spec at all.

I'll create a patch for the weewx code later today.

Looked through the weather34 code. It could use a big refactor to leverage some of the services weewx offers. There's a lot of unnecessary code in there. End results are nice, though.



Tom Keffer

unread,
Jan 2, 2022, 10:38:12 AM1/2/22
to weewx-user
Fixed in commit 68bf6c4, to appear in V4.6.

Chris Alemany

unread,
Jan 2, 2022, 12:02:27 PM1/2/22
to weewx-user
I've updated the code in my rsyncupload.py file as well as a fix provided by weather34.py and it is still defaulting to port 22.
Is there a way that I could temporarily have rsyncupload output the actual command it is sending? At this point we only have the error message.

I'm going to go through and make sure I have uploaded the fixed files for both.
Thanks Tom and Gary!

Cheers
Chris

Tom Keffer

unread,
Jan 2, 2022, 2:03:12 PM1/2/22
to weewx-user
The debug code will show you the parameters to the Popen() call that invokes rsync. Unfortunately, that's all you get. Still, it should be enough. What does it show now?

-tk

Chris Alemany

unread,
Jan 2, 2022, 10:08:31 PM1/2/22
to weewx-user

Still the same error essentially. Using the new code for both 
and 
weather34 https://github.com/steepleian/weewx-Weather34/blob/development/user/weather34.py
).

DEBUG log relevant entry:

Jan  2 13:32:36 weewx-pi weewx[4572] DEBUG weeutil.rsyncupload: rsyncupload: cmd: [['rsync', '--archive', '--stats', '-e ssh', '/tmp/weather34/serverdata/', 'us...@100.10.10.10:/home/user/public_html/weather34/serverdata']]

Jan  2 13:32:37 weewx-pi weewx[4572] ERROR weeutil.rsyncupload: [['rsync', '--archive', '--stats', '-e ssh', '/tmp/weather34/serverdata/', 'us...@100.10.10.10:/home/user/public_html/weather34/serverdata']] reported errors: ssh: connect to host 100.10.10.10 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.3]

Jan  2 13:32:37 weewx-pi weewx[4572] INFO weeutil.rsyncupload: rsync executed in 0.12 seconds

Jan  2 13:32:37 weewx-pi weewx[4572] DEBUG user.weather34: do_file_transfer: Rsync complete


gjr80

unread,
Jan 3, 2022, 2:07:37 AM1/3/22
to weewx-user
It would help if you provided a longer log extract, four lines are better than one but it it is still a bit like looking down a straw :). So that we all have a complete picture could your restart WeeWX (keeping debug=1) and let it run for a couple of archive periods. Then post a log extract showing the complete WeeWX startup and the couple of report cycles.

The concern I have from the log extract provided is that I don't see a line similar to:

Jan  2 13:32:37 weewx-pi weewx[4572] DEBUG user.weather34: do_file_transfer: Port = xx

This line should appear if you are running the weather34.py that you linked above (refer weather34.py line 351). It could be that the log entry is missing because you did not include it in the log extract or it could be that you are not running the weather34.py version you think you are. We can't tell without seeing a more complete log extract.

Gary

Chris Alemany

unread,
Jan 3, 2022, 2:02:06 PM1/3/22
to weewx-user
Thanks for this comment Gary. You forced me to reevaluate.. and I realized I was looking at an old install of weewx on my Pi, not the one that was active.  Not used to the Pi's software being installed more spread out.  The two patches are now properly applied and SSH is working well.

Thank you all for your quick work.

Reply all
Reply to author
Forward
0 new messages