Hello, i replied inline.
Pierre-Yves <[email protected]> wrote:
Thanks Vince
I found in rtl-sdr. rules a rule corresponding to my SDR stick :
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", ENV
{ID_SOFTWARE_RADIO}="1", MODE="0660", GROUP="plugdev"
I added the weewx user to that group: "sudo usermod -aG plugdev weewx"
I still can start weewx with the "sudo weewd" command as before but I can't
run weewx in daemon mode. "sudo systemctl start weewx" gives still the same
error :
Feb 14 08:49:54 raspberrypi weewxd[5905]: INFO weewx.engine: Starting main
packet loop.
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr:
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: Nous espérons que
vous avez reçu de votre administrateur système local
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: les consignes
traditionnelles. Généralement, elles se concentrent sur ces trois éléments :
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr:
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: #1) Respectez la
vie privée des autres.
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: #2) Réfléchissez
avant d'utiliser le clavier.
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: #3) De grands
pouvoirs confèrent de grandes responsabilités.
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr:
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: sudo: un terminal est
requis pour lire le mot de passe; utilisez soit l'option -S pour lire depuis
l'entrée standard ou configurez un outil askpass de demande de mot de passe
Feb 14 08:49:54 raspberrypi weewxd[5905]: ERROR user.sdr: sudo: il est
nécessaire de saisir un mot de passe
I don't speak french, but it looks like you still have a sudo command
somewhere in your unit file.
Would you please show us the contents of your running unit file
systemctl show -P FragmentPath weewx.service
will get you the path of that file. cat that file and paste it here or
if you are confident remove the sudo statement in there somwhere at
ExecStart...="sudo /usr......"
because you should not need sudo when you added weewx to the plugdev
group.
That file contains usually also the information what user runs the
daemon in the end.
Feb 14 08:49:54 raspberrypi weewxd[5905]: INFO weewx.engine: Main loop exiting.
Shutting engine down.
Feb 14 08:49:54 raspberrypi weewxd[5905]: INFO user.sdr: shutdown process sudo
/usr/local/bin/rtl_433 -f 868.3M -f 433.92M -H 90 -Y autolevel -s 1024k -R 173
-R 172 -R 42 -M utc -F json
Feb 14 08:49:54 raspberrypi weewxd[5905]: DEBUG user.sdr: close stdout
Feb 14 08:49:54 raspberrypi weewxd[5905]: DEBUG user.sdr: close stderr
Feb 14 08:49:54 raspberrypi weewxd[5905]: Exception in thread stdout-thread:
Feb 14 08:49:54 raspberrypi weewxd[5905]: DEBUG user.sdr: shutdown
stdout-thread
Feb 14 08:49:54 raspberrypi weewxd[5905]: Traceback (most recent call last):
Feb 14 08:49:54 raspberrypi weewxd[5905]: Exception in thread stderr-thread:
Feb 14 08:49:54 raspberrypi weewxd[5905]: Traceback (most recent call last):
Feb 14 08:49:54 raspberrypi weewxd[5905]: File "/usr/lib/python3.9/
threading.py", line 954, in _bootstrap_inner
Feb 14 08:49:54 raspberrypi weewxd[5905]: File "/usr/lib/python3.9/
threading.py", line 954, in _bootstrap_inner
Feb 14 08:49:54 raspberrypi weewxd[5905]: self.run()
Feb 14 08:49:54 raspberrypi weewxd[5905]: File "/etc/weewx/bin/user/sdr.py",
line 198, in run
Feb 14 08:49:54 raspberrypi weewxd[5905]: self.run()
Feb 14 08:49:54 raspberrypi weewxd[5905]: File "/etc/weewx/bin/user/sdr.py",
line 198, in run
Feb 14 08:49:54 raspberrypi weewxd[5905]: for line in iter
(self._fd.readline, ''):
Feb 14 08:49:54 raspberrypi weewxd[5905]: ValueError: PyMemoryView_FromBuffer
(): info->buf must not be NULL
Feb 14 08:49:54 raspberrypi weewxd[5905]: DEBUG user.sdr: shutdown
stderr-thread
Feb 14 08:49:54 raspberrypi weewxd[5905]: for line in iter
(self._fd.readline, ''):
Feb 14 08:49:54 raspberrypi weewxd[5905]: ValueError: PyMemoryView_FromBuffer
(): info->buf must not be NULL
Feb 14 08:49:54 raspberrypi weewxd[5905]: INFO user.sdr: shutdown complete
Feb 14 08:49:54 raspberrypi weewxd[5905]: CRITICAL __main__: Caught
WeeWxIOError: rtl_433 process is not running
Feb 14 08:49:54 raspberrypi weewxd[5905]: CRITICAL __main__: **** Waiting
60.0 seconds then retrying...
Feb 14 08:50:03 raspberrypi weewxd[5905]: INFO __main__: Received signal TERM
(15).
Feb 14 08:50:03 raspberrypi systemd[1]: Stopping WeeWX...
Feb 14 08:50:03 raspberrypi weewxd[5905]: Traceback (most recent call last):
Feb 14 08:50:03 raspberrypi weewxd[5905]: File "/usr/share/weewx/weewxd.py",
line 166, in main
Feb 14 08:50:03 raspberrypi weewxd[5905]: engine.run()
Feb 14 08:50:03 raspberrypi weewxd[5905]: File "/usr/share/weewx/weewx/
engine.py", line 204, in run
Feb 14 08:50:03 raspberrypi weewxd[5905]: for packet in
self.console.genLoopPackets():
Feb 14 08:50:03 raspberrypi weewxd[5905]: File "/etc/weewx/bin/user/sdr.py",
line 3316, in genLoopPackets
Feb 14 08:50:03 raspberrypi weewxd[5905]: raise weewx.WeeWxIOError("rtl_433
process is not running")
Feb 14 08:50:03 raspberrypi weewxd[5905]: weewx.WeeWxIOError: rtl_433 process
is not running
Feb 14 08:50:03 raspberrypi weewxd[5905]: During handling of the above
exception, another exception occurred:
Feb 14 08:50:03 raspberrypi weewxd[5905]: Traceback (most recent call last):
Feb 14 08:50:03 raspberrypi weewxd[5905]: File "/usr/share/weewx/weewxd.py",
line 265, in <module>
Feb 14 08:50:03 raspberrypi weewxd[5905]: main()
Feb 14 08:50:03 raspberrypi weewxd[5905]: File "/usr/share/weewx/weewxd.py",
line 193, in main
Feb 14 08:50:03 raspberrypi weewxd[5905]: time.sleep(wait_time)
Feb 14 08:50:03 raspberrypi weewxd[5905]: File "/usr/share/weewx/weewxd.py",
line 260, in sigTERMhandler
Feb 14 08:50:03 raspberrypi weewxd[5905]: raise Terminate
Feb 14 08:50:03 raspberrypi weewxd[5905]: __main__.Terminate
Feb 14 08:50:04 raspberrypi systemd[1]: weewx.service: Main process exited,
code=exited, status=1/FAILURE
Feb 14 08:50:04 raspberrypi systemd[1]: weewx.service: Failed with result
'exit-code'.
Feb 14 08:50:04 raspberrypi systemd[1]: Stopped WeeWX.
When I start weewx again with "sudo weewxd", ps aux|grep weewxd gives:
pi@raspberrypi:~ $ ps aux|grep weewxd
root 8308 0.3 0.2 13112 4268 pts/1 S+ 09:02 0:00 sudo weewxd
root 8309 3.4 0.9 46004 18724 pts/1 Sl+ 09:02 0:00 python3 /usr/
share/weewx/weewxd.py
pi 8347 0.0 0.0 7460 560 pts/3 S+ 09:03 0:00 grep --color=
auto weewxd
Here, I am stuck...
When you run weewx directly with sudo, the password is cached and taken
from the underlying driver to access the device. If the systemd-unit
runs the daemon that password is never entered and it would ask the
systemd-unit to enter it, but you can't cause its not running on your
terminal. Therefore we need to add the running user (weewx) to the right
group so it can access the RTL-SDR device without root privilieges
(sudo).
Hope that makes some sense :D
-dominic
Pierre-Yves
Le mardi 13 février 2024 à 23:49:36 UTC+1, vince a écrit :
You want to look for 'rtl' or 'sdr' and adding the weewx user to the
appropriate group that has permissions to access the hardware.
https://groups.google.com/g/weewx-user/c/7CIRRoo6Qdk/m/8dwn6EBiAQAJ is one
link. Note that 'plugdev' is correct for that example. We cannot predict
what 'your' system will require.
On Tuesday, February 13, 2024 at 1:49:27 PM UTC-8 Pierre-Yves wrote:
I haven't found any thread related to the creation of weewx user and
group...
PY
Le mardi 13 février 2024 à 22:14:40 UTC+1, Pierre-Yves a écrit :
Thanks Vince.
I'll try to find the way to do that
Le mardi 13 février 2024 à 22:05:10 UTC+1, vince a écrit :
oops, I meant running as 'weewx' or 'pi' or 'something
else'....
The reason I'm asking is that your systemctl log shows a sudo
error that means that the account you are trying to use sudo
under is not permitted to do so. The default dpkg installation
creates a weewx user and group but does not create a /etc/
sudoers.d file for that user. So the weewx user is not going
to be able to sudo if you specify that.
But....you should be able to add the weewx user to the correct
group(s) that can access your hardware. I think there are
other threads related to how to do that.
On Tuesday, February 13, 2024 at 12:57:21 PM UTC-8 vince wrote:
On Tuesday, February 13, 2024 at 12:31:54 PM UTC-8
Pierre-Yves wrote:
Weewx and webserver are perfectly working in simulator
mode with "sudo systemctl start weewx" command
Good. That means your problem appears to be related to
getting weewx as a non-privileged user to access your
RTL-STR hardware.
When running weewx using the Simulator does "ps aux|grep
weewxd" show it running as weewxd ? Or pi ? Or something
else ?
--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/
weewx-user/cea6b4c6-5b5f-49f8-b6fc-fa7e317c36ddn%40googlegroups.com.
--
The intelligence consists not only in the knowledge
but also in the skill to apply the knowledge into practice.
- Aristotle
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/%24dgpfnjwfv-%24gWkKdgb-%24mKGTc-2024%40odin.oe7drt.com.