The community websdr-plus-github can be found here: https://github.com/ny4qphil/PhantomSDR-Plus ..it is compatible with the normal version, but enhanced.

Start the websdr via Systemd at startup or fail

Started by Bas ON5HB, Oct 18, 2024, 05:55 PM

Previous topic - Next topic

Bas ON5HB

This is my first attempt and it works for me.

1: Create /etc/default/websdr and put the following in it:

# Default settings for PhantomSDrPlus-websdrserver.
# Options to pass to the websdr
RECEIVER=/opt/PhantomSDR-Plus/start-receiver.sh
WEBSDR=/opt/PhantomSDR-Plus/start-websdr.sh

2: Create the 2 files start-receiver.sh and start-websdr.sh

#!/bin/bash
cd /opt/PhantomSDR-Plus/
rx888_stream/target/release/rx888_stream -f ./rx888_stream/SDDC_FX3.img -s 50000000 -g 40 --pga -m low -r -o - > rx888mk2.fifo
wait -n
#exit


#!/bin/bash
cd /opt/PhantomSDR-Plus/
build/spectrumserver --config config-rx888mk2.toml < rx888mk2.fifo
wait -n
#exit

DO NOT FORGET 'mkfifo rx888mk2.fifo' else your harddisk will fill in minutes!!! Beware!!!

3: Create 2 files in /lib/systemd/system...being websdr-receiver.service and websdr.service :

[Unit]
Description=PhantomSDRPlus WebSDR receiver
After=network.target auditd.service

[Service]
PIDFile=/run/websdr-receiver.pid
EnvironmentFile=-/etc/default/websdr
ExecStart=/usr/bin/bash $RECEIVER
Restart=on-failure
RestartSec=3
Type=exec

[Install]
WantedBy=multi-user.target
Alias=websdr-receiver.service

[Unit]
Description=PhantomSDRPlus WebSDR
After=network.target auditd.service websdr-receiver.service

[Service]
PIDFile=/run/websdr.pid
EnvironmentFile=-/etc/default/websdr
ExecStart=/usr/bin/bash $WEBSDR
Restart=on-failure
RestartSec=3
Type=exec

[Install]
WantedBy=multi-user.target
Alias=websdr.service


4: Enable them:

systemctl enable websdr-receiver.service
systemctl enable websdr.service

5:

Start both....

If you did everything correct, they will be started and running....when you reboot now, they should start and run.
Also, I hope on failure they will restart....not tested yet. I hope they do.

I'm not a huge systemd fan, it's too complicated for my taste.

Do not ask me questions about it, I can't answer them, as I'm playing with it myself. But so far this works.

EDIT: Code updated, it would not always kill the software properly, with PID it does. (Updated again, and again)
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Bas ON5HB

Next problem, the chat-file....as my websdr stops from time to time, I suspect the file being too big over time.

I hope to solve this with logrotate.

Create a file called: /etc/logrotate.d/websdr

Fill it with this....adjusted to your directory...

/opt/PhantomSDR-Plus/chat_history.txt {
  rotate 6
  daily
  compress
  missingok
  notifempty
}

It will rotate 6 times, so you can look 7 logs back.
Does it on a daily basis and deletes it.

When a user enters something a new one will be created.

Hopefully does this stop the crashing, and it doesn't let it fill your harddisk ;)
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Martin G8JNJ

Hi Bas,

Sadly, it didn't work for me.

I followed all of your steps, but it won't automatically start on power up or reboot, and I had to manually run ./start-rx888mk2.sh to get the web interface up.

Regards,

Martin



Phil - NY4Q

Quote from: Martin G8JNJ on Oct 26, 2024, 06:02 PMHi Bas,

Sadly, it didn't work for me.

I followed all of your steps, but it won't automatically start on power up or reboot, and I had to manually run ./start-rx888mk2.sh to get the web interface up.

Regards,

Martin




Martin,

My install is in /PhantomSDR-Plus/ whereas Bas' is in /opt/PhantomSDR-Plus/ and his script uses that.

Check that.

Martin G8JNJ

OK changed that, still no luck. Some logs may give a clue.

 systemctl status websdr-receiver.service
● websdr-receiver.service - PhantomSDRPlus WebSDR receiver
     Loaded: loaded (/lib/systemd/system/websdr-receiver.service; enabled; vend>
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-10-26>
    Process: 1051 ExecStart=/usr/bin/bash $RECEIVER (code=exited, status=127)
   Main PID: 1051 (code=exited, status=127)
        CPU: 2ms

Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Main process exite>
Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Failed with result>
lines 1-9/9 (END)
● websdr-receiver.service - PhantomSDRPlus WebSDR receiver
     Loaded: loaded (/lib/systemd/system/websdr-receiver.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-10-26 19:30:25 UTC; 1s ago
    Process: 1051 ExecStart=/usr/bin/bash $RECEIVER (code=exited, status=127)
   Main PID: 1051 (code=exited, status=127)
        CPU: 2ms

Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Main process exited, code=exited, status=127/n/a
Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Failed with result 'exit-code'.

------------------------------------------------------------------


 systemctl status  websdr.service
● websdr.service - PhantomSDRPlus WebSDR
     Loaded: loaded (/lib/systemd/system/websdr.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-10-26 19:33:27 UTC; 940ms ago
    Process: 1184 ExecStart=/usr/bin/bash $WEBSDR (code=exited, status=127)
   Main PID: 1184 (code=exited, status=127)
        CPU: 2ms

Phil - NY4Q

Quote from: Martin G8JNJ on Oct 26, 2024, 09:37 PMOK changed that, still no luck. Some logs may give a clue.

 systemctl status websdr-receiver.service
● websdr-receiver.service - PhantomSDRPlus WebSDR receiver
     Loaded: loaded (/lib/systemd/system/websdr-receiver.service; enabled; vend>
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-10-26>
    Process: 1051 ExecStart=/usr/bin/bash $RECEIVER (code=exited, status=127)
   Main PID: 1051 (code=exited, status=127)
        CPU: 2ms

Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Main process exite>
Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Failed with result>
lines 1-9/9 (END)
● websdr-receiver.service - PhantomSDRPlus WebSDR receiver
     Loaded: loaded (/lib/systemd/system/websdr-receiver.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-10-26 19:30:25 UTC; 1s ago
    Process: 1051 ExecStart=/usr/bin/bash $RECEIVER (code=exited, status=127)
   Main PID: 1051 (code=exited, status=127)
        CPU: 2ms

Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Main process exited, code=exited, status=127/n/a
Oct 26 19:30:25 phantom systemd[1]: websdr-receiver.service: Failed with result 'exit-code'.

------------------------------------------------------------------


 systemctl status  websdr.service
● websdr.service - PhantomSDRPlus WebSDR
     Loaded: loaded (/lib/systemd/system/websdr.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-10-26 19:33:27 UTC; 940ms ago
    Process: 1184 ExecStart=/usr/bin/bash $WEBSDR (code=exited, status=127)
   Main PID: 1184 (code=exited, status=127)
        CPU: 2ms


You are getting a bash error code 127, and below is some info on that error.

https://linuxconfig.org/how-to-fix-bash-127-error-return-code

Martin G8JNJ

Hi Phil,

Thanks for that. I'd already done a bit of research WRT code 127, and concluded it was an issue with the path.

I've tried modifying the paths in the new files, without any success, so I think I'll now have to investigate the PATH environment variable or file permissions.

Regards,

Martin


Martin G8JNJ

BTW I'm assuming Bas's original instructions should have been conducted as root ?


Phil - NY4Q

Quote from: Martin G8JNJ on Oct 27, 2024, 03:10 PMBTW I'm assuming Bas's original instructions should have been conducted as root ?



I always login with my account, then 'su - root' and work that way on most everything.

Martin G8JNJ

I think I'm giving up on this for the time being, as I've spent far too much time on it, and not being a Linux Guru, I can't seem to figure out why it doesn't do what it should.

As a result, my current implementation of PhantomSDR-Plus is simply not stable enough to use on a remote site, so I think I'll wait until I can devote more time, and it has further progressed, before revisiting it.

But moving forward, and for the sake of others, ideally, I'd like to see any new releases include an automated start-up and watchdog function.

Regards,

Martin


Bas ON5HB

Martin,

No offense, but you do not listen or follow rules that are given to help you.

At the same time you complain all the time, at the persons that try to help you.

You also told us that you know your way around Linux, basically telling us to shut up, Martin knows all.

Again you give an attitude of more the same.

The way you are looking at this, it will never work for you. Please go back to websdr.org software, where support is...euh...euh...none ;D
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Martin G8JNJ

Bas,

With respect,I have followed the procedures as described, to the letter, even to the extent of writing down each step and checking it off when completed. However, in many cases the process has not worked, and in some cases it is because there are prerequisites that are not mentioned, dependencies that are not stated, or other parameters that may be obvious to skilled Linux users, but not to me. I have asked for step by step guidance, but have been told that this is not possible because of differences in hardware, software, and various other factors. I accept all of this, but the bottom line is that despite my best endeavours, many days of effort and research, and being accused of self sabotage, things that are supposed to work, simply don't work for me, for whatever reason. 

I have not claimed to know my way around Linux, and I have made that clear on many occasions. I have some knowledge of basic commands, and how to obtain some details from logs, most of which I have learnt from others, including yourself.

I do raise issues that I encounter, which has been construed as complaining, in the hope that others may either be able to help, or some bugs can be recognised if the behaviour is not as expected. I have posted logs, to assist those who may wish to help me, and have tried to implement fixes that have been suggested. In turn, I have suggested enhancements that I think would be useful, and commented on functions that I find confusing. If you are frustrated by my posts, I can assure you I am equally frustrated that I can't seem to achieve the same results as others.

I honestly don't understand why you believe "Martin knows all." I can assure you that I do not, and anyone who reads my questions would be well aware of that. If I don't know something I will ask, if someone asks me for help I try my best to assist them, if I'm wrong about something I will acknowledge that and learn from it, and if I upset someone I will apologise.

However, on various forums I will ask questions and raise issues, that for various reasons, others are not prepared to voice. Either because they don't wish to appear stupid, or rock the boat by flagging up problems or observations that the "fanboys" or moderator don't like to hear. For me, it's not personal, it's engineering, and we should be able to discuss such things without causing offence.

I said that websdr was no longer supported, which is why I'm keen to find a replacement, and PhantomSDR-Plus seemed to be the best fit, which is why I am here.

You don't have to like me, I'm not after any sort of validation, and I have sufficient self-confidence to not worry about what others think of me. I just want to get the thing running in a stable state, so that I can put it on my remote site.

Ban me if you wish, plenty of others have, in many cases for raising valid points or faults, that have often been mysteriously resolved at a later date. Sometimes with an admission of a fix, but usually without an apology.

I bear you no malice, and wish you well with your endeavours.

Regards,

Martin

Quote from: Bas ON5HB on Nov 11, 2024, 06:47 PMMartin,

No offense, but you do not listen or follow rules that are given to help you.

At the same time you complain all the time, at the persons that try to help you.

You also told us that you know your way around Linux, basically telling us to shut up, Martin knows all.

Again you give an attitude of more the same.

The way you are looking at this, it will never work for you. Please go back to websdr.org software, where support is...euh...euh...none ;D

Bas ON5HB

Martin,

I told you this before, if you do not understand my instructions: GET HELP!

There is no magic or rocket-science going on.

Everybody else seems to get it.

Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Martin G8JNJ

Bas,

I always say to myself, if it is only one person experiencing something different from the majority of others, then figure out why that is the case.

In this situation, I'm aware that I am that person. But I have had help from others, and they are as equally confused about why the various things we have tried, did not achieve the desired outcome.

My intention is to let another Linux Guru SSH in and have a look around my setup, to see if he can find anything that is not apparent from the various remote diagnostics and changes that have already been made.

I am pretty sure that the problems are of my own making, mostly due to my limited Linux knowledge, but figuring out what they may be is proving to be tricky.

Regards,

Martin

Quote from: Bas ON5HB on Nov 12, 2024, 11:32 AMMartin,

I told you this before, if you do not understand my instructions: GET HELP!

There is no magic or rocket-science going on.

Everybody else seems to get it.



Powered by EzPortal