rtlsdr driver permission error

104 views
Skip to first unread message

Wayne

unread,
Feb 22, 2025, 6:07:27 PM2/22/25
to weewx Group
I am attempting to install a new weewx driver in my RPi-4 (Raspbian 12 "bookworm") system. I am running weewx Ver 5.1.0 (DEB package install). The driver I am attempting to install is the rtldavis Software Defined Radio (SDR) for the Davis Vantage system.

This driver consists of (1) a Go language-based sdr receiver application (rtldavis) which implements the receiver code and (2) the weewx driver extension weewx-rtldavis which runs as rtldavis.py. rtldavis.py basically performs the data parsing of the output of rtldavis.

I compiled and installed the Go-based rtldavis code (using V 1.15 golang compiler version per advice from vinceskahan and others) and am able to run it standalone and successfully receive the Davis sensor suite (ISS) data packets. This appears to work under my normal user login (as opposed to the weewx user). The output of a recent run of this code is shown below:

*******************************************************************************************************************************
ace@nimbus:~ $ rtldavis -tr 1 -tf US
12:39:52.016217 rtldavis.go VERSION=0.15
12:39:52.016993 tr=1 fc=0 ppm=0 gain=0 maxmissed=51 ex=0 receiveWindow=300 actChan=[0] maxChan=1
12:39:52.017048 undefined=false verbose=false disableAfc=false deviceString=0
12:39:52.017486 BitRate: 19200
12:39:52.017531 SymbolLength: 14
12:39:52.017554 SampleRate: 268800
12:39:52.017575 Preamble: 1100101110001001
12:39:52.017605 PreambleSymbols: 16
12:39:52.017626 PreambleLength: 224
12:39:52.017646 PacketSymbols: 80
12:39:52.017667 PacketLength: 1120
12:39:52.017695 BlockSize: 512
12:39:52.017717 BufferLength: 2048
Detached kernel driver
Found Rafael Micro R820T tuner
12:39:52.526214 Hop: {ChannelIdx:0 ChannelFreq:902419338 FreqError:0 Transmitter:0}
Exact sample rate is: 268800.001367 Hz
12:39:52.702827 GetTunerGain: 0 Db
12:39:52.702908 SetFreqCorrection 0 ppm Successful
Allocating 1 zero-copy buffers
12:39:52.706454 Init channels: wait max 135 seconds for a message of each transmitter
12:40:57.599610 TRANSMITTER 0 SEEN
12:40:57.599839 Hop: {ChannelIdx:19 ChannelFreq:911952597 FreqError:0 Transmitter:0}
12:41:00.161528 duplicate packet: 800CEC1F1B0B9563
12:41:00.525329 ID:0 packet missed (1), missed per freq: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
12:41:00.525559 Hop: {ChannelIdx:41 ChannelFreq:922991108 FreqError:0 Transmitter:0}
12:41:02.723483 E00CEF3401016A62 2 0 0 0 0 msg.ID=0
12:41:02.723640 Hop: {ChannelIdx:25 ChannelFreq:914963100 FreqError:0 Transmitter:0}
12:41:05.287110 5009FBFF730C0A5F 3 0 0 0 0 msg.ID=0
12:41:05.287248 Hop: {ChannelIdx:8 ChannelFreq:906433342 FreqError:0 Transmitter:0}
12:41:07.848922 duplicate packet: 5009FBFF730C0A5F
12:41:08.212964 ID:0 packet missed (1), missed per freq: [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
12:41:08.213078 Hop: {ChannelIdx:47 ChannelFreq:926001611 FreqError:0 Transmitter:0}
12:41:10.774953 ID:0 packet missed (2), missed per freq: [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
12:41:10.775076 Hop: {ChannelIdx:32 ChannelFreq:918475353 FreqError:0 Transmitter:0}
12:41:12.972924 E00EEE340108C97C 4 0 0 0 0 msg.ID=0
12:41:12.973093 Hop: {ChannelIdx:13 ChannelFreq:908942094 FreqError:0 Transmitter:0}
12:41:15.536887 duplicate packet: E00EEE340108C97C
12:41:15.898466 ID:0 packet missed (1), missed per freq: [0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
12:41:15.898635 Hop: {ChannelIdx:36 ChannelFreq:920482355 FreqError:0 Transmitter:0}
12:41:18.098802 800DEB1F19038975 5 0 0 0 0 msg.ID=0
12:41:18.098921 Hop: {ChannelIdx:22 ChannelFreq:913457849 FreqError:0 Transmitter:0}
12:41:20.660709 200BF2D4C10127C2 6 0 0 0 0 msg.ID=0
12:41:20.661123 Hop: {ChannelIdx:3 ChannelFreq:903924589 FreqError:0 Transmitter:0}
12:41:23.222601 duplicate packet: 200BF2D4C10127C2
12:41:23.224373 duplicate packet: 200BF2D4C10127C2
12:41:23.586331 ID:0 packet missed (1), missed per freq: [0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
12:41:23.586505 Hop: {ChannelIdx:29 ChannelFreq:916970102 FreqError:0 Transmitter:0}
12:41:25.786398 500CEDFF720A46C1 7 0 0 0 0 msg.ID=0
12:41:25.786585 Hop: {ChannelIdx:44 ChannelFreq:924496359 FreqError:0 Transmitter:0}
12:41:28.348216 800CF51F1905FA1F 8 0 0 0 0 msg.ID=0
12:41:28.348339 Hop: {ChannelIdx:16 ChannelFreq:910447346 FreqError:0 Transmitter:0}
^CReattached kernel driver
ace@nimbus:~ $
**********************************************************************************************************************************
This tells me that the SDR receive hardware is working and the SDR rtldavis code is functioning.

But when I start weewx via systemctl I get an error "Failed to start process: [Errno 13] Permission denied" for the sdr driver file: /home/ace/go/bin/rtldavis. This is the very same code which I can run standalone as shown above.

Yes, I have read and reread the helpful "What you should know about permissions" section of the FAQ.

The permissions on this file are:

-rwxr-xr-x 1 root weewx 2254092 Feb 11 16:45 /home/ace/go/bin/rtldavis

I believe I have the udev rule for the SDR receiver written correctly, especially because I can run the driver by itself successfully. I am at a loss for what else to look at. The error log from journalctl is presented below:

****************************************************************************************************************************
Feb 22 12:21:31 nimbus systemd[1]: Started weewx.service - WeeWX.
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Initializing weewxd version 5.1.0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Using Python: 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0]
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Located at: /usr/bin/python3
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Platform: Linux-6.6.74+rpt-rpi-v8-aarch64-with-glibc2.36
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Locale: 'en_US.UTF-8'
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Entry path: /usr/share/weewx/weewxd.py
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: WEEWX_ROOT: /etc/weewx
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Config file: /etc/weewx/weewx.conf
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: User module: /etc/weewx/bin/user
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Debug: 0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: User: weewx
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Group: weewx
Feb 22 12:21:32 nimbus weewxd[8016]: INFO __main__: Groups: adm dialout cdrom audio video plugdev games users input render netdev lpadmin weewx gpio i2c spi ace
Feb 22 12:21:32 nimbus weewxd[8016]: INFO weewx.engine: Loading station type Rtldavis (user.rtldavis)
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: driver version is 0.20
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using rain_bucket_type 0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: sensor map is: {'pressure': 'pressure', 'inTemp': 'temp_in', 'windSpeed': 'wind_speed', 'windDir': 'wind_dir', 'outTemp': 'temperature', 'outHumidity': 'humidity', 'inHumidity': 'humidity_in', 'rainRate': 'rain_rate', 'radiation': 'solar_radiation', 'UV': 'uv', 'soilTemp1': 'soil_temp_1', 'soilTemp2': 'soil_temp_2', 'soilTemp3': 'soil_temp_3', 'soilTemp4': 'soil_temp_4', 'leafTemp1': 'leaf_temp_1', 'extraHumid1': 'humid_1', 'extraHumid2': 'humid_2', 'soilMoist1': 'soil_moisture_1', 'soilMoist2': 'soil_moisture_2', 'soilMoist3': 'soil_moisture_3', 'soilMoist4': 'soil_moisture_4', 'leafWet1': 'leaf_wetness_1', 'leafWet2': 'leaf_wetness_2', 'rxCheckPercent': 'pct_good_all', 'txBatteryStatus': 'bat_iss', 'supplyVoltage': 'supercap_volt', 'referenceVoltage': 'solar_power', 'windBatteryStatus': 'bat_anemometer', 'rainBatteryStatus': 'bat_leaf_soil', 'outTempBatteryStatus': 'bat_th_1', 'inTempBatteryStatus': 'bat_th_2', 'extraTemp1': 'pct_good_0', 'extraTemp2': 'pct_good_1', 'extraTemp3': 'pct_good_2', 'leafTemp2': 'pct_good_3', 'consBatteryVoltage': 'freqError0', 'hail': 'freqError1', 'hailRate': 'freqError2', 'heatingTemp': 'freqError3', 'heatingVoltage': 'freqError4'}
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: sensor map is {}
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using frequency US
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using iss_channel 1
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using anemometer_channel 0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using leaf_soil_channel 0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using temp_hum_1_channel 0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using temp_hum_2_channel 0
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: using transmitters 1
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: log_humidity_raw False
Feb 22 12:21:32 nimbus weewxd[8016]: INFO user.rtldavis: startup process '/home/ace/go/bin/rtldavis -tf US -tr 1'
Feb 22 12:21:32 nimbus weewxd[8016]: ERROR weewx.engine: Import of driver failed: failed to start process: [Errno 13] Permission denied: '/home/ace/go/bin/rtldavis' (<class 'weewx.WeeWxIOError'>)
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** Traceback (most recent call last):
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/etc/weewx/bin/user/rtldavis.py", line 452, in startup
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** self._process = subprocess.Popen(cmd.split(' '),
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** self._execute_child(args, executable, preexec_fn, close_fds,
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** raise child_exception_type(errno_num, err_msg, err_filename)
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** PermissionError: [Errno 13] Permission denied: '/home/ace/go/bin/rtldavis'
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: ****
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** During handling of the above exception, another exception occurred:
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: ****
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** Traceback (most recent call last):
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/engine.py", line 115, in setupStation
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** self.console = loader_function(config_dict, self)
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/etc/weewx/bin/user/rtldavis.py", line 146, in loader
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** return RtldavisDriver(engine, config_dict)
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/etc/weewx/bin/user/rtldavis.py", line 814, in __init__
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** self._mgr.startup(self.cmd, self.path, self.ld_library_path)
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** File "/etc/weewx/bin/user/rtldavis.py", line 463, in startup
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** raise weewx.WeeWxIOError("failed to start process: %s" % e)
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL weewx.engine: **** weewx.WeeWxIOError: failed to start process: [Errno 13] Permission denied: '/home/ace/go/bin/rtldavis'
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL __main__: Unable to load driver: failed to start process: [Errno 13] Permission denied: '/home/ace/go/bin/rtldavis'
Feb 22 12:21:32 nimbus weewxd[8016]: CRITICAL __main__: **** Exiting...
Feb 22 12:21:32 nimbus systemd[1]: weewx.service: Main process exited, code=exited, status=4/NOPERMISSION
Feb 22 12:21:32 nimbus systemd[1]: weewx.service: Failed with result 'exit-code'.
*************************************************************************************************************************************

At this point I have reached the limits of my weewx debugging abilities and ask the esteemed group for their advice. It seems like I am close to a working solution (at least pieces of a solution) but obviously have something not right. My thanks in advance for all comments.

Wayne

vince

unread,
Feb 22, 2025, 6:17:29 PM2/22/25
to weewx-user
My wild guess is that the weewx user does not have permission to get down into /home/ace/go/bin to find the rtldavis executable.

Wayne

unread,
Feb 22, 2025, 7:10:50 PM2/22/25
to weewx Group
Well, I did a recursive chown to change the group for all directories and files in the ./go directory tree to weewx. Unfortunately upon starting weewx it reports the identical driver permission error.

I thought it could possibly be related to a runtime library (i.e. librtlsdr). This library was built as part of the install script I followed in the same /home/ace directory tree. But after the "make install" I did "sudo ldconfig" which I understood to make any new libraries available to everyone. If this is not the case, could that cause the file Permission error? How can I test this theory?

vince

unread,
Feb 22, 2025, 9:23:57 PM2/22/25
to weewx-user
My script assumes (requires) you to do a pip installation of weewx, so I have not looked into the differences if you try to use a dpkg installation (which runs as weewx) while building and installing rtlsdr etc. as a 'different' user, in your case user 'ace'.   I suppose you could look into whether you could simply copy the built binary to someplace in user weewx's $PATH (editing user/group appropriately), but I'm wildly speculating basically.  Be sure to edit weewx.conf if you move the built binary someplace other than where you have it now.

Just in case, lets see a "ls -lgd" of /home/ace to make sure you don't have permissions set to 700 or something like that which would I think be too tight for a different user (weewx) to be able to drill down to the stuff in /home/ace/go and below there.

Wayne

unread,
Feb 23, 2025, 9:42:52 AM2/23/25
to weewx Group
Well, that made a difference! The permissions on the directory were:

ace@nimbus:~ $ pwd
/home/ace
ace@nimbus:~ $ ls -lgd
drwx------ 21 ace 4096 Feb 22 16:42 .

...which I change to:

ace@nimbus:~ $ chmod 755 /home/ace
ace@nimbus:~ $
ace@nimbus:~ $ ls -lgd
drwxr-xr-x 21 ace 4096 Feb 23 07:11 .

Now weewx is able to start the rltdavis driver! Major step forward!!!

Now the driver seems to stall after 2 or 3 minutes. This is the next problem to fix. At least it is able to start up.

Thanks Vince for your insightful guess.

Wayne

PS - Yes, I realize your script was for a pip install. I changed directories accordingly and used it mainly as a guide for doing the install manually.
Reply all
Reply to author
Forward
0 new messages