FTP fails connection in weewx, but works with manual connection

155 views
Skip to first unread message

F Y

unread,
Dec 10, 2025, 3:57:28 PM (7 days ago) Dec 10
to weewx-user
I have an unusual FTP problem.  I recently moved my weather server from online to a locally hosed web server running on a Synology NAS.  No matter what I do, I can not get the FTP transfer to work with the new server on the Synology NAS.

I'm running weewx 4.10.x
The conf file has all the correct login information and the NAS is seemingly set up correctly because I can manually FTP into the NAS and transfer files with no issue.

*When weewx used FTP to access the online service over the last 2 years, everything worked as expected.

* user and PW are exactly the same if manual or in weewx.conf

-FTP server = Synology NAS DS718+
-Using standard FTP, not FTPs or SFTP
-weewx running on Rpi4 (bullseye)
-error from log file is always "ConnectionRefusedError:  [Errno  111] Connection Refused
ftpgenerator: upload failed

I'd rather not move to weewx v5.x, unless there is no other solution to my problem




vince

unread,
Dec 10, 2025, 4:13:17 PM (7 days ago) Dec 10
to weewx-user
Connection refused generally means you are trying to connect to a server:port combination that the remote computer isn't listening on.

Did you edit weewx.conf to change the 'server' and 'port' settings to match your NAS setup 'and' also restart weewx ?

Tom Keffer

unread,
Dec 10, 2025, 4:18:15 PM (7 days ago) Dec 10
to weewx...@googlegroups.com
Adding to what Vince said,

- Moving to v5.x won't get you anything. The FTP code is exactly the same.
- Try running with debug=2. This will give you (voluminous) FTP information in the log.

-tk

--
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 visit https://groups.google.com/d/msgid/weewx-user/0016cd45-2132-4863-b55d-7df6fd74d32en%40googlegroups.com.

F Y

unread,
Dec 10, 2025, 4:51:04 PM (7 days ago) Dec 10
to weewx-user
Yes, weewx.conf file is updated to the correct server and port information.  And, as stated, I CAN connect to the server manually with the same info over the same port 21, just won't connect with weewx doing the FTP

F Y

unread,
Dec 10, 2025, 4:52:55 PM (7 days ago) Dec 10
to weewx-user
And yes, weewx was stopped and restarted multiple times as I tried a variety of things to get it to work.  Will try the debug=2 to see what that tells me

F Y

unread,
Dec 10, 2025, 8:16:41 PM (7 days ago) Dec 10
to weewx-user

After setting debug=2, this is the result of the still failing attempts to get FTP to connect from weewx:


Restarting weewx after the weewx.conf change and running the report I get this:


pi@raspberrypi:/var/log $ sudo /bin/wee_reports /etc/weewx/weewx.conf

Generating as of last timestamp in the database.

Using configuration file /etc/weewx/weewx.conf

*get* '220 Diskstation1005 FTP server ready.\n'

*resp* '220 Diskstation1005 FTP server ready.'

*cmd* 'USER forrest'

*put* 'USER forrest\r\n'

*get* '331 Password required for forrest.\n'

*resp* '331 Password required for forrest.'

*cmd* 'PASS *************'

*put* 'PASS *************\r\n'

*get* '230 User forrest logged in.\n'

*resp* '230 User forrest logged in.'

*cmd* 'MKD /web/gsdglobal/Weather_GTB'

*put* 'MKD /web/gsdglobal/Weather_GTB\r\n'

*get* '550 /web/gsdglobal/Weather_GTB: File exists.\n'

*resp* '550 /web/gsdglobal/Weather_GTB: File exists.'

*cmd* 'TYPE I'

*put* 'TYPE I\r\n'

*get* '200 Type set to I.\n'

*resp* '200 Type set to I.'

*cmd* 'PASV'

*put* 'PASV\r\n'

*get* '227 Entering Passive Mode (127,0,0,1,218,66)\n'

*resp* '227 Entering Passive Mode (127,0,0,1,218,66)'

*cmd* 'QUIT'

*put* 'QUIT\r\n'

*get* '221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.\n'

*resp* '221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.'

*get* '220 Diskstation1005 FTP server ready.\n'

*resp* '220 Diskstation1005 FTP server ready.'

*cmd* 'USER forrest'

*put* 'USER forrest\r\n'

*get* '331 Password required for forrest.\n'

*resp* '331 Password required for forrest.'

*cmd* 'PASS *************'

*put* 'PASS *************\r\n'

*get* '230 User forrest logged in.\n'

*resp* '230 User forrest logged in.'

*cmd* 'MKD /web/gsdglobal/Weather_GTB'

*put* 'MKD /web/gsdglobal/Weather_GTB\r\n'

*get* '550 /web/gsdglobal/Weather_GTB: File exists.\n'

*resp* '550 /web/gsdglobal/Weather_GTB: File exists.'

*cmd* 'TYPE I'

*put* 'TYPE I\r\n'

*get* '200 Type set to I.\n'

*resp* '200 Type set to I.'

*cmd* 'PASV'

*put* 'PASV\r\n'

*get* '227 Entering Passive Mode (127,0,0,1,218,78)\n'

*resp* '227 Entering Passive Mode (127,0,0,1,218,78)'

*cmd* 'QUIT'

*put* 'QUIT\r\n'

*get* '221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.\n'

*resp* '221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.'

*get* '220 Diskstation1005 FTP server ready.\n'

*resp* '220 Diskstation1005 FTP server ready.'

*cmd* 'USER forrest'

*put* 'USER forrest\r\n'

*get* '331 Password required for forrest.\n'

*resp* '331 Password required for forrest.'

*cmd* 'PASS *************'

*put* 'PASS *************\r\n'

*get* '230 User forrest logged in.\n'

*resp* '230 User forrest logged in.'

*cmd* 'MKD /web/gsdglobal/Weather_GTB'

*put* 'MKD /web/gsdglobal/Weather_GTB\r\n'

*get* '550 /web/gsdglobal/Weather_GTB: File exists.\n'

*resp* '550 /web/gsdglobal/Weather_GTB: File exists.'

*cmd* 'TYPE I'

*put* 'TYPE I\r\n'

*get* '200 Type set to I.\n'

*resp* '200 Type set to I.'

*cmd* 'PASV'

*put* 'PASV\r\n'

*get* '227 Entering Passive Mode (127,0,0,1,218,79)\n'

*resp* '227 Entering Passive Mode (127,0,0,1,218,79)'

*cmd* 'QUIT'

*put* 'QUIT\r\n'

*get* '221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.\n'

*resp* '221 Goodbye. You uploaded 0 bytes and downloaded 0 bytes.'

pi@raspberrypi:/var/log $ 



And here is the last 100 lines of the log file after startup:

pi@raspberrypi:~ $ journalctl -u weewx | tail -n 100

Dec 10 17:58:02 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Requesting 200 LOOP packets.

Dec 10 17:58:03 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Successfully woke up Vantage console

Dec 10 18:00:14 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Getting archive packets since 2025-12-10 17:30:00 MST (1765413000)

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Successfully woke up Vantage console

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Retrieving 1 page(s); starting index= 3

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] INFO weewx.manager: Added record 2025-12-10 18:00:00 MST (1765414800) to database 'weewx.sdb'

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] INFO weewx.manager: Added record 2025-12-10 18:00:00 MST (1765414800) to daily summary in 'weewx.sdb'

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: DMPAFT complete: page timestamp 2025-10-18 11:30:00 MDT (1760808600) less than final timestamp 2025-12-10 18:00:00 MST (1765414800)

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Catch up complete.

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Running reports for latest time in the database.

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Requesting 200 LOOP packets.

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Running report 'SeasonsReport'

Dec 10 18:00:15 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/Seasons/skin.conf for report 'SeasonsReport'

Dec 10 18:00:16 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.cheetahgenerator: Using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.DisplayOptions', 'weewx.cheetahgenerator.Extras', 'weewx.cheetahgenerator.Gettext', 'weewx.cheetahgenerator.JSONHelpers', 'weewx.cheetahgenerator.PlotInfo', 'weewx.cheetahgenerator.SkinInfo', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo']

Dec 10 18:00:16 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.manager: Daily summary version is 4.0

Dec 10 18:00:16 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.drivers.vantage: Successfully woke up Vantage console

Dec 10 18:00:18 raspberrypi python3[353842]: weewx[353842] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 2.25 seconds

Dec 10 18:00:18 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.manager: Daily summary version is 4.0

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] INFO weewx.imagegenerator: Generated 54 images for report SeasonsReport in 4.87 seconds

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] INFO weewx.reportengine: Copied 5 files to /var/www/html/weewx

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Report 'SmartphoneReport' not enabled. Skipping.

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Report 'MobileReport' not enabled. Skipping.

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Report 'StandardReport' not enabled. Skipping.

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Running report 'StackedWindRose'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/StackedWindRose/skin.conf for report 'StackedWindRose'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Cannot read localization file /etc/weewx/skins/StackedWindRose/lang/en.conf for report 'StackedWindRose': Config file not found: "/etc/weewx/skins/StackedWindRose/lang/en.conf".

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: **** Using defaults instead.

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.manager: Daily summary version is 4.0

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.04 seconds

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Running report 'FTP'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/Ftp/skin.conf for report 'FTP'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: Cannot read localization file /etc/weewx/skins/Ftp/lang/en.conf for report 'FTP': Config file not found: "/etc/weewx/skins/Ftp/lang/en.conf".

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weewx.reportengine: **** Using defaults instead.

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: Attempting connection to 100.122.175.72

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: Connected to 100.122.175.72

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: 0 ./yearvolt.png a2a9c2b124013c1fafaaa0bcd25184333bf0f7ef50147f8ae945b6b24b133d82

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weeutil.ftpupload: Failed uploading /var/www/html/weewx/yearvolt.png to server 100.122.175.72. Reason: '[Errno 111] Connection refused'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine: ftpgenerator: (0): caught exception '<class 'ConnectionRefusedError'>': [Errno 111] Connection refused

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****  Traceback (most recent call last):

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 437, in run

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      n = ftp_data.run()

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weeutil/ftpupload.py", line 220, in run

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      ftp_server.storbinary(stor_cmd, fd)

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 491, in storbinary

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      with self.transfercmd(cmd, rest) as conn:

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 386, in transfercmd

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      return self.ntransfercmd(cmd, rest)[0]

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 347, in ntransfercmd

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      conn = socket.create_connection((host, port), self.timeout,

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/socket.py", line 843, in create_connection

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      raise err

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/socket.py", line 831, in create_connection

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      sock.connect(sa)

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****  ConnectionRefusedError: [Errno 111] Connection refused

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: Attempting connection to 100.122.175.72

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: Connected to 100.122.175.72

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: 0 ./yearvolt.png a2a9c2b124013c1fafaaa0bcd25184333bf0f7ef50147f8ae945b6b24b133d82

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weeutil.ftpupload: Failed uploading /var/www/html/weewx/yearvolt.png to server 100.122.175.72. Reason: '[Errno 111] Connection refused'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine: ftpgenerator: (1): caught exception '<class 'ConnectionRefusedError'>': [Errno 111] Connection refused

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****  Traceback (most recent call last):

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 437, in run

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      n = ftp_data.run()

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weeutil/ftpupload.py", line 220, in run

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      ftp_server.storbinary(stor_cmd, fd)

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 491, in storbinary

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      with self.transfercmd(cmd, rest) as conn:

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 386, in transfercmd

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      return self.ntransfercmd(cmd, rest)[0]

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 347, in ntransfercmd

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      conn = socket.create_connection((host, port), self.timeout,

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/socket.py", line 843, in create_connection

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      raise err

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/socket.py", line 831, in create_connection

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      sock.connect(sa)

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****  ConnectionRefusedError: [Errno 111] Connection refused

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: Attempting connection to 100.122.175.72

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: Connected to 100.122.175.72

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] DEBUG weeutil.ftpupload: 0 ./yearvolt.png a2a9c2b124013c1fafaaa0bcd25184333bf0f7ef50147f8ae945b6b24b133d82

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weeutil.ftpupload: Failed uploading /var/www/html/weewx/yearvolt.png to server 100.122.175.72. Reason: '[Errno 111] Connection refused'

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine: ftpgenerator: (2): caught exception '<class 'ConnectionRefusedError'>': [Errno 111] Connection refused

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****  Traceback (most recent call last):

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 437, in run

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      n = ftp_data.run()

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weeutil/ftpupload.py", line 220, in run

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      ftp_server.storbinary(stor_cmd, fd)

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 491, in storbinary

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      with self.transfercmd(cmd, rest) as conn:

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 386, in transfercmd

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      return self.ntransfercmd(cmd, rest)[0]

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/ftplib.py", line 347, in ntransfercmd

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      conn = socket.create_connection((host, port), self.timeout,

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/socket.py", line 843, in create_connection

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      raise err

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****    File "/usr/lib/python3.9/socket.py", line 831, in create_connection

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****      sock.connect(sa)

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine:         ****  ConnectionRefusedError: [Errno 111] Connection refused

Dec 10 18:00:23 raspberrypi python3[353842]: weewx[353842] ERROR weewx.reportengine: ftpgenerator: Upload failed


pi@raspberrypi:~ $ 

vince

unread,
Dec 10, 2025, 8:37:06 PM (7 days ago) Dec 10
to weewx-user
The address indicated in your logs of 100.122.175.72 is a 'very' unusual address.  A quick lookup at https://en.wikipedia.org/wiki/Private_network says it's related to carrier-grade NAT.

  • Are your weewx system and your NAS on the same LAN ?
  • What is the ip address of each ?
  • Which ip address have you been connecting to when you run ftp manually ?
I wonder if you're doing a DNS lookup perhaps on your weewx system and it's resolving to an external NAT'd address (which I would expect to fail) rather than to an internal not-NAT'd address which might work.

F Y

unread,
Dec 10, 2025, 10:03:59 PM (7 days ago) Dec 10
to weewx-user
I figured that "unusual" ip address would come up.  That is an ip address of one of the machines in my "tailnet", which is a mesh virtual VPN running thru "Tailscale" (tailscale.com).  Since many of my machines are behind CGNAT, this is the only way to keep them connected remotely. 

 In answer to your questions:

  • Are your weewx system and your NAS on the same LAN ?
    •   They are, but they are communicating thru tailscale with their mesh ip addresses.  The NAS and the rPi each have their own ip address in the 100.x.x.x segment
  • What is the ip address of each ? 
    • As stated above, they each have their own address in that segment.  It is not reachable by anyone but other machines in my tailnet ... all of which are in the 100.x.x.x segment
  • Which ip address have you been connecting to when you run ftp manually ?  
    • I can connect manually to the 100.122.175.72 address, which is the NAS.  Manual communication between rPi and the NAS is problem free.  
From the wee_report (above the logs) you will also see the connection made to "Diskstation1005".  This IS the NAS at the 100.122.175.72 address.  That report indicates a connection since it is able to read the destination folder and that it exists.  However it then "quit" 's after a PASV command with a weird loopback address of 127.0.0.1, 218,66 and 78 on subsequient attempts

The "visibility" of the NAS from the rPi is seamless.  There is no DNS resolution of any sort.  The weewx.conf file lists the FTP server simply with the 100.x.x.x address.  I can ping the address from the rPi with solid results

Jimi Lawson

unread,
Dec 10, 2025, 10:18:52 PM (7 days ago) Dec 10
to weewx-user
*get* '550 /web/gsdglobal/Weather_GTB: File exists.\n'   
Is this not relevant ? i.e is the server not allowing overwriting of an existing file ?

vince

unread,
Dec 10, 2025, 10:40:42 PM (7 days ago) Dec 10
to weewx-user
FTP through NAT and FTP’s use of ephemeral ports can be a pain to handle on the NATing system in the flow between client and server.  If there is a function like a stateful firewall on the NATing device it gets more difficult.  Stateful firewalls are not always straightforward,

If your client works ok to a server when both are on the same subnet with no routes, vpm, or nat in between…and then fails when you go client<==>server via a more complicated path, the issue is likely your more complicated network setup.

Can you enable ssh into the NAS and switch to using the Rsync uploader perhaps ?  That is simpler, faster, and more reliable than ancient FTP.

F Y

unread,
Dec 11, 2025, 12:53:10 PM (6 days ago) Dec 11
to weewx-user
Thanks Jimi.  I don't know if it's relevant or not.  I don't know what the *get* '550 command is about, but the " /web/gsdglobal/Weather_GTB" is the folder location to which the files should be copied (as specified in the weewx.conf file).  I also don't know what the response \n' means either.  I can confirm, however, that it does not matter whether the folder has any files in it or not.  Weewx still fails to put anything in the folder, but I am still able to put files there thru manual FTP regardless of whether they exist there or not.

F Y

unread,
Dec 11, 2025, 1:00:58 PM (6 days ago) Dec 11
to weewx-user
Thanks for the input ... this is an interesting challenge for sure and I appreciate the help.  I understand enough about the nuances of NAT's and double NAT's, etc to be dangerous and I understand what you are implying regarding what "may" be in the way while using the more complicated path.  But that then leaves me still wondering what underlying communication methods/commands may be taking place within the weewx script that makes it eventually fail, while a simple manual FTP entry at the terminal does the job without issue.

As to Rsync, you have read my mind and this is the next thing to try if I can not get FTP to work.  

vince

unread,
Dec 11, 2025, 1:31:48 PM (6 days ago) Dec 11
to weewx-user
I recreated your error exactly between a weewx 5.2 vagrant vm and another pi that I had on my LAN.  I could log interactively into the ftp server, but not write to it even though os permissions were ok.

The issue was the ftp server software configuration (vsftpd in this case) which defaults to letting you log in, but not letting you write.  Uncommenting one line in /etc/vsftpd.conf and restarting vsftpd fixed things. See the default answer in https://askubuntu.com/questions/410947/permission-denied-in-ftp-even-though-im-the-owner for details.

Also - I fiddled with active or passive mode a little. If you see "Failed uploading...... Reason: '500 Illegal PORT command.'" that means you're set in weewx to be in active mode and the server wants passive.  That happened to me too.  Setting weewx back to the default passive worked fine afterwards.  The FTP uploader worked fine at that point.

I can't speak to how you might set up the ftp server on your NAS, but that's where the issue is.

F Y

unread,
Dec 12, 2025, 1:21:12 PM (5 days ago) Dec 12
to weewx-user
After your suggestion, I went back to the NAS and double confirmed that write was enabled.  But I could only do this via the NAS gui.  I will need to do more research into the location of the conf file having to do with this implementation of FTP.

In the mean time I went to working on Rsync.  At first I was blocked up with the passwordless access required by weewx.  I eventually got that resolved and now have exactly the same problem... I can manually rsync from the rPi to the NAS without issue, but when weewx tries, it fails.  I worked on all sorts of permission and file owner combinations in the relevant strategic locations and weewx always failed.

Now I have it running, but only in a temporary workaround mode, meaning I simply setup a cronjob on the rPi to Rsync the html folder over to the NAS every time weewx post another report.  Why weewx can not do the same thing is really a head scratcher.

vince

unread,
Dec 12, 2025, 1:35:44 PM (5 days ago) Dec 12
to weewx-user
In the absence of logs, can’t help much.

A quick lookup of what synology supports seems to indicate you need to permit write access for each user you define there.  If you’re using rsync the public key of the weewx-side user also has to be permitted in on the NAS side in whatever synology uses that is like a ssh authorized keys file.

Maybe these might help. I did google searches for ‘ftp to synology nas’ and ‘rsync to synology nas’ and got many hits.


F Y

unread,
Dec 12, 2025, 1:50:27 PM (5 days ago) Dec 12
to weewx-user
So, if I understand, you are saying the "username" on the pi running weewx, MUST be the same "username" on the NAS permitting rsync?  Currently the "userPI" has the authorized keys that match-up with the "userNAS", which is, I assume, why the manual Rsync from the rPi (as "userPi") does connect and work with the NAS ("userNAS").  

vince

unread,
Dec 12, 2025, 2:29:51 PM (5 days ago) Dec 12
to weewx-user
Nope.  The usernames on the two sides can be different.  Mine are.  You just need to follow the standard required ssh setup for passwordless key-based login on both sides.  Nothing more.

"Why weewx can not do the same thing is really a head scratcher." - not really.  What account is your cron job running as ?  If it's not the account weewx is running as, it's not a valid test.

Assuming you're running the debian package installation of weewx:
  • weewx v5 runs as user 'weewx'.  If you're running weewx v5 you have to have the user 'weewx' .ssh tree set up correctly for its rsync to work
  • weewx v4 runs as user 'root'.  If you're running weewx v5 you need root's .ssh tree set up correctly for its rsync to work
I have no idea what 'userPI' is, but if you're testing from an account you created with that username, that's not going to get weewx rsync working.  You need to get the .ssh tree of 'the account weewx runs as' set up correctly on the client side, and of course make sure the remote server side lines up with that.

F Y

unread,
Dec 12, 2025, 5:00:20 PM (5 days ago) Dec 12
to weewx-user
I'm running weewx V4.10.2, and the cronjob was created under the standard "userPi" account. 
Following your information regarding weewx running as root, I ran a new ssh-keygen as root and copied over the public keys to the NAS.  Unfortunately failure is still the name of the game.  Here's the last logs:


Dec 12 14:30:50 raspberrypi python3[361521]: weewx[361521] ERROR weeutil.rsyncupload: **** Permission denied, please try again.

Dec 12 14:30:50 raspberrypi python3[361521]: weewx[361521] ERROR weeutil.rsyncupload: **** Permission denied, please try again.

Dec 12 14:30:50 raspberrypi python3[361521]: weewx[361521] ERROR weeutil.rsyncupload: **** Wg...@100.122.175.72: Permission denied (publickey,password).

Dec 12 14:30:50 raspberrypi python3[361521]: weewx[361521] ERROR weeutil.rsyncupload: **** rsync: connection unexpectedly closed (0 bytes received so far) [sender]

Dec 12 14:30:50 raspberrypi python3[361521]: weewx[361521] ERROR weeutil.rsyncupload: **** rsync error: error in rsync protocol data stream (code 12) at io.c(228) [sender=3.2.3]

Running the rsync manually still works, but weewx still can not.

It must be some permission thing or I have messed up the keygens.
-When I run the Rsync manually from the Pi as "userPi", it works
-When I run the Rsync as root, the command asks me to provide the password for "userNAS" (most likely the reason for the weewx fail)
-Yet if I ssh into the NAS as "userNAS", it is automatically connected, no password required

vince

unread,
Dec 12, 2025, 5:19:09 PM (5 days ago) Dec 12
to weewx-user
When I run the Rsync as root, the command asks me to provide the password for "userNAS" (most likely the reason for the weewx fail)

-  again, since v4 weewx runs as root, you need the weewx computer 'root' user authorized on the far side.   If you see it asking for a password when weewx runs, this is not the case quite yet.

- since your userPi account seems to be authorized ok, another way is to setup the weewx system's "root" account to use the userPi keypair specifically.  Just sudo to root and copy those working userPi keys to the /root/.ssh directory (change the name of the key files) and specify using 'that' key in /root/.ssh/config.  This is how I do it on my system to my remote server.  Just make sure the permissions are root:root mode 600 when you're done.  The logs will bark and it'll fail if you get the permissions messed up.

Here's an example .ssh/config file

# see which hostname/ip a key in known_hosts is for
HashKnownHosts no

# define my target system by both name and stable address
Host mynas x.x.x.x                           # create a hostname alias for ssh
 IdentityFile ~/.ssh/id_rsa_weewxrsync       # use this key specifically
 user myremoteuser                           # to this remote user by default
 hostname x.x.x.x                            # the name or ip address of the remote system

The result lets me set a default for 'ssh mynas' and it'll do the same thing as 'ssh myremo...@x.x.x.x' without so much typing.  You'd want to use any of the ssh aliases on the Host line above in your weewx.conf file, and of course tell it which remote user to use and from/to paths.

The example above names the keypair id_rsa_weewxrsync (and .pub) but you can name them anything you want really.

F Y

unread,
Dec 13, 2025, 12:54:16 PM (4 days ago) Dec 13
to weewx-user
THAT was the answer!!

Copying over the authentication key and writing the config file solved the problem and weewx is now running the rsync without error!

Double thanks to all that chimed in on this issue.

Reply all
Reply to author
Forward
0 new messages