OP25 fails to start as a service

Status
Not open for further replies.

maredzki

Member
Feed Provider
Joined
Feb 21, 2019
Messages
72
I have the service configured as noted in the thread "Setting up op25 to stream to broadcastify" but in my case I just need to have it start on boot. This will be a headless instance with speakers connected to raspberrypi. It will not be connected to the internet thus not sending signal anywhere.

My start command is:
./rx.py --args 'rtl' -N 'LNA:47' -S 960000 -f 773.84375e6 -o 25000 -T trunk.tsv -V -2 -U 2> stderr.2

The service is configured as noted, I also added "Type=forking" as a suggestion but it did not do anything.

I get the following error from stderr.2
Traceback (most recent call last):
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 306, in run
self.setup_curses()
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 67, in setup_curses
self.stdscr = curses.initscr()
File "/usr/lib/python2.7/curses/__init__.py", line 33, in initscr
fd=_sys.__stdout__.fileno())
error: setupterm: could not find terminal

When I add -l http://127.0.0.1:8080 I get the following errors.
when executing
systemctl start op25-stream0
Job for op25-stream0.service failed because the control process exited with error code.
See "systemctl status op25-stream0.service" and "journalctl -xe" for details.

And stderr.2:
Reading whitelist file
Traceback (most recent call last):
File "./rx.py", line 904, in <module>
rx = rx_main()
File "./rx.py", line 824, in __init__
self.tb = p25_rx_block(self.options)
File "./rx.py", line 201, in __init__
self.terminal = op25_terminal(self.input_q, self.output_q, self.options.terminal_type)
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 388, in op25_terminal
port = int(terminal_type)
ValueError: invalid literal for int() with base 10: '127.0.0.1:8080'

Any pointers would be appreciated. I'm not the expert but it seems I'm missing something simple :)

Thanks,
Marek
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,339
Location
Talbot Co, MD
I have the service configured as noted in the thread "Setting up op25 to stream to broadcastify" but in my case I just need to have it start on boot. This will be a headless instance with speakers connected to raspberrypi. It will not be connected to the internet thus not sending signal anywhere.

My start command is:
./rx.py --args 'rtl' -N 'LNA:47' -S 960000 -f 773.84375e6 -o 25000 -T trunk.tsv -V -2 -U 2> stderr.2

The service is configured as noted, I also added "Type=forking" as a suggestion but it did not do anything.

I get the following error from stderr.2
Traceback (most recent call last):
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 306, in run
self.setup_curses()
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 67, in setup_curses
self.stdscr = curses.initscr()
File "/usr/lib/python2.7/curses/__init__.py", line 33, in initscr
fd=_sys.__stdout__.fileno())
error: setupterm: could not find terminal

When I add -l http://127.0.0.1:8080 I get the following errors.
when executing
systemctl start op25-stream0
Job for op25-stream0.service failed because the control process exited with error code.
See "systemctl status op25-stream0.service" and "journalctl -xe" for details.

And stderr.2:
Reading whitelist file
Traceback (most recent call last):
File "./rx.py", line 904, in
rx = rx_main()
File "./rx.py", line 824, in __init__
self.tb = p25_rx_block(self.options)
File "./rx.py", line 201, in __init__
self.terminal = op25_terminal(self.input_q, self.output_q, self.options.terminal_type)
File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 388, in op25_terminal
port = int(terminal_type)
ValueError: invalid literal for int() with base 10: '127.0.0.1:8080'

Any pointers would be appreciated. I'm not the expert but it seems I'm missing something simple :)

Thanks,
Marek
Generally you cannot use the curses terminal when you want to start a headless server. Recommend you reconfigure with "-l http:127.0.0.1:8080" to start the http terminal instead.
 

kb9mwr

Member
Joined
Apr 8, 2003
Messages
263
Location
Green Bay, WI
You could also try redirecting the curses output to dev null.

> /dev/null 2>&1 &

This is my default thing I always use for just about any Linux program that I don't want output from, and want in the background so I can have some non-human process start it, etc.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,339
Location
Talbot Co, MD
You could also try redirecting the curses output to dev null.

> /dev/null 2>&1 &

This is my default thing I always use for just about any Linux program that I don't want output from, and want in the background so I can have some non-human process start it, etc.
That's unlikely to work as the curses terminal specifically checks for a minimum sized window. On a headless system the window doesn't exist so the test will fail and op25 will exit. The only way around this is either to run the http terminal (preferred) or use a utility such as "screen" to fake a terminal screen that you can later connect to. Having done it both ways, I can categorically say the http version results in fewer headaches!
 

maredzki

Member
Feed Provider
Joined
Feb 21, 2019
Messages
72
Here is my update from today. I added '-l http://127.0.0.1:8080' to the script. It looks like it tries to run but fails.

After starting the service:
pi@raspberrypi:~ $ systemctl status op25-stream0.service
● op25-stream0.service - op25-apd
Loaded: loaded (/etc/systemd/system/op25-stream0.service; enabled; vendor preset: enabled)
Active: activating (start) since Mon 2019-03-11 14:36:31 CDT; 3s ago
Cntrl PID: 2510 (bash)
CGroup: /system.slice/op25-stream0.service
├─2510 /bin/bash -- op25.sh
└─2511 python ./rx.py -l http:127.0.0.1:8080 --args rtl -N LNA:47 -S 960000 -f 773.84375e6 -o 25000 -T trunk.tsv -V -2 -U

Mar 11 14:36:32 raspberrypi systemd[1]: Starting op25-apd...
Mar 11 14:36:33 raspberrypi bash[2510]: linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown

A few minutes later:
pi@raspberrypi:~ $ systemctl status op25-stream0.service
● op25-stream0.service - op25-apd
Loaded: loaded (/etc/systemd/system/op25-stream0.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Mon 2019-03-11 14:32:16 CDT; 4s ago
Process: 2430 ExecStart=/bin/bash -- op25.sh (code=killed, signal=TERM)
CGroup: /system.slice/op25-stream0.service

Mar 11 14:30:46 raspberrypi systemd[1]: Starting op25-apd...
Mar 11 14:30:48 raspberrypi bash[2430]: linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown
Mar 11 14:32:16 raspberrypi systemd[1]: op25-stream0.service: Start operation timed out. Terminating.
Mar 11 14:32:16 raspberrypi systemd[1]: Failed to start op25-apd.
Mar 11 14:32:16 raspberrypi systemd[1]: op25-stream0.service: Unit entered failed state.
Mar 11 14:32:16 raspberrypi systemd[1]: op25-stream0.service: Failed with result 'timeout'.
pi@raspberrypi:~ $

Any ideas?
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,339
Location
Talbot Co, MD
It doesn't look like your op25.sh is redirecting stderr to a log file? I recommend you do that so you can see if there are any hints for what is failing.

op25.sh:
./rx.py -l http:127.0.0.1:8080 --args rtl -N LNA:47 -S 960000 -f 773.84375e6 -o 25000 -T trunk.tsv -V -2 -U 2> stderr.log

Have you tried running the op25.sh command from an interactive terminal so that you can check it works before trying to autostart?
When you can, please post the stderr.2 once you capture one.
 

maredzki

Member
Feed Provider
Joined
Feb 21, 2019
Messages
72
Absolutely do: this is when manually running op25.sh (I quit it manually this time that's why the interrupt at the bottom of the log). Also, running it manually works properly (I can hear the sound).

gr-osmosdr 0.1.4 (0.1.4) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy soapy redpitaya
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
[R82XX] PLL not locked!
Using two-stage decimator for speed=960000, decim=10/4 if1=96000 if2=24000
Project 25 IMBE Encoder/Decoder Fixed-Point implementation
Developed by Pavel Yazev E-mail: pyazev@gmail.com
Version 1.0 (c) Copyright 2009
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file ``LICENSE'' for details.
op25_audio::eek:pen_socket(): enabled udp host(127.0.0.1), wireshark(23456), audio(23456)
p25_frame_assembler_impl: do_imbe[1], do_output[0], do_audio_output[1], do_phase2_tdma[1], do_nocrypt[0]
Reading whitelist file
metadata update not enabled
audio device: default
main: exception occurred
main: exception:
Traceback (most recent call last):
File "./rx.py", line 835, in run
time.sleep(1)
KeyboardInterrupt


Running as service:
gr-osmosdr 0.1.4 (0.1.4) gnuradio 3.7.10
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy soapy redpitaya
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 990000.002950 Hz
[R82XX] PLL not locked!
Unable to use two-stage decimator for speed=990000
Project 25 IMBE Encoder/Decoder Fixed-Point implementation
Developed by Pavel Yazev E-mail: pyazev@gmail.com
Version 1.0 (c) Copyright 2009
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file ``LICENSE'' for details.
op25_audio::eek:pen_socket(): enabled udp host(127.0.0.1), wireshark(23456), audio(23456)
p25_frame_assembler_impl: do_imbe[1], do_output[0], do_audio_output[1], do_phase2_tdma[1], do_nocrypt[0]
Reading whitelist file
metadata update not enabled
audio device: default

For some reason this was working and I heard voice but then quit. Also, 2> stderr.log is at the end but not showing.

EDIT: I changed sampling rate to 990000 just to make sure I am working with the correct sh file when calling the service. In both cases here, it was running the correct op25.sh file.
 

maredzki

Member
Feed Provider
Joined
Feb 21, 2019
Messages
72
boatbod,
UPDATE: I initially had Type=forking in the service config and now took it out. Seems to be running for a few minutes now when ran manually by running
Code:
sudo systemctl start op25-stream0.service

However, when rebooted the service starts, python runs and all seems well except I hear nothing and have a lot of these in the log:
Code:
p25_framer::rx_sym() tuning error +1200
which keeps filling the log file like crazy.

When I stop the service manually and restart it, all seems ok:
Code:
sudo systemctl stop op25-stream0.service
sudo systemctl start op25-stream0.service

Any ideas?
 
Last edited:

boatbod

Member
Joined
Mar 3, 2007
Messages
3,339
Location
Talbot Co, MD
boatbod,
UPDATE: I initially had Type=forking in the service config and now took it out. Seems to be running for a few minutes now when ran manually by running
Code:
sudo systemctl start op25-stream0.service

However, when rebooted the service starts, python runs and all seems well except I hear nothing and have a lot of these in the log:
Code:
p25_framer::rx_sym() tuning error +1200
which keeps filling the log file like crazy.

When I stop the service manually and restart it, all seems ok:
Code:
sudo systemctl stop op25-stream0.service
sudo systemctl start op25-stream0.service

Any ideas?

The +1200 error suggests your tuning might be a little off. When running from the command line does the mixer plot look well centered on the signal hump? Make sure ppm (-q) and fine-tune (-d) are set correctly as I have seen small variations in tuning just by starting the app a little differently.

Here's the script I use to start my streaming server using systemctl: (/etc/systemd/system/op25-fire.service)
Code:
[Unit]
Description=op25-fire
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

[Service]
User=gnorbury
Group=gnorbury
WorkingDirectory=/home/gnorbury/op25/op25/gr-op25_repeater/apps
ExecStart=/bin/bash -- first-fire.sh
RestartSec=5
Restart=on-failure

[Install]
WantedBy=multi-user.target

As you can see, the systemctl daemon executes a shell script called "first-fire.sh" which resides in the op25 apps directory. For the sake of completeness it contains the following: (~/op25/op25/gr-op25_repeater/apps/first-fire.sh)
Code:
./rx.py -l http:192.168.1.7:8080 -M meta-fire.json --args "rtl=0" --gains 'lna:36' -D cqpsk -S 960000 -T trunk-fire.tsv -q 0 -d -200 -v 1 -2 -u 23456 -V -w 2> stderr-fire.2
 

maredzki

Member
Feed Provider
Joined
Feb 21, 2019
Messages
72
As of this morning, it is working fine. I am no longer getting the multitude of errors like I noted in the previous post. So far only received one entry:
Code:
1552396505.067142 PCM underrun

I'll keep it running for a little while and then post if anything changes.
 
Status
Not open for further replies.
Top