Pipewire sound system setup how-to

a very small Live CD shaped to look and act like Puppy Linux.

Moderator: fredx181

Post Reply
User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Pipewire sound system setup how-to

Post by fredx181 »

To activate pipewire as sound system on Bookworm, Daedalus or Sid builds.
Update: 04-04-2024, new deb package v1.2.0 apt update; apt install pipewire-setup and see: viewtopic.php?p=112530#p112530
Update: 01-04-2024, new deb package v1.1.0 apt update; apt install pipewire-setup and see: viewtopic.php?p=112530#p112530
Update: 23-02-2024, a .deb package for to setup pipewire is available now, see: viewtopic.php?p=112530#p112530
(edit: what to say about pipewire: I'm no good with that, anyway I see it as pulseaudio replacement but then more friendly :roll: :D )
This is alternative method. It works for my rather simple needs anyway. The goal is to make sound work (using the pipewire setup), for when applications requiring sound as root, as well as when running as user 'puppy" (unprivileged user) (when logged in as root) by running e.g. run-as-user <command>, user "puppy" should be included, in a 'Dog' system and then run-as-user is by default running "as user puppy"). edit; all similar to "run-as-spot" and can't stop thanking for the development from Mr. Sir @jamesbond 8-) :lol:
For this, the latest 'run-as-user' script (from package 'run-as-user' v0.0.5) is required.
Inspired by the way that BookwormPup64 handes it (it's running pipewire as user 'spot').

How to:

  • Install the pipewire-audio package, will install with dependencies, also newest 'run-as-user' required (v0.0.5) and pavucontrol:
    apt update; apt install pipewire-audio pavucontrol run-as-user
  • Download attached "run-pipewire.tar.gz", extract in /usr/local/bin, so you get /usr/local/bin/run-pipewire
    run-pipewire.tar.gz
    Extract and copy run-pipewire to /usr/local/bin/
    (702 Bytes) Downloaded 44 times
  • add in /root/.xsession . /usr/local/bin/run-pipewire before the line exec openbox-session (in case openbox running) so you get:

    Code: Select all

    . /usr/local/bin/run-pipewire  # note the '.' as first character, that way it's "sourced", as should be
    exec openbox-session
    Or in case of XFCE build, in /root/.xinitrc:

    Code: Select all

    . /usr/local/bin/run-pipewire  # note the '.' as first character, that way it's "sourced", as should be
    exec xfce4-session
    Reboot or restart X to apply.
    Check "Pulseaudio volume Control" from Menu or from terminal: pavucontrol or alsamixer if it's working correctly.
    EDIT: not sure if bluetooth audio works, I cannot test.
Clarity
Posts: 3270
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1347 times
Been thanked: 438 times

Re: Pipewire setup how-to

Post by Clarity »

With the work you have done (and are doing) with Pipewire for audio requirements on this forum AND with the work being done to contribute to @wiak in Wayland, I think both of you know there is a conjunction in these 2 technologies on the same system.

Anyway, here is a finding that I "think" might be helpful to forum members. (move this post if appropriate!)

There is no official GUI configuration tool for PipeWire yet, but there are a few third-party options available:

  • Gpwgraph is a Qt GUI interface for PipeWire that is based on QjackCtl. It allows you to view and manage all of your audio devices and connections.

  • Helvum is a GTK GUI interface for PipeWire that is also based on QjackCtl. It has a similar feature set to Gpwgraph, but it uses the GTK toolkit instead of Qt.

  • pw-viz is a web-based GUI interface for PipeWire that is still under development. It allows you to view and manage your audio devices and connections in a web browser.

In addition, some desktop environments, such as GNOME/KDE, provide their own GUI configuration tools for PipeWire. For example, the GNOME Sound Settings application allows you to set your default audio devices and configure other aspects of PipeWire.

FYI

User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: Pipewire setup how-to

Post by fredx181 »

Thanks @Clarity
To promote a little more about this pipewire setup :) :
In the past I've been experimenting logged in as root with "run-as-user' (equivalent of run-as-spot) but never wasn't really satisfied, for example running run-as-user vlc (vlc cannot run as root)] that way worked but never was perfect (showing warnings or errors when running from terminal, and didn't save the configuration made (permission issue :?: )).
Now with this pipewire setup, for me vlc runs without any warnings or errors:

Code: Select all

root@live:~# run-as-user vlc
VLC media player 3.0.18 Vetinari (revision 3.0.13-8-g41878ff4f2)
[000055c2ce9f7520] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000055c2cea90a50] main playlist: playlist is empty

And it is saving configuration properly (e.g. remembering recent media played and more).
Running firefox as "user" works well too with sound, btw.
edit: running alsamixer works as it should too according to ths setup IMO, display of "pipewire" as "device".

Pulseaudio on itself may have problems, run it as root can be problematic, so let's go for pipewire ! (also has some nice options to plug in, e.g. EasyEffects).

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

Re: Pipewire setup how-to

Post by dancytron »

I look forward to trying what you figured out for run-as-user.

I've had a busy week. I just got set up to make another one and then saw this. I'll test it with bluetooth.

Dan

edit: It breaks audio on my systemd version, which is expected I think because it's already started by systemd before .xsession runs.

I'll build a non-systemd version with the same .conf file and see how that does and then add your change.

User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: Pipewire setup how-to

Post by fredx181 »

dancytron wrote: Sat Oct 14, 2023 9:38 pm

...
edit: It breaks audio on my systemd version, which is expected I think because it's already started by systemd before .xsession runs.
..

The setup from post #1 works ok for me with a (clean) systemd build, I guess for you it's perhaps because of earlier changes you did, e.g. systemd service files in /root/.config/systemd ?
(edit: although there are service files for pipewire and wireplumber in /etc/systemd, they are not activated for when logged in as root)
Also make sure that there no other files leftover from previous tests, e.g. /home/puppy/.config/pulse (cookie?) or /root/.config/pulse .

Clarity
Posts: 3270
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1347 times
Been thanked: 438 times

Re: Pipewire sound system setup how-to

Post by Clarity »

This is some info that those who want a high level understanding of "WHAT" Pipewire is: The 1st few minutes of this video presentation and its visuals can make it easy to understand.

What is Pipewire.jpg
What is Pipewire.jpg (32.41 KiB) Viewed 1545 times
dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 421 times
Been thanked: 190 times

Re: Pipewire sound system setup how-to

Post by dancytron »

I built another one with systemd. Sound works with firefox both as root and with run-as-user. Bluetooth doesn't work quite right, but it sees my speaker.

Hopefully, I'll work on it some more later.

edit: when I built it, I added the following additional files to a regular OB full Debian Dog firefox build.

Code: Select all

slim blueman pavucontrol libspa-0.2-bluetooth wireplumber firmware-linux-nonfree firmware-realtek libdrm-amdgpu1 
xserver-xorg-input-libinput pipewire pipewire-audio wireplumber-doc ntp firmware-iwlwifi

I added puppy to the bluetooth and pipewire groups.

Last edited by dancytron on Sat Oct 21, 2023 3:45 pm, edited 1 time in total.
dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 421 times
Been thanked: 190 times

Re: Pipewire sound system setup how-to

Post by dancytron »

Back again.

edit: skip to the end for what I actually may have figured out.

This is the systemctl for bluetooth.

Code: Select all

root@live:~# systemctl status bluetooth
● bluetooth.service - Bluetooth service
     Loaded: loaded (]8;;file://live/lib/systemd/system/bluetooth.service/lib/systemd/system/bluetooth.service]8;;; enabled; preset: enabled)
     Active: active (running) since Sun 2023-10-15 22:06:15 CDT; 4h 51min left
       Docs: ]8;;man:bluetoothd(8)man:bluetoothd(8)]8;;
   Main PID: 1036 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 13040)
     Memory: 3.3M
        CPU: 140ms
     CGroup: /system.slice/bluetooth.service
             └─1036 /usr/libexec/bluetooth/bluetoothd

Oct 15 22:06:15 live bluetoothd[1036]: Starting SDP server
Oct 15 22:06:15 live bluetoothd[1036]: profiles/audio/vcp.c:vcp_init() D-Bus experimental not enabled
Oct 15 22:06:15 live bluetoothd[1036]: src/plugin.c:plugin_init() Failed to init vcp plugin
Oct 15 22:06:15 live bluetoothd[1036]: profiles/audio/mcp.c:mcp_init() D-Bus experimental not enabled
Oct 15 22:06:15 live bluetoothd[1036]: src/plugin.c:plugin_init() Failed to init mcp plugin
Oct 15 22:06:15 live bluetoothd[1036]: profiles/audio/bap.c:bap_init() D-Bus experimental not enabled
Oct 15 22:06:15 live bluetoothd[1036]: src/plugin.c:plugin_init() Failed to init bap plugin
Oct 15 22:06:15 live bluetoothd[1036]: Bluetooth management interface 1.22 initialized
Oct 15 22:06:15 live bluetoothd[1036]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed.
Oct 15 22:06:15 live bluetoothd[1036]: sap-server: Operation not permitted (1)
root@live:~# 

The error I get (which tells us nothing) when trying to connect to my bluetooth speaker is:

Code: Select all

Connection failed: br-connection-profile-unavailable

Running bluetoothctl while searching for and trying to connect to my bluetooth speaker (Anker Soundcore) got this:

Code: Select all

root@live:~# bluetoothctl
Agent registered
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: yes
[NEW] Device 3C:39:E7:C0:D4:9A Anker SoundCore
[CHG] Device 3C:39:E7:C0:D4:9A RSSI: -50
[CHG] Device 3C:39:E7:C0:D4:9A RSSI: -42
[NEW] Device E0:5A:1B:86:7D:FE Core200S
[CHG] Device 3C:39:E7:C0:D4:9A RSSI: -50
[CHG] Device 3C:39:E7:C0:D4:9A RSSI: -42
[NEW] Device 24:18:C6:AC:35:00 Realtek Bluetooth
[CHG] Device 3C:39:E7:C0:D4:9A RSSI: -50
[CHG] Device 3C:39:E7:C0:D4:9A RSSI: -42
[CHG] Device 24:18:C6:AC:35:00 RSSI: -59
[CHG] Device E0:5A:1B:86:7D:FE RSSI: -68
[CHG] Device 24:18:C6:AC:35:00 RSSI is nil
[CHG] Device E0:5A:1B:86:7D:FE RSSI is nil
[CHG] Device 3C:39:E7:C0:D4:9A RSSI is nil
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: no
[CHG] Device 3C:39:E7:C0:D4:9A UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device 3C:39:E7:C0:D4:9A UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 3C:39:E7:C0:D4:9A UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 3C:39:E7:C0:D4:9A UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 3C:39:E7:C0:D4:9A UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 3C:39:E7:C0:D4:9A Connected: yes
[CHG] Device 3C:39:E7:C0:D4:9A Connected: no
[DEL] Device 24:18:C6:AC:35:00 Realtek Bluetooth
[DEL] Device E0:5A:1B:86:7D:FE Core200S
[DEL] Device 3C:39:E7:C0:D4:9A Anker SoundCore
[bluetooth]# 

edit: after enabling dbus experimental in /ect/bluetooth.main.conf as suggested *insert link, I got this for systemctl status:

Code: Select all

root@live:~# systemctl status bluetooth
● bluetooth.service - Bluetooth service
     Loaded: loaded (]8;;file://live/lib/systemd/system/bluetooth.service/lib/systemd/system/bluetooth.service]8;;; enabled; preset: enabled)
     Active: active (running) since Sat 2023-10-21 16:08:30 CDT; 4h 52min left
       Docs: ]8;;man:bluetoothd(8)man:bluetoothd(8)]8;;
   Main PID: 1048 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 13040)
     Memory: 3.5M
        CPU: 255ms
     CGroup: /system.slice/bluetooth.service
             └─1048 /usr/libexec/bluetooth/bluetoothd

Oct 21 16:08:30 live systemd[1]: Started bluetooth.service - Bluetooth service.
Oct 21 16:08:30 live bluetoothd[1048]: Starting SDP server
Oct 21 16:08:30 live bluetoothd[1048]: Bluetooth management interface 1.22 initialized
Oct 21 16:08:30 live bluetoothd[1048]: Battery Provider Manager created
Oct 21 16:08:31 live bluetoothd[1048]: src/adapter.c:load_devices() Unable to load key file from /var/lib/bluetooth/00:1A:7D:DA:71:13/3C:39:E7:C0:D4>
Oct 21 16:08:31 live bluetoothd[1048]: src/device.c:device_load_svc_chng_ccc() Unable to load key file from /var/lib/bluetooth/00:1A:7D:DA:71:13/3C:>
Oct 21 16:08:31 live bluetoothd[1048]: Adv Monitor Manager created with supported features:0x00000000, enabled features:0x00000000, max number of su>
Oct 21 11:10:26 live bluetoothd[1048]: Path / reserved for Adv Monitor app :1.31
Oct 21 11:10:45 live bluetoothd[1048]: src/service.c:btd_service_connect() a2dp-sink profile connect failed for 3C:39:E7:C0:D4:9A: Protocol not avai>
Oct 21 11:10:45 live bluetoothd[1048]: src/service.c:btd_service_connect() a2dp-source profile connect failed for 3C:39:E7:C0:D4:9A: Protocol not av>
lines 1-22/22 (END)

So maybe this is what is stopping us?

Code: Select all

Oct 21 16:08:31 live bluetoothd[1048]: src/adapter.c:load_devices() Unable to load key file from /var/lib/bluetooth/00:1A:7D:DA:71:13/3C:39:E7:C0:D4>
Oct 21 16:08:31 live bluetoothd[1048]: src/device.c:device_load_svc_chng_ccc() Unable to load key file from /var/lib/bluetooth/00:1A:7D:DA:71:13/3C:>

which leads to a folder only root can see or write to.

Of course, I can (and will later) brute force change that, but that's not really usable.

edit: brute force changing the file permissions doesn't work, it changes them back whenever you try to connect.

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

Re: Pipewire sound system setup how-to

Post by dancytron »

I spent some time with it and the short version, I can't get Bluetooth to work and I'm pretty sure the people at Bluetooth would consider this a feature, not a bug.

This link has the meanings of the many security settings in the bluetooth.service file.

https://www.freedesktop.org/software/sy ... .exec.html

see also:

https://github.com/FreeRADIUS/freeradiu ... ssues/2637

this didn't fix it https://github.com/grafana/grafana/issues/41299 (or maybe I didn't do it right)

Bookworm bluetooth.service file attached.

bluetooth.service.txt
(760 Bytes) Downloaded 16 times
User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: Pipewire sound system setup how-to

Post by fredx181 »

Thanks for the info.
Pity that bluetooth not working on bookworm for you, did you ever got it to work on any (other) system ? (with or without systemd) Perhaps it's just working only when running the system as normal user instead of root :?:

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

Re: Pipewire sound system setup how-to

Post by dancytron »

Bluetooth works perfectly in Bullseye with the pulse audio run as system user hack. I haven't tried that on bookworm recently.

Bluetooth works in bookworm running as root with the pipewire set up with just the 4 files to get rid of the arbitrary "!=root", but won't work with run-as-user (no audio at all with run-as-user). It works when running as the puppy user.

User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: Pipewire sound system setup .deb package

Post by fredx181 »

For more convenience (instead of following instructions from first post) I've added to custom repo pipewire-setup .deb package, download and install:
https://github.com/doglinux/book-worm/r ... .0_all.deb (edit 04-04-2024 updated to 1.2.0)
edit: above deb package changed to latest v1.2.0 , possible problem fixed when using a login-manager, e.g. slim
(edit: for Bookworm, Daedalus and Sid, tried on Bullseye too but seems problematic edit: see how-to for Bullseye below)
Or just install with apt (on Bookworm, Daedalus and Sid): apt update; apt install pipewire-setup (reboot or re-login required to apply).
Similar as mentioned earlier, pipewire and wireplumber will run "as-user", so then running e.g. run-as-user firefox , sound should work (and running an application as root , sound works too).

To make pipewire/wireplumber the audio-sytem on a new build made with mklive-bookworm, mklive-daedalus and/or mklive-sid , add pipewire-setup to the list of installed packages.

User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Pipewire for Bullseye

Post by fredx181 »

With the same .deb package (see previous post) pipewire-setup can be used for Bullseye, but needs the bullseye-backports repo enabled.
(also updated the "run-as-user" package (v0.0.5 now) (edit: v0.0.7 now) in the custom Bullseye repo).

First enable the bullseye-backports repo: (if not already enabled), from terminal:
echo 'deb http://ftp.de.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/backports.list

Then: from terminal:

Code: Select all

# update package lists
apt update
# download pipewire-setup_1.2.0_all.deb # edit v1.2.0 now
wget --no-check-certificate https://github.com/doglinux/book-worm/raw/master/amd64/pipewire-setup_1.2.0_all.deb # edit v1.2.0 now
# install pipewire-setup_1.2.0_all.deb (will give error about missing dependencies)
dpkg -i pipewire-setup_1.2.0_all.deb
# force installing missing dependencies from bullseye-backports repo
apt -f install -t bullseye-backports

After reboot or re-login, the pipewire/wireplumber setup should be activated.

User avatar
soniabu
Posts: 258
Joined: Fri Jul 24, 2020 6:14 pm
Location: Paris<-->Montreal
Has thanked: 123 times
Been thanked: 30 times

Re: Pipewire sound system setup .deb package

Post by soniabu »

fredx181 wrote: Thu Feb 22, 2024 3:50 pm

For more convenience (instead of following instructions from first post) I've added to custom repo pipewire-setup .deb package, download and install:
https://github.com/doglinux/book-worm/r ... .0_all.deb
(edit: for Bookworm, Daedalus and Sid, tried on Bullseye too but seems problematic edit: see how-to for Bullseye below)
Or just install with apt (on Bookworm, Daedalus and Sid): apt update; apt install pipewire-setup (reboot or re-login required to apply).
Similar as mentioned earlier, pipewire and wireplumber will run "as-user", so then running e.g. run-as-user firefox , sound should work (and running an application as root , sound works too).

To make pipewire/wireplumber the audio-sytem on a new build made with mklive-bookworm, mklive-daedalus and/or mklive-sid , add pipewire-setup to the list of installed packages.

So could I also install it on my Bookworm - Debiandogs - Lenovo pc?

User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: Pipewire sound system setup .deb package

Post by fredx181 »

soniabu wrote: Fri Feb 23, 2024 7:30 pm
fredx181 wrote: Thu Feb 22, 2024 3:50 pm

For more convenience (instead of following instructions from first post) I've added to custom repo pipewire-setup .deb package, download and install:
https://github.com/doglinux/book-worm/r ... .0_all.deb
(edit: for Bookworm, Daedalus and Sid, tried on Bullseye too but seems problematic edit: see how-to for Bullseye below)
Or just install with apt (on Bookworm, Daedalus and Sid): apt update; apt install pipewire-setup (reboot or re-login required to apply).
Similar as mentioned earlier, pipewire and wireplumber will run "as-user", so then running e.g. run-as-user firefox , sound should work (and running an application as root , sound works too).

To make pipewire/wireplumber the audio-sytem on a new build made with mklive-bookworm, mklive-daedalus and/or mklive-sid , add pipewire-setup to the list of installed packages.

So could I also install it on my Bookworm - Debiandogs - Lenovo pc?

Yes, it should work on Bookworm, don't know if pipewire is useful for you.

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

Re: Pipewire sound system setup how-to

Post by dancytron »

Just built a Chromedog with the new pipewire-setup included, not systemd.

Code: Select all

firmware-realtek firmware-linux-nonfree firmware-iwlwifi firmware-misc-nonfree pipewire-setup

were the only extra apps.

Logging in as root, sound worked in chrome both as root and puppy. Logging in as puppy, sound also worked.

I'll try to test it some more later.

Dan

edit: bluetooth is the same as before. It doesn't work.

User avatar
fredx181
Posts: 2560
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 273 times
Been thanked: 992 times
Contact:

Re: Pipewire sound system setup how-to

Post by fredx181 »

Found a problem with the pipewire-setup package that the behavior was different when using a login manager, e.g. slim, than without.
Fixed in latest pipewire-setup deb package v1.2.0, (so should work OK now with and without using login-manager).

Install or upgrade (in Bookworm, Daedalus (Starter-Kit too, as it's based on Daedalus) or Sid): apt update; apt install pipewire-setup (will install v1.2.0 and also upgrade dependency "run-as-user" (v0.0.7 is latest now))

Post Reply

Return to “DebianDogs”