1

I have a home made baby monitor running on a Raspberry Pi (Raspbian Buster). The monitor requires 2 systemctl services to operate:

  • janus-stream.service: sets up the GStreamer pipeline for consumption by the Jaanus Gateway software
  • janus.service: Starts Janus Gateway which facilitates WebRTC connections to the stream

At one point in the past I had these services set up such that when the Pi rebooted the stream would start itself automatically. But for some reason within the last few months (unfortunately I dont remember when it started), after reboot, I receive this error when trying to access the stream: No such mountpoint/stream 1 Error when trying to access the stream after the Pi was rebooted

This error obviously originates from within Janus Gateway and the only way to fix it is to SSH in to the Pi and run sudo systemctl restart janus.service. I have not been able to figure out why this is happening or how to resolve it to bring back the elegant start up behavior.

There are 2 theories:

  1. Perhaps my app requires janus-stream.service to be running before janus.service and right now that is not happening. This could explain the missing stream error. If this is the issue, how can I ensure the starting order of these services?
  2. Im not sure this is how systemctl works, but I may have goofed something up when I was trying some new stuff with Janus Gateway a few months ago, but I have since reverted any of those changes to what was previously working. Is it possible that systemctl may have cached those bad Janus Gateway configurations and is running those on startup rather than the desired commands? Hence the need for the manual service restart?

Thanks in advance for any help!

2
  • if janus requires janus-stream then shouldn't janus require janus-stream.service in the janus service file? Apr 12, 2023 at 2:55
  • i.e. Requires=janus-stream.service in the janus.service [Unit] section Apr 12, 2023 at 3:09

1 Answer 1

0

To ensure that janus.service starts after janus-stream.service, the [Unit] section of janus.service needs two more lines:

Wants=janus-stream.service
After=janus-stream.service

The first line specifies that janus.service needs janus-stream.service, but it leaves the start-up order unspecified (which can sometimes be fine, e.g. for services that use some other service, but only after the user actually connects to the service and does some specific action).

To specify the required start-up order, you also need the After=janus-stream.service line.

If you used a Requires= dependency instead of Wants=, it has the side effect of causing the entire boot operation to be considered failed if the dependency cannot be satisfied, effectively causing the system to drop into emergency mode at boot if the janus-stream.service cannot be started... which might be less than optimal for fixing the issue.

man systemd.unit says:

Often, it is a better choice to use Wants= instead of Requires= in order to achieve a system that is more robust when dealing with failing services.

After editing janus.service, you should run systemctl daemon-reload to tell systemd to reload its configuration and all the unit files, to make your edits effective.

1
  • Thanks for the thorough response, @telcoM! okay, janus.service now looks like this and I ran sudo systemctl daemon-reload. After reboot I get the same error and need to run sudo systemctl restart janus.service to get it working Apr 12, 2023 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .