I have developed a console application in .net 6 which uses a library that needs direct access to the gpio-pins of the Pi.
The Pi is running the latest Pi OS Lite x64.
Edit: This is the library requiring root: https://github.com/hzeller/rpi-rgb-led-matrix
I need to start it with sudo to gain full performance (it's a program to display videos on an LED RGB-Matrix).
The application uses libvlc to play videos which works without a problem.
Now I want to also hear the sound of the videos, so I installed an USB-Soundcard and PulseAudio using this tutorial: How do I run PulseAudio in a headless server installation?
This works as long as I run my program NOT with sudo. As soon as I start it with sudo, I get
Failed to create secure directory (/root/.config/pulse): Permission denied Failed to load cookie file from cookie: Permission denied
The last 6 hours I tried everything, from changing permissions of the folder, so user root as full access to adding a systemd-service and copying config-files from here to there... Now even the installation under the user "pi" is broken and all I get is
No PulseAudio daemon running, or not running as session daemon.
even after reinstalling using above mentioned tutorial.
I'm not a linux-guy and find it extremly complicated for such an easy thing to get it to work.
Finally I want to run my application as systemd and have the audio-output working.
Here are all the tutorials and hints I have tried, none of them worked:
I'm running the latest Pi Os (x64) on a Pi 4.