Skip to content
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

Fails when running with sudo #369

Open
andrewdavidmackenzie opened this issue Apr 21, 2024 · 2 comments
Open

Fails when running with sudo #369

andrewdavidmackenzie opened this issue Apr 21, 2024 · 2 comments

Comments

@andrewdavidmackenzie
Copy link

andrewdavidmackenzie commented Apr 21, 2024

Expected behavior:

soloud (via rust wrappings) loads and runs normally.
This is the case when run as a normal user (on raspberry pi).

However, it fails when run using sudo

Actual behavior:

RUST_BACKTRACE=1 sudo ./ringr 
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
thread 'main' panicked at src/main.rs:44:32:
Could not get Soloud: Internal(UnknownError)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Steps to reproduce the problem:

On PiOs (and I assume on other Linux, but can't be sure...), have a short program that loads SoLoud and speaks or plays a sound, and run it using sudo.

SoLoud version, operating system, backend used, any other potentially useful information:

uname -a
Linux pizero2w0 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

soloud = { version = "1" } resolves thus in Cargo.lock:

[[package]]
name = "soloud"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40cbdc64b205d53f861657923d4f94bd56ffa81e11b8ad920ac79447ececb47"
dependencies = [
 "bitflags",
 "paste",
 "soloud-sys",
]

Based on the error, I'm guessing that it's the loading of the original lib that is the source of the issue, and that's it's not the rust wrapper, hence I'm reporting here not https://github.com/MoAlyousef/soloud-rs

@andrewdavidmackenzie
Copy link
Author

Googling meanwhile....

I wondered if this behaviour is affected by the contents of /etc/security/limits.conf?

@nmielcarek
Copy link

Could be related to this: https://unix.stackexchange.com/questions/231941/cant-run-aplay-as-root

I've often had trouble playing audio as root, and it seems to be due either to the environment or how the audio server is setup per-user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants