Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] [runit] Pipewire crashes after suspend (Read 3487 times) previous topic - next topic
0 Members and 6 Guests are viewing this topic.

Re: [runit] Pipewire crashes after suspend

Reply #15
Ok, there are no log files being generated. I got curious and added echo in the pre and the post section in order to check if anything is being executed in the given state. As it seems my script does not work at all since there are no echo files in my home directory which I put in my script. I also did

Code: [Select]
$ sudo chmod a+x /usr/lib/elogind/system-sleep/00-pipewire.sh

Elogind is also activated as a runit service:

Code: [Select]
$ ls /run/runit/service
agetty-tty1  agetty-tty3  agetty-tty5  backlight   connmand  dbus     mullvad
agetty-tty2  agetty-tty4  agetty-tty6  bluetoothd  cupsd     elogind  udevd

Re: [runit] Pipewire crashes after suspend

Reply #16
Let's go back to the beginning:
Code: [Select]
pipewire &
pipewire-pulse &
pipewire-alsa &
wireplumber &
xrdb ~/.Xresources
exec startxfce4

Everything works fine until I close my laptop lid which causes my machine to suspend. Afterwards, when I want to continue to work, everything works except audio. Pipewire does not work anymore and starting it manually gives me some error messages:
Can you please temporarily move the file /usr/lib/elogind/system-sleep/00-pipewire.sh to some other location, say home directory of your user, and change your ~/.xinitrc to:
Code: [Select]
pipewire >/tmp/pipewire.log 2>&1 &
pipewire-pulse >/tmp/pipewire-pulse.log 2>&1 &
pipewire-alsa >/tmp/pipewire-alsa.log 2>&1 &
wireplumber >/tmp/wireplumber.log 2>&1 &
xrdb ~/.Xresources
exec dbus-launch startxfce4
Then (after relogging) try to suspend/resume, and paste those logs?

Re: [runit] Pipewire crashes after suspend

Reply #17
I moved /usr/lib/elogind/system-sleep/00-pipewire.sh to my home directory such that /usr/lib/elogind/system-sleep/ is empty and my .xinitrc now looks like this:

Code: [Select]
pipewire >/tmp/pipewire.log 2>&1 &
pipewire-pulse >/tmp/pipewire-pulse.log 2>&1 &
pipewire-alsa >/tmp/pipewire-alsa.log 2>&1 &
wireplumber >/tmp/wireplumber.log 2>&1 &
xrdb ~/.Xresources
exec dbus-launch --exit-with-session startxfce4

After relogging the only log file which has some content is wireplumber.log:

Code: [Select]
C 16:18:09.363298               GLib (null):(null):(null): Failed to set scheduler settings: Die Operation ist nicht erlaubt
M 16:18:42.720046         spa.bluez5 ../pipewire/spa/plugins/bluez5/bluez5-dbus.c:1352:device_update_props: unknown adapter /org/bluez/hci0

So nothing relevant as it seems. The other log files are empty.

Just for your information, in my xfce power settings under system->laptopscreen I have chosen "Bereitschaft" which is German for standby. The other options would be to lock the screen, to shut off the screen and "Ruhezustand" which would translate to hibernation.


Re: [runit] Pipewire crashes after suspend

Reply #19
Code: [Select]
$ ps -e | grep wire
before standby gives me

Code: [Select]
 1110 tty1     00:00:00 pipewire
 1111 tty1     00:00:00 pipewire-pulse
 1113 tty1     00:00:00 wireplumber

After standby I get

Code: [Select]
 1110 tty1     00:00:00 pipewire
 1111 tty1     00:00:00 pipewire-pulse
 1113 tty1     00:00:00 wireplumber <defunct>

So apparently only wireplumber has some problems. Starting it then manually makes my audio work again.

Re: [runit] Pipewire crashes after suspend

Reply #20
I just tried installing pipewire + pipewire-pulse + wireplumber inside the live environment on my laptop (lxqt+dinit). I then killed pulseaudio, ran all the pipewire-related programs, and tested that sound works. Then I suspended the laptop, resumed and everything still worked. I cannot recreate the issue on real hardware.

Also see: https://wiki.archlinux.org/title/PipeWire#Audio_problems_after_standby

Re: [runit] Pipewire crashes after suspend

Reply #21
I don't have alsa-utils and other related packages installed so 
Code: [Select]
# alsactl init
won't help in my case. Just ignore the fact that I have mistakenly put pipewire-alsa & in my .xinitrc.

Hmm.. this is strange.  I'll try using pipewire-media-session instead of wireplumber. Will report back in a minute.

Edit: Nope, the same problem occurs: pipewire-media-session crashes as well after suspend.
I get this output after waking up from suspend:

Code: [Select]
[W][00126.250747] spa.bluez5   | [   bluez5-dbus.c: 1352 device_update_props()] unknown adapter /org/bluez/hci0

But this should not be the root of the problem, right?

Re: [runit] Pipewire crashes after suspend

Reply #22
Code: [Select]
[W][00126.250747] spa.bluez5   | [   bluez5-dbus.c: 1352 device_update_props()] unknown adapter /org/bluez/hci0

But this should not be the root of the problem, right?
Could be: https://wiki.archlinux.org/title/PipeWire#Bluetooth_devices

You could try this: https://wiki.archlinux.org/title/PipeWire#Automatic_profile_selection

Re: [runit] Pipewire crashes after suspend

Reply #23
Still no luck with it.  At least we could narrow the problem down to wireplumber. I have also learned that pipewire behaves fine with going to suspend and waking up from it.
I installed this system with the runit base iso following the wiki. Maybe it is a hardware related problem? I have a Lenovo L380.

Edit: Maybe this is relevant. After starting wireplumber manually after suspend I get this error message (wireplumber runs nevertheless):

Code: [Select]
C 18:51:04.902249               GLib (null):(null):(null): Failed to set scheduler settings: Die Operation ist nicht erlaubt
which says that the operation is not allowed.

Re: [runit] Pipewire crashes after suspend

Reply #24
I think you could try blacklisting bluetooth-related modules in kernel and/or disabling bluetoothd (bluez-runit), as they seem to confuse wireplumber/pipewire-media-session.

Update:
https://raspberrypi.stackexchange.com/a/42302
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2010
https://forums.gentoo.org/viewtopic-p-7655754.html

It could be worth reporting your issue upstream.

Re: [runit] Pipewire crashes after suspend

Reply #25
Ok, wow. Disabling bluetoothd via
Code: [Select]
$ sudo rm /run/runit/service/bluetoothd
solved the problem. Now pipewire and wireplumber work as intended before AND after suspend. Tested it a couple of times. Really didn't think that the whole problem was based on some misbehavior regarding the bluetooth daemon...

Thank you very much, @strajder! I learned quite a lot during this whole problem-finding process. I am going to report the issue later this week.

So now if I want to use bluetooth, I have to manually start the runit daemon via sv?


Re: [runit] Pipewire crashes after suspend

Reply #27
Thanks! Marking this thread as solved.

Re: [runit] Pipewire crashes after suspend

Reply #28
This also works, without disabling the bluez service:

Code: [Select]
# ~/.config/wireplumber/wireplumber.conf
...
   { name = policy.lua, type = config/lua }
#  { name = bluetooth.lua, type = config/lua }
]