Auto Start OP25 (Boatbod) on rPi

Status
Not open for further replies.

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
I've tried to follow the steps in this thread but I can't get my OP25 to autostart on boot.

When I try to start the system manually, I'm prompted to authenticate (not sure if this is good or bad)

scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ systemctl start op25-rx
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to start 'op25-rx.service'.
Authenticating as: ,,, (scanner)
Password:
==== AUTHENTICATION COMPLETE ====

When I run this command: journalctl -xe

It shows this error:

scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ journalctl -xe
Mar 29 14:49:59 op25pi systemd[1]: Stopped op25-rx.service - op25-rx.
░░ Subject: A stop job for unit op25-rx.service has finished
░░ Defined-By: systemd
░░ Support: Debian -- User Support
░░
░░ A stop job for unit op25-rx.service has finished.
░░
░░ The job identifier is 10105 and the job result is done.
Mar 29 14:49:59 op25pi systemd[1]: Started op25-rx.service - op25-rx.
░░ Subject: A start job for unit op25-rx.service has finished successfully
░░ Defined-By: systemd
░░ Support: Debian -- User Support
░░
░░ A start job for unit op25-rx.service has finished successfully.
░░
░░ The job identifier is 10105.
Mar 29 14:49:59 op25pi (bash)[1069]: op25-rx.service: Changing to the requested working directory failed: No such file or directory
Mar 29 14:49:59 op25pi (bash)[1069]: op25-rx.service: Failed at step CHDIR spawning /bin/bash: No such file or directory
░░ Subject: Process /bin/bash could not be executed

Here are my config files:
op25-rx.service

Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

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

[Install]
WantedBy=multi-user.target



op25.sh

sleep 5
cd /home/pi/op25/op25/gr-op25_repeater/apps
./rx.py --args 'rtl' -N 'LNA:47' -S 1000000 -x 2 -T CLMRN.tsv -V -2 -U -l http:0.0.0.0:8080


It took my awhile to get OP25 working but it works great. Last step is to get it to run on boot.

Thanks in advance
-Rob
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,207
Reaction score
464
Location
NE Wisconsin
Here are my config files:
op25-rx.service

Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

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

[Install]
WantedBy=multi-user.target

Rob,

I don't know if you missed it when copying the contents of your op25-rx. service for this post, or if your service file is actually malformed.
Check to see if you service file contains the "[Unit]" heading that should proceed the Description=op25-rx and so on.

IE:

[Unit]
Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

op25.sh

sleep 5
cd /home/pi/op25/op25/gr-op25_repeater/apps
./rx.py --args 'rtl' -N 'LNA:47' -S 1000000 -x 2 -T CLMRN.tsv -V -2 -U -l http:0.0.0.0:8080


It took my awhile to get OP25 working but it works great. Last step is to get it to run on boot.

Thanks in advance
-Rob

I suspect that if you've installed a Desktop version of Raspbian OS that installs pulseaudio that you'll also
have a permission issue direction op25 to run as a service while direction output to the local sound device.

Enable logging to standard out that you'll have a record of any failures or tracebacks when starting op25.

/rx.py --args 'rtl' -N 'LNA:47' -S 1000000 -x 2 -T CLMRN.tsv -V -2 -U -l http:0.0.0.0:8080 -v 11 2> stderr.2
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
Thanks for the reply.

I checked the SERVICE file and those lines are there; I just didn't copy/paste. It doesn't look like the service is evening trying to start. When I enabled the logging, the last entry is from last night when I exited. I did a fresh reboot this morning and there are no entries.

03/29/25 19:57:04.731588 nac 3a4 type 7 state 1 len 10
03/29/25 19:57:04.731669 [0] tsbk(0x3b) net_sts_bcst: wacn: bee00 syid: 3a9 ch1: 1788(774.056250)
main: exception occurred
main: exception:
Traceback (most recent call last):
File "/home/scanner/op25/op25/gr-op25_repeater/apps/./rx.py", line 1022, in ru n
time.sleep(1)
KeyboardInterrupt


I think the service is running based on this information:

scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ systemctl list-unit-files op25-rx.service
UNIT FILE STATE PRESET
op25-rx.service enabled enabled

1 unit files listed.


I don't know enough Linux to know where to go next....
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,207
Reaction score
464
Location
NE Wisconsin
Rob,

Check (determine) owner and group of your /home/scanner/op25 and subfolders.

IE:
cd /home/scanner/op25/op25/gr-op25_repeater/apps/
ls -l rx.py


[Assuming your Linux user id (login) is "scanner", then the output should reflect the same for the user and group ownership.]

-rwxr-xr-x 1 scanner scanner 46860 Mar 12 12:48 rx.py
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
I think permissions are ok -

scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ ls -l rx.py
-rwxr-xr-x 1 scanner scanner 46889 Jan 17 10:43 rx.py


scanner@op25pi:~/op25/op25/gr-op25_repeater $ ls -l | more
total 40
drwxr-xr-x 7 scanner scanner 4096 Mar 29 19:57 apps
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,207
Reaction score
464
Location
NE Wisconsin
Let's backup and establish what version of op25, Boatbod or Osmocom it is that your using? I had initially assumed Boatbod, but
in rereading your original post, a clue stands out stating you had to authenticate before op25 would run from the command line.

By default, the Boatbod version of op25 sets udev rules to support common SDR types while Osmocom does not, and has to be
done manually by the end user.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,207
Reaction score
464
Location
NE Wisconsin
OK. We've established that! BTW, you need to work on your PPM adjustment. Nonetheless, frequency errors don't impede
automatic startup via a system service. List (Post) exactly the steps you have to follow from login to the point that you get
op25 to run. Post you op25.sh and verify that it's executable.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,717
Reaction score
1,121
Location
Talbot Co, MD
The boatbod repo includes a couple of files which should help you set up op25 automatic start on boot. There is a caveat that pulse audio does not play well in this scenario, so you may have some work to figure out permissions issues if your audio destination is anything other than "default".

<from the ~/op25/op25/gr-op25_repeater/apps directory>
1. edit the file op25-rx.service to make the embedded path match your actual system
2. edit op25.sh to make it execute the correct op25 command line with your arguments, log level etc
3. run the command "sudo systemctl enable op25-rx.service" to make systemd aware of your startup script
4. run the command "sudo systemctl start op25-rx"
5. run the command "sudo systemctl status op25-rx" to make sure op25 is still running
5. check the contents of stderr.2 log to make sure everything looks good from op25's perspective

If at some point you need to fix something, or change a config parameter, you can issue the command "sudo systemctl restart op25-rx".
To stop op25 the command is "sudo systemctl stop op25-rx"
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,207
Reaction score
464
Location
NE Wisconsin
The boatbod repo includes a couple of files which should help you set up op25 automatic start on boot. There is a caveat that pulse audio does not play well in this scenario, so you may have some work to figure out permissions issues if your audio destination is anything other than "default".
I am fairly confident pulse audio is the issue. Having dealt with this problem before, I've devised a couple of workaround solutions that I'd
be willing to share. However, it has the appearance the OP may have lost interest or has moved on.
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
OK. We've established that! BTW, you need to work on your PPM adjustment. Nonetheless, frequency errors don't impede
automatic startup via a system service. List (Post) exactly the steps you have to follow from login to the point that you get
op25 to run. Post you op25.sh and verify that it's executable.

scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ cat op25.sh
#./rx.py --nocrypt --args "rtl" --gains 'lna:36' -S 960000 -X -q 0 -v 1 -2 -V -U -T CLMRN.tsv 2> stderr.2
# sleep 5
# cd /home/pi/op25/op25/gr-op25_repeater/apps
./rx.py --args 'rtl' -N 'LNA:47' -S 1000000 -x 2 -T CLMRN.tsv -V -2 -U -l http:0.0.0.0:8080 -v 11 2>stderr.2



scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ ls -l op25.sh
-rwxr-xr-x 1 scanner scanner 271 Mar 29 19:57 op25.sh

FWIW, the op25.sh works OK when I manually run it. That's how I usually start listening now.
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
I am fairly confident pulse audio is the issue. Having dealt with this problem before, I've devised a couple of workaround solutions that I'd
be willing to share. However, it has the appearance the OP may have lost interest or has moved on.

Sorry, it was my Son's birthday yesterday so I wasn't able to troubleshoot and test the new feedback that was posted.
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
The boatbod repo includes a couple of files which should help you set up op25 automatic start on boot. There is a caveat that pulse audio does not play well in this scenario, so you may have some work to figure out permissions issues if your audio destination is anything other than "default".

<from the ~/op25/op25/gr-op25_repeater/apps directory>
1. edit the file op25-rx.service to make the embedded path match your actual system
2. edit op25.sh to make it execute the correct op25 command line with your arguments, log level etc
3. run the command "sudo systemctl enable op25-rx.service" to make systemd aware of your startup script
4. run the command "sudo systemctl start op25-rx"
5. run the command "sudo systemctl status op25-rx" to make sure op25 is still running
5. check the contents of stderr.2 log to make sure everything looks good from op25's perspective

If at some point you need to fix something, or change a config parameter, you can issue the command "sudo systemctl restart op25-rx".
To stop op25 the command is "sudo systemctl stop op25-rx"

Thanks for some ideas.

For #1, I think I did this already. I believe the original script had the path for a user "pi". I changed to "scanner".

[Unit]
Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

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

[Install]
WantedBy=multi-user.target

#2 - should be OK too because I run the script manually when I am logged in to start listening.

#3 - Done. I think I did this before based on some other threads.

#4 - No errors when I run this

#5 - I suspect it didn't work because when I try to browse to the web interface, the "site cannot be reached".

#5 - I think the last entries in the log are from when I pressed "ctrl c" to stop the program after running op25.sh manually (I'm posting this at 1729 and the last message is from 1721)

04/03/25 17:21:23.478384 [0] tsbk(0x3d) iden_up: id: 1 toff: 30.000000 spac: 6.250000 freq: 762.006250
04/03/25 17:21:23.478546 nac 3a4 type 7 state 1 len 10
main: exception occurred
main: exception:
Traceback (most recent call last):
File "/home/scanner/op25/op25/gr-op25_repeater/apps/./rx.py", line 1022, in run
time.sleep(1)
KeyboardInterrupt




I'm sorry I don't know enough about Linux to help with PulseAudio. I don't think I'm using the default audio output because I have a USB sound card attached. I wouldn't know where to check permissions or begin to troubleshoot.

Thanks again for all the suggestions.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,717
Reaction score
1,121
Location
Talbot Co, MD
Can you post the full stderr.2 log please.
Does the rx.py process stay running or is it terminating?

Going back to your first post above, I see an error "/bin/bash could not be executed". You might need to edit that op25-rx.service to "/usr/bin/bash"
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
Can you post the full stderr.2 log please.
Does the rx.py process stay running or is it terminating?

Going back to your first post above, I see an error "/bin/bash could not be executed". You might need to edit that op25-rx.service to "/usr/bin/bash"
I made the suggested edit but there was no additional entries in the stderr.2 file.

My file from yesterday ~42mb. I ran op25.sh again and kept it running for a few minutes to generate a smaller file (attached). I had to make the extension "txt" to upload.
 

Attachments

  • stderr.2.txt
    1.1 MB · Views: 8

boatbod

Member
Joined
Mar 3, 2007
Messages
3,717
Reaction score
1,121
Location
Talbot Co, MD
The log confirms that you are using ALSA sound system, so we can assume the startup issue is not Pulse Audio permissions.

Let dig deeper into the startup scripts.
Please 'cat' the content of /etc/systemd/system/op25-rx.service
Next, please run 'systemctl status op25-rx' and report the output.
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ cat /etc/systemd/system/op25-rx.service
[Unit]
Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

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

[Install]
WantedBy=multi-user.target





scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ systemctl status op25-rx
● op25-rx.service - op25-rx
Loaded: loaded (/etc/systemd/system/op25-rx.service; enabled; preset: enab>
Active: activating (auto-restart) (Result: exit-code) since Sun 2025-04-06>
Process: 47468 ExecStart=/bin/bash -- op25.sh (code=exited, status=200/CHDI>
Main PID: 47468 (code=exited, status=200/CHDIR)
CPU: 3ms
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,207
Reaction score
464
Location
NE Wisconsin
scanner@op25pi:~/op25/op25/gr-op25_repeater/apps $ cat /etc/systemd/system/op25-rx.service
[Unit]
Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

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

[Install]
WantedBy=multi-user.target

You specified in your initial post that op25 was installed under /home/scanner/op25/op25/gr-op25_repeater/apps and now you have it
specified at /home/pi/op25/op25/gr-op25_repeater/apps. The "WorkingDirectory" field specified in your systemd service must match
exactly where op25 is installed.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,717
Reaction score
1,121
Location
Talbot Co, MD
You specified in your initial post that op25 was installed under /home/scanner/op25/op25/gr-op25_repeater/apps and now you have it
specified at /home/pi/op25/op25/gr-op25_repeater/apps. The "WorkingDirectory" field specified in your systemd service must match
exactly where op25 is installed.
This ^^^

In case it wasn't entirely clear, you need to sudo edit the file /etc/systemd/system/op25-rx.service and correct the path.
 

Rob_K

Member
Feed Provider
Joined
Mar 10, 2009
Messages
234
Reaction score
1
Location
Tolland County, CT
Thank you both (again) for your help. It looks like I am in business now.

I think what happened is I modified the op25-rx.service in my "home" directory AFTER I copied it to systemd. I only checked the original file and not what I copied. I edited the file that is in systemd and everything started after reboot.

BTW, you need to work on your PPM adjustment

Do you want to help me with this too? :)
 
Status
Not open for further replies.
Top