-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission error when running as systemd service #37
Comments
All paths in birdnet-go config are relative by default, you need to set working directory in systemd config unless you configure absolute paths in config (like path: /opt/birdnet-go/logs/webui.log). This is my /etc/systemd/system/birdnet-go.service
To fix ALSA permission issue you need to add birdnet user as member of audio group
|
…I'm getting the same ALSA errors |
Have you tried rebooting Linux after adding birdnet user to audio group? Does alsamixer work with birdnet user? |
I did a lot testing today and I now know what is wrong. "ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave" error is caused by BirdNET-Go trying to use ALSA device which is already open, in your case it is most likely caused by PulseAudio which BirdNET-Pi is using as audio backend. This can be solved by configuring BirdNET-Pi to use dsnoop as audio card, this is capture device type which can be shared by multiple applications There is also bunch of ALSA audio plugins in BirdNET-Pi os which need to be made unavailable for ALSA, non-destructive way to disable them is to rename /etc/alsa/conf.d for example /etc/alsa/conf.d.off. Once you reboot BirdNET-Pi should record on dsnoop device and BirdNET-Go should also tap to that same device. This works only with locally installed birdnet-go, recently released Docker image is unable to use shared dsnoop device. |
@tphakala Thanks for all that testing! The computer where I'm currently running BirdNET-Go actually does not have BirdNET-Pi on it anywhere. This was a fresh OS with only BirdNET-Go installed. I do see But also maybe once I'm on a version that doesn't use Pulse Audio at all it won't matter? |
I disabled Pulse Audio because it is causing inconsistent behavior due to how Pulse Audio works by default. When you login to Linux shell, by SSH or by any other means, this will typically also spawn a Pulse Audio server, once you log out Pulse Audio server stops. Miniaudio library I am using in BirdNET-Go connects to Pulse Audio server if it is available, if it is not it falls back to ALSA. In your case Pulse Audio backed audio works, but ALSA does not (hence errors with systemd launched process). Could you try to add following config into /home/birdnet/.asoundrc (or to profile you are running BirdNET-Go as)
This will configure ALSA to provide audio capture device as dsnoop type device which can be shared between processes. |
Is your system a full desktop install or is it a minimal install? |
I believe it was a vanilla Raspberry Pi OS Lite 64 bit install from a few weeks ago |
@farski idk if you are still having this issue, but I was seeing the same thing and fixed it by adding
to my systemd script. I think the pulseaudio server doesn't get started for systemd sessions, and this triggers it to start up before it kicks off the normal startup process. There might be a better way to do this because linux audio is far from my strong suit, but it seems to be working for me 😅 |
This could be something very obvious that I'm missing, I don't deal with systemd all that often.
My system has a user called
birdnet
. I have created the following systemd serviceWhen I try to start that service, I get
I have tried also moving the installation to
/opt/birdnet-go
and checked permissions on all relevant files and directories. It seems like no matter what I do, running the program as thebirdnet
user directly always works, and running it via systemd as thebirdnet
user always fails with this renaming error. Also notable is that it seems to attempt to rename thewebui.log
file, even if there is no existingwebui.log
file in the same directory asbirdnet-go
.I am able to work around this by providing an absolute path for the webserver log path in
config.yaml
. I think I would generally assume that the paths specified in the config are always relative to the program binary, but maybe that's a bad assumption.Once I get past the renaming error, I get a new error:
I don't have a good idea for how to deal with that one.
But the tl;dr is that something seems to be handled differently when running as a user versus running as a user via systemd, which leads to a number of problems.
The text was updated successfully, but these errors were encountered: