The officially official Devuan Forum!

You are not logged in.

#26 2024-01-23 15:47:50

mirrortokyo
Member
Registered: 2021-04-08
Posts: 54  

Re: How to: Devuan 5 Daedalus an pipewire

Thanks @steve_v, one last thing - you should have mentioned that /usr/bin/daemon is in package daemon.

Offline

#27 2024-01-23 18:09:33

steve_v
Member
Registered: 2018-01-11
Posts: 377  

Re: How to: Devuan 5 Daedalus an pipewire

I kinda did, a few posts earlier in this thread:

steve_v wrote:

using daemon to manage pipewire (and cdemu, which has the same problems). Binding to the user session requires [e]logind and backporting daemon from unstable

daemon has very few dependencies, so a backport is trivial.

Last edited by steve_v (2024-01-23 18:11:56)


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#28 2024-02-23 18:00:29

ffp
Member
Registered: 2024-02-23
Posts: 1  

Re: How to: Devuan 5 Daedalus an pipewire

Hello friends, I tried the implementations listed here on my Dell Latitude 7480 laptop and while they do work, I sometimes had to reboot my laptop a few times to get working audio or manually kill and start the pipewire processes from terminal.
I found a different solution which worked for me and I wanted to share it with you too in case you have a similar problem:

In /etc/X11/Xsession.d/ create a file and call it 98-pipewire and put the following script into it:

#!/bin/bash

# We need to kill any existing pipewire instance to restore sound
pkill -u "${USER}" -fx /usr/bin/pipewire-pulse 1>/dev/null 2>&1
pkill -u "${USER}" -fx /usr/bin/pipewire-media-session 1>/dev/null 2>&1
pkill -u "${USER}" -fx /usr/bin/wireplumber 1>/dev/null 2>&1
pkill -u "${USER}" -fx /usr/bin/pipewire 1>/dev/null 2>&1

exec /usr/bin/pipewire &

# wait for pipewire to start before attempting to start related daemons
while [ "$(pgrep -f /usr/bin/pipewire)" = "" ]; do
        sleep 1
done

if [ -x /usr/bin/wireplumber ]; then
	exec /usr/bin/wireplumber &
elif [ -x /usr/bin/pipewire-media-session ]; then
	exec /usr/bin/pipewire-media-session &
fi

[ -f "/usr/share/pipewire/pipewire-pulse.conf" ] && exec /usr/bin/pipewire-pulse &

And with this I get audio on every reboot so no more restarting my laptop multiple times.

The only issue I had after doing this is that sometimes the audio was a bit choppy.
I found a solution on the Debian wiki but it had to be applied on every boot so I did this:

In /usr/share/pipewire/pipewire.conf I uncommented and changed the settings

default.clock.allowed-rates = [ 44100 48000 ]
default.clock.quantum       = 2048
default.clock.min-quantum   = 2048

And after rebooting this was solved for me too. I hope this can help you as well!

Offline

#29 2024-02-27 17:41:55

nixer
Member
From: North Carolina, USA
Registered: 2016-11-30
Posts: 211  

Re: How to: Devuan 5 Daedalus an pipewire

I hope this can help you as well!

Thank you ffp!  This got pipewire working on a daedalus install that has been dist-upgraded from ascii > beowulf > chimaera > to daedalus!

Offline

#30 2024-02-29 18:29:04

nixer
Member
From: North Carolina, USA
Registered: 2016-11-30
Posts: 211  

Re: How to: Devuan 5 Daedalus an pipewire

steve_v, would you please elaborate how you used daemon to run the commands you quoted?  Specifically, where did you put these commands and how did you "autostart" them?

In 3 autostart files (or wherever else you might want them).

I have tried to run them from /etc/rc.local.  I tried to add your commands to the /etc/daemon.conf file and tried to add them individually to /etc/daemon.conf.d folder.  Try as I might, I can only get the "daemon --list --verbose" command to output "No named daemons are running".  I was just trying things because my web searching on how to use "daemon" was not very successful.

But, I added the three commands to a file in /usr/local/bin and set it to autostart upon login with xfce and pipewire does work.  But I still get the "No named daemons are running" output from the terminal. 

I have tried this on both daedalus and ceres and I get the same results.  Any additional information would be appreciated.

Last edited by nixer (2024-02-29 18:30:04)

Offline

#31 2024-03-23 23:53:14

mweishaar
Member
Registered: 2018-11-11
Posts: 36  

Re: How to: Devuan 5 Daedalus an pipewire

@nixer I couldn't get it to work either, but when I run the daemon command from the terminal I get "unrecognized option '--bind' " which would explain why it isn't working. I have daemon 0.8-1+b1 from backports. But re-reading, steve_v said unstable backports.
I'll have to look up how to install from unstable, I usually don't mess with that. smile

Maybe you have the same issue.

Offline

#32 2024-04-19 23:38:39

abower
Member
Registered: 2024-04-19
Posts: 1  

Re: How to: Devuan 5 Daedalus an pipewire

Another might be adapting supervise-daemon or runits runsvdir, or running dinit in a user-session context.

Thanks for the idea, steve_v! I just set up a runit-based solution. It seems yours has a more sophisticated lifecycle integration with the session/login manager (I'm not so clued up on that stuff) but here's what I have done anyhow:

The runit scripts may be found at runit-desktop - they can be unpacked to ~/.xusersvc. Here's a sample:

#!/usr/bin/sh

SVDIR=$(dirname ${PWD}) sv start pipewire || exit 1

set -e
exec 2>&1
echo "Starting ${PWD##*/}..."

exec /usr/bin/pipewire-pulse

Then I have an XFCE Application autostart entry (cat "~/.config/autostart/User runsvdir.desktop":

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=User runsvdir
Comment=Start user runit services
Exec=runsvdir .xusersvc
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false

and we are away (sv status .xusersvc/*)!

run: .xusersvc/pipewire: (pid 19758) 1035s; run: log: (pid 19757) 1035s
run: .xusersvc/pipewire-pulse: (pid 19778) 1035s; run: log: (pid 19769) 1035s
run: .xusersvc/wireplumber: (pid 19771) 1035s; run: log: (pid 19768) 1035s

With log files sitting in ~/.xuserlog/*/current:

024-04-19_22:58:50.32626 ok: run: pipewire: (pid 19758) 0s
2024-04-19_22:58:50.32632 Starting pipewire-pulse...
2024-04-19_22:58:51.58468 [W][06850.910390] default      | [   snap-policy.c:   71 pw_snap_get_audio_permissions()] snap_get_audio_permissions: kernel lacks 'fine grained unix mediation'; snap audio permissions won't be honored.

Supervision seems to end satisfactorily on session exit although I did also try a logout hook that ran pkill -HUP on the user's runsvdir but I'm not sure what it gained.

Fortunately it seems the services create their own sockets when systemd activation is absent and we don't need to worry about the various .socket units.

(Also, my first post although I have used the OS for some years - thank you Devuan people!)

Offline

#33 2024-04-20 10:03:53

steve_v
Member
Registered: 2018-01-11
Posts: 377  

Re: How to: Devuan 5 Daedalus an pipewire

nixer wrote:

where did you put these commands and how did you "autostart" them?

In my case they're just desktop files in /etc/xdg/autostart. Actually running them is up to an XDG compliant DE.
Anywhere else that has them start after session login should work just as well though.

I still get the "No named daemons are running" output from the terminal.

Probably can't find any pidfiles, '--list' also needs the same '--pidfiles' argument you used when starting them, or a default set in /etc/daemon.conf

mweishaar wrote:

"unrecognized option '--bind'"

Yeah, elogind hooks need a version from unstable. >=0.8.2 IIRC.
See the "simple backport creation" debian wiki entry for an easy guide.

Last edited by steve_v (2024-04-20 10:05:49)


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#34 2024-04-23 21:53:02

mweishaar
Member
Registered: 2018-11-11
Posts: 36  

Re: How to: Devuan 5 Daedalus an pipewire

I just added teh aformentioned script (in ~/bin) to XFCE's Application Startup under Session and Startup.

No issues pipewire is running without a hiccup.
I do only reboot when necessary, which isn't very often. But I did a few times just to make sure it was working.

Offline

#35 2024-04-23 22:30:18

GlennW
Member
From: Brisbane, Australia
Registered: 2019-07-18
Posts: 643  

Re: How to: Devuan 5 Daedalus an pipewire

@mirrortokyo: HoaS's scripting solution may be found all over the net, I wouldn't know where to start, am just the messenger.

I like your solution Steve, looks nice and tidy and repeatable from install to install.

Thank you


pic from 1993, new guitar day.

Offline

#36 2024-04-26 09:02:57

mirrortokyo
Member
Registered: 2021-04-08
Posts: 54  

Re: How to: Devuan 5 Daedalus an pipewire

@GlennW my current solution is:

~/.xsessionrc

/usr/bin/daemon --bind --respawn --pidfiles=$XDG_RUNTIME_DIR --name=pipewire /usr/bin/pipewire
/usr/bin/daemon --bind --respawn --pidfiles=$XDG_RUNTIME_DIR --name=pipewire-pulse /usr/bin/pipewire-pulse
/usr/bin/daemon --bind --respawn --pidfiles=$XDG_RUNTIME_DIR --name=pipewire-wireplumber /usr/bin/wireplumber

Currently working fine, but if the packages related to pipewire get upgraded, one may need to exit the desktop session, and if sound isn't working on logging in again either do:

init 1

then

exit

to get the desktop session login manager up again,

or in extreme cases shutdown the computer and reboot.

Last edited by mirrortokyo (2024-04-26 09:10:16)

Offline

#37 2024-04-28 00:57:18

EDX-0
Member
Registered: 2020-12-12
Posts: 79  

Re: How to: Devuan 5 Daedalus an pipewire

fun, my current solution was to not even bother with daemon but instead write a whole program to do management of user level services independient of any init...

tho i need to work on it.
https://github.com/eylles/shed

i do not use a desktop environment so instead of a regular autostart i use this program, there is a lot more that i need to do since i know next to nothing about some stuff and shed is written off my limited understanding of how sysvinit works.

thanks to shed all i need to have these 3 simple files:

pipewire:

NAME=pipewire
EXEC=/usr/bin/pipewire

pipewire-pulse:

NAME=pipewire-pulse
EXEC=/usr/bin/pipewire-pulse

wireplumber:

NAME=wireplumber
EXEC=/usr/bin/wireplumber

and shed will do the rest, i can restart any individual binary if needed or all 3.

Last edited by EDX-0 (2024-04-28 16:27:57)

Offline

#38 2024-05-26 03:16:12

soren
Member
Registered: 2023-04-30
Posts: 142  

Re: How to: Devuan 5 Daedalus an pipewire

steve_v wrote:

FWIW (in case I haven't mentioned it already elsewhere, which I probably have) my current solution is daemon, and these three lines:

/usr/bin/daemon --bind --respawn --pidfiles=$XDG_RUNTIME_DIR --name=pipewire /usr/bin/pipewire
/usr/bin/daemon --bind --respawn --pidfiles=$XDG_RUNTIME_DIR --name=pipewire-pulse /usr/bin/pipewire-pulse
/usr/bin/daemon --bind --respawn --pidfiles=$XDG_RUNTIME_DIR --name=pipewire-wireplumber /usr/bin/wireplumber

n 3 autostart files (or wherever else you might want them).

Order no longer matters and sleep / while loop hacks are eliminated, because --respawn.
Pipewire not exiting with the user session is fixed (without pkill hacks), because --bind.
Pipewire not doing any of the other things a daemon should do (like writing a pid file or detaching from stdout and forking into the background) is also fixed, and --name and --pidfiles allow for e.g.

As quoted from steve_v above this has worked for me up until recently, I found out that --bind flag is no longer workin using daemon, can you confirm steve or anyone else? So i took that out of the commands and now it is working. Im on deadalus stable.

Also can anyone suggest a better way to make pipewire/pulse whatever use the audio sink that i want as default? Currently im just using a command to make the bluetooth speaker default sink as follows in xfce4. Im too used to alsa and cant figure this new pipewire stuff out, but i need to so i can make the new bluetooth speaker work.

sleep 10s && pactl set-default-sink "bluez_output.10_94_UE_EC_C0_5E.1"

Otherwise pipewire/pulse automatically sets the hdmi alsa sink from the monitor and i cant seem to get pactl to keep my setting over reboots or logouts.

Last edited by soren (2024-05-26 03:17:12)

Offline

#39 2024-05-26 03:32:44

soren
Member
Registered: 2023-04-30
Posts: 142  

Re: How to: Devuan 5 Daedalus an pipewire

Just to add a bit more info to my previous post. I found the below relating to the --bind flag on daemon.  Not sure what this means, but i do have elogind running as im now using xfce4.

If the `--bind` option was supplied, on systems with *systemd-logind* or
*elogind*, the client process will be terminated when the user logs out.

https://www.libslack.org/daemon/README

Offline

Board footer