c4software / raspberry-rtlsdr-server

Quick guide to setup a RTL SDR Server on a Raspberry Pi.
58 stars 7 forks source link

failure to attach to socket on reboot #1

Open joseph-diverdi opened 2 years ago

joseph-diverdi commented 2 years ago

Thank you for your work on making this server available. I am opening this issue to report a problem I have observed as described below.

I'm using a raspberry pi 3B+ with a fresh install of 2022-04-04-raspios-bullseye-armhf-lite and a RTL2832U R820T2 V3.

The install of the rtl-sdr server has proceeded without any fault using the procedure described elsewhere in this repository.

rtl_test is successful. rtl_tcp (manually launched) is successful.

Setup of the rtlsdr.service was mostly successful with the exception of the line: ExecStart=/bin/sh -c "/usr/bin/rtl_tcp -a $(hostname -I)" which was necessary to change to (a hardcoded IP addess): ExecStart=/bin/sh -c "/usr/bin/rtl_tcp -a 192.168.12.192" because on this target RPi "hostname -I" returns multiple values including IPv4 and IPv6 addresses which prevent successful setup of the server's socket.

The response from "hostname -I" is "192.168.12.192 2607:fb90:6f5d:819e:587f:fd89:0:c1a 2607:fb90:6f5d:819e:dd6f:539:d74a:5809" in this instance.

Auto-startup was also mostly successful but not completely. Immediately after reboot the following was obtained:

sdr@radio:~ $ ss -t -a State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 1 0.0.0.0:38795 0.0.0.0:
LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:

ESTAB 0 0 192.168.12.192:ssh 192.168.12.229:61169
LISTEN 0 128 [::]:ssh [::]:*

The socket associated with the rtlsdr.service is missing. (clearly, I am connecting to the RPi through SSH.)

Further examination reveals:

sdr@radio:~ $ sudo systemctl status rtlsdr ● rtlsdr.service - RTL-SDR Server Loaded: loaded (/etc/systemd/system/rtlsdr.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2022-04-24 22:48:21 MDT; 2min 44s ago Main PID: 462 (sh) Tasks: 3 (limit: 1598) CPU: 226ms CGroup: /system.slice/rtlsdr.service ├─462 /bin/sh -c /usr/bin/rtl_tcp -a 192.168.12.192 └─464 /usr/bin/rtl_tcp -a 192.168.12.192

Apr 24 22:48:21 radio systemd[1]: Started RTL-SDR Server. Apr 24 22:48:22 radio sh[464]: Found 1 device(s): Apr 24 22:48:22 radio sh[464]: 0: Realtek, RTL2838UHIDIR, SN: 00000001 Apr 24 22:48:22 radio sh[464]: Using device 0: Generic RTL2832U OEM Apr 24 22:48:22 radio sh[464]: Detached kernel driver Apr 24 22:48:22 radio sh[464]: Found Rafael Micro R820T tuner Apr 24 22:48:22 radio sh[464]: [R82XX] PLL not locked! Apr 24 22:48:23 radio sh[464]: Tuned to 100000000 Hz.

No complaints here.

I could see no complaints in /var/log/syslog during the boot process.

I could also see no complaints in /var/log/daemon.log during the boot process.

A rtlsdr.service restart corrected the absence of the socket.

sudo systemctl restart rtlsdr

sdr@radio:~ $ ss -t -a State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 1 192.168.12.192:1234 0.0.0.0:
LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:

ESTAB 0 0 192.168.12.192:ssh 192.168.12.229:61169
LISTEN 0 128 [::]:ssh [::]:*

No difference could be seen in the rtlsdr.service status report (not reproduced here).

This process is reproducible - immediately after a reboot the socket is absent and a restart causes it to be present.

I hope this description is helpful in explaining my observations. I am ready to provide additional testing and reporting if requested.

Thank you again for all your work on this project. The server is greatly appreciated and is useful.

jadv

c4software commented 2 years ago

Hi,

Thanks for the time you take to write this issue!

It was a busy month for me. I will take a look at it this week.

Oxalin commented 12 months ago

While I see the same missing entry with "ss -t -a", I can still connect to my Pi using its IP address and the port on startup. Restarting the service does make it appear when calling ss.