Test of pipewire with sound

Kennel Linux Void-based


Moderator: Forum moderators

User avatar
rockedge
Site Admin
Posts: 5719
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1997 times
Been thanked: 2099 times
Contact:

Re: Test of pipewire with sound

Post by rockedge »

@fredx181 I installed it now the same way in the KLV-airedale_rootfs which was squashed and produced an boot-able ISO with it included. Audio is working nicely all around in the upgraded KLV-Airedale-RT version.

User avatar
Sofiya
Posts: 1809
Joined: Tue Dec 07, 2021 9:49 pm
Has thanked: 1202 times
Been thanked: 1080 times

Re: Test of pipewire with sound

Post by Sofiya »

@rockedge
How soon can we expect ISO with all these delights? :)

Vanilla Dpup 9.2.X - KLV-Airedale - KLA-OT2
PUPPY LINUX Simple fast free

User avatar
fredx181
Posts: 2561
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 274 times
Been thanked: 993 times
Contact:

Re: Test of pipewire with sound

Post by fredx181 »

dimkr wrote: Wed Sep 20, 2023 6:22 pm

Technically, a situation where a process that runs as spot talks to a process that runs as root can lead to privilege escalation. If the idea behind having the spot user is allowing some sensitive applications to run unprivileged, it's better to restrict applications running as spot from talking to privileged applications, in case they grant spot more privileges or have a vulnerability that allows spot to do anything as root.

Do you know perhaps of an example where running pipewire as root can be a disadvantage ?
(thinking of e.g. bluetooth or .. , I tested very little TBH)

User avatar
fredx181
Posts: 2561
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 274 times
Been thanked: 993 times
Contact:

Re: Test of pipewire with sound

Post by fredx181 »

Sofiya wrote: Wed Sep 20, 2023 7:17 pm

@rockedge
... .. these delights? :)

EasyEffects ?!?! ;)

User avatar
Sofiya
Posts: 1809
Joined: Tue Dec 07, 2021 9:49 pm
Has thanked: 1202 times
Been thanked: 1080 times

Re: Test of pipewire with sound

Post by Sofiya »

fredx181 wrote: Wed Sep 20, 2023 8:20 pm
Sofiya wrote: Wed Sep 20, 2023 7:17 pm

@rockedge
... .. these delights? :)

EasyEffects ?!?! ;)

and EasyEffects and Pipewire !! ;)

Vanilla Dpup 9.2.X - KLV-Airedale - KLA-OT2
PUPPY LINUX Simple fast free

User avatar
fredx181
Posts: 2561
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 274 times
Been thanked: 993 times
Contact:

Re: Test of pipewire with sound

Post by fredx181 »

Another test using the "per user" Void method (instead of modifying .xinitrc) see EDIT2 here: https://forum.puppylinux.com/viewtopic. ... 178#p99178
https://docs.voidlinux.org/config/media ... ntegration

or, for per-user configurations, running ....

dimkr
Posts: 1907
Joined: Wed Dec 30, 2020 6:14 pm
Has thanked: 36 times
Been thanked: 827 times

Re: Test of pipewire with sound

Post by dimkr »

fredx181 wrote: Wed Sep 20, 2023 8:10 pm

Do you know perhaps of an example where running pipewire as root can be a disadvantage ?

PipeWire configures itself to use a realtime scheduling policy if you have rtkit, so if it runs as root and misbehaves (reaches 100% CPU) you might find it challenging to stop it :)

And, if you have two instances of PipeWire (one for root, another for user) they can compete with each other for CPU time and add latency or choppiness.

Having one instance running as spot that is used by both root and spot avoids these potential risks, reduces CPU and RAM consumption (less processes) and the security risk of exposing a PipeWire instance running as root to unprivileged users. That's what I implemented things like this for Puppy: I've personally seen only one case where PipeWire misbehaves in any way (becomes a CPU hog) but it is was long ago.

dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: Test of pipewire with sound

Post by dancytron »

fredx181 wrote: Wed Sep 20, 2023 8:10 pm
dimkr wrote: Wed Sep 20, 2023 6:22 pm

Technically, a situation where a process that runs as spot talks to a process that runs as root can lead to privilege escalation. If the idea behind having the spot user is allowing some sensitive applications to run unprivileged, it's better to restrict applications running as spot from talking to privileged applications, in case they grant spot more privileges or have a vulnerability that allows spot to do anything as root.

Do you know perhaps of an example where running pipewire as root can be a disadvantage ?
(thinking of e.g. bluetooth or .. , I tested very little TBH)

I set up a KLV airdale SR5 that I can use to test with bluetooth. Can you point me to which one you need tested?

User avatar
fredx181
Posts: 2561
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 274 times
Been thanked: 993 times
Contact:

Re: Test of pipewire with sound

Post by fredx181 »

dancytron wrote: Sat Sep 23, 2023 5:34 pm
fredx181 wrote: Wed Sep 20, 2023 8:10 pm
dimkr wrote: Wed Sep 20, 2023 6:22 pm

Technically, a situation where a process that runs as spot talks to a process that runs as root can lead to privilege escalation. If the idea behind having the spot user is allowing some sensitive applications to run unprivileged, it's better to restrict applications running as spot from talking to privileged applications, in case they grant spot more privileges or have a vulnerability that allows spot to do anything as root.

Do you know perhaps of an example where running pipewire as root can be a disadvantage ?
(thinking of e.g. bluetooth or .. , I tested very little TBH)

I set up a KLV airdale SR5 that I can use to test with bluetooth. Can you point me to which one you need tested?

I'd suggest to first try the "run-as-spot pipewire from root login" method : https://forum.puppylinux.com/viewtopic. ... 873#p98873 (should also work when logged in as spot or weedog).
If it doesn't work as expected e.g. with bluetooth, then try what I wrote in first part here https://forum.puppylinux.com/viewtopic. ... 178#p99178 (run pipewire as root, by simple edit of .xinitrc).
P.S. Make sure that pulseaudio isn't started at boot, check with pidof pulseaudio
edit: from Void documentation:

For bluetooth audio to work, install the libspa-bluetooth package.

dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: Test of pipewire with sound

Post by dancytron »

Been pretty busy, but will have some time tonight and tomorrow.

dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: Test of pipewire with sound

Post by dancytron »

1. set up by 1st method at this link. https://forum.puppylinux.com/viewtopic. ... 873#p98873 Installed pipewire stuff including libspa-bluetooth.

2. Installed blueman and enabled bluetooth

Code: Select all

root# ln -s /etc/sv/bluetoothd /var/service/bluetoothd
root# sv up bluetoothd

see https://www.reddit.com/r/linuxquestion ... oid_linux/

3. firefox and parole work fine with bluetooth as root
firefox run-as-spot there is no sound. Pulse audio volume control does not see it.
parole run-as-spot does not work. won't open.

Code: Select all

(process:5341): parole-CRITICAL **: 11:11:33.565: Failed to initialize Xfconf: The connection is closed

More this afternoon hopefully

Last edited by dancytron on Fri Sep 29, 2023 4:12 pm, edited 1 time in total.
dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: Test of pipewire with sound

Post by dancytron »

After a few tries, I now have another one set up with the root method of just adding.

Code: Select all

pipewire &
pipewire-pulse &
wireplumber &
/usr/local/bin/start-up &
exec xfce4-session

At the end of the /root/.xinitrc file. All seems to work well running from root as root. Enabled Bluetooth same way as above.

No sound on run-as-spot firefox so far, but I'll see if I'm missing something and also test it with logging in as a regular user.

edit: all works correctly as a regular user spot.

edit again: works correctly as spot but as regular pulse audio, not as wireplumber/pipewire. will try to follow void linux instructions to configure it to start up pipewire instead of pulse audio.

Last edited by dancytron on Fri Sep 29, 2023 7:30 pm, edited 1 time in total.
dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: Test of pipewire with sound

Post by dancytron »

Is it my imagination, or does the package "pipewire-pulse" not exist?

Is there a startup folder for the spot user or does that needed to be added?

User avatar
fredx181
Posts: 2561
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 274 times
Been thanked: 993 times
Contact:

Re: Test of pipewire with sound

Post by fredx181 »

dancytron wrote: Fri Sep 29, 2023 6:43 pm

Is it my imagination, or does the package "pipewire-pulse" not exist?

Is there a startup folder for the spot user or does that needed to be added?

Yes, package "pipewire-pulse" not exist in Void (pipewire-pulse is symlink to pipewire) and indeed no startup folder for the spot user (also (I think) no line /usr/local/bin/start-up & in spot .xinitrc.

User avatar
rockedge
Site Admin
Posts: 5719
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1997 times
Been thanked: 2099 times
Contact:

Re: Test of pipewire with sound

Post by rockedge »

indeed no startup folder for the spot user (also (I think) no line /usr/local/bin/start-up & in spot .xinitrc.

I think we should add the /home/spot/Startup directory and trigger /usr/local/bin/start-up & by adding the command line to into the .xinitrc to the KLV rootfs. I have experimented with this modification for some time and it is useful. :geek:

dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: Test of pipewire with sound

Post by dancytron »

When logged in as spot, it was still using pulseaudio.

/home/spot/.xinitrc changed to match one in /root

Code: Select all

# exec xfce4-session
###***see https://forum.puppylinux.com/viewtopic.php?p=99178#p99178

pipewire &
pipewire-pulse &
wireplumber &
/usr/local/bin/start-up &
exec xfce4-session

That fixed it.

Then logged in as root. Ran firefox as root. Works fine.

Same thing with run as spot, audio didn't work.

Installed VLC. Didn't work and lots of errors as default or if choosing pulse audio, but if you chose basic speaker setting like it was plain alsa, then pulse audio volume control saw it and it worked!!!! see screenshot Only thing running as spot was vlc itself.

I'll document the error messages and add screenshots later...

Screenshot_2023-09-29.vlc.chooseAlsaRonasSpot.png
Screenshot_2023-09-29.vlc.chooseAlsaRonasSpot.png (453.76 KiB) Viewed 595 times

In this configuration, it would run bluetooth with firefox as root and vlc with run-as-spot through the speaker at the same time, but would not run vlc as bluetooth. :? I've seen this behavior in Debian Dog too.

User avatar
fredx181
Posts: 2561
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 274 times
Been thanked: 993 times
Contact:

Re: Test of pipewire with sound

Post by fredx181 »

Thanks for your testing Dan !
Well, clearly it's a puzzle, ideally everything working, e.g. :
- run application from root login with working sound
- run "run-as-spot <application>" from root login with working sound
- run application from spot login with working sound
- and above working ok with e.g. bluetooth too
Seems nearly impossible to me to have it all, but who knows maybe ...

IMO the setup with the 20pipewire.sfs seems the best to me (for when logged in as root and supporting run-as-spot properly) as it creates a dbus-session for spot (and has modified run-as-spot that supports that).

Note: when logged in as spot, I think pulseaudio is started by default from /etc/xdg/autostart/pulseaudio.desktop, in case of pipewire running you must disable pulseaudio automatic start, by renaming it to e.g. /etc/xdg/autostart/pulseaudio.desktop.bak (or just remove the pulseaudio package, FYI, on Debian there's package pipewire-audio , it does remove pulseaudio package to get pipewire priority)

Post Reply

Return to “KLV-Airedale”