Pulseaudio reconfiguration, audio disappears when unused for around a minute

Hi! First post here, and well, first few weeks of using fedora, and linux desktop in general. I tried to setup a program I found online called AudioRelay, which I probably should have looked into more, to use my phone as a microphone, since I don’t have a microphone, and well, the program needed me to add some lines to a config file for PulseAudio to create a new input device, which, well completely broke it after a restart. I cleared the configs for PA so it would create new ones, and reinstalled it, which got it working again, however, when my output is being unused for around a minute, not very long, it just goes quiet. Fedora still shows my speakers as what it’s outputting to, but nothing plays. For example, I can hear the popping sound effect when adjusting the volume, but when the speakers turn off, I can still adjust the volume, and the speakers RGB shows the volume being changed, but nothing will play. The PC acts as if there is no output devices, but shows that there is, ie, Twitch, YouTube not playing videos, Spotify saying “Can’t play the current song.” The only way to fix this is to turn my speakers off, and turn them back on, and I have to do this every time the audio goes unused for a bit. I’m not interested in using my phone as a mic anymore, as I take calls on a Windows KVM now, but I would really like to get my audio fixed, as it gets a little annoying :sweat_smile:

Fedora uses Pipewire for all the audio stuff and it replaced Pulse audio. I am not sure what could be causing you that problem but I think maybe its possible that PulseAudio is conflicting with pipewire since you said you installed PA when pipewire was already installed and that’s probably why the config changes broke it.

According to this, If you want to install PulseAudio to replace pipewire, you can try this

$ sudo dnf swap --allowerasing pipewire-pulseaudio pulseaudio

and to install Pipewire and remove PulseAudio

$ sudo dnf install --allowerasing pipewire-pulseaudio 

But be careful when using these commands as they remove essential packages.

that seems to have done the trick, but I have to start pipewire using pipewire-pulseaudio every boot, and when closing the terminal the command gets ran in, it stops. how can I get it to launch on startup like before?

You can enable it using systemd

$ systemctl --user enable pipewire-pulse.service 

Edit: I found the wiki where it tells you how to start it.

It’s not clear what did the trick, since there were 2 opposing commands.

Please give the output of:

dnf list --installed pipewire*

and

systemctl --user status pipewire*

In your first post, you didn’t say what config you added to what file. Although pipewire-pulse provides a PulseAudio server, it doesn’t use all of the old PulseAudio config files.

On Fedora, pipewire and pipewire-pulse are user services and socket-activated, so you should not enable the service (either system or user service).

oh I didn’t knew that my bad. thanks for letting me know.

I replaced PulseAudio with Pipewire using the bottom command,

dnf list --installed pipewire*
Installed Packages
pipewire.i686                             0.3.71-2.fc38  @updates               
pipewire.x86_64                           0.3.71-2.fc38  @updates               
pipewire-alsa.i686                        0.3.71-2.fc38  @updates               
pipewire-alsa.x86_64                      0.3.71-2.fc38  @updates               
pipewire-codec-aptx.x86_64                0.3.70-1.fc38  @rpmfusion-free-updates
pipewire-gstreamer.x86_64                 0.3.71-2.fc38  @updates               
pipewire-jack-audio-connection-kit.x86_64 0.3.71-2.fc38  @updates               
pipewire-libs.i686                        0.3.71-2.fc38  @updates               
pipewire-libs.x86_64                      0.3.71-2.fc38  @updates               
pipewire-pulseaudio.x86_64                0.3.71-2.fc38  @updates               
pipewire-utils.x86_64                     0.3.71-2.fc38  @updates      
systemctl --user status pipewire*
● pipewire.socket - PipeWire Multimedia System Socket
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; preset: enabled)
     Active: active (running) since Fri 2023-06-02 23:28:23 EDT; 41min ago
   Triggers: ● pipewire.service
     Listen: /run/user/1000/pipewire-0 (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire.socket

Jun 02 23:28:23 gamingpcv2.[...].com systemd[5065]: Listening on pipewire.socket - PipeWire Multimedia System Socket.

● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/user/pipewire.service.d
             └─00-uresourced.conf
             /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Fri 2023-06-02 23:28:24 EDT; 41min ago
TriggeredBy: ● pipewire.socket
   Main PID: 5331 (pipewire)
      Tasks: 2 (limit: 19029)
     Memory: 6.1M
        CPU: 281ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─5331 /usr/bin/pipewire

Jun 02 23:28:24 gamingpcv2.[...].com systemd[5065]: Started pipewire.service - PipeWire Multimedia Service.
~

Strange that neither pipewire-pulse.service nor pipewire-pulse.socket are showing.

Can you try:

systemctl --user preset pipewire-pulse.{socket,service}
systemctl --user daemon-reload
systemctl --user status pipewire-pulse*

The expected result is:

  • pipewire-pulse.socket is enabled and active
  • pipewire-pulse.service is disabled and active

I should have clarified why I gave both commands. I gave the first one because he needed that app to work which looks like it would work with pulseaudio but for some reason it wasn’t working with the default config. And the second one because he doesn’t want to use that anymore, so it will reinstall pipewire. Apologies for any confusion :sweat_smile:

1 Like

oddly enough, I didn’t get output on any of the commands but the first one

❯ systemctl --user preset pipewire-pulse.{socket,service}
Created symlink /home/aero/.config/systemd/user/sockets.target.wants/pipewire-pulse.socket → /usr/lib/systemd/user/pipewire-pulse.socket.

~ 
❯ systemctl --user daemon-reload

~ 
❯ systemctl --user status pipewire-pulse*

~ 
❯ 

Hm, try starting the socket:

systemctl --user start pipewire-pulse.socket

Then play sound with any program that uses PulseAudio (e.g. Firefox).

Sorry, I think I was supposed to run the above commands as root, when I didn’t, which might have been why there wasn’t output. Running that command didn’t have output but running it with sudo results in my audio working again. Do I need to run those commands again?

No, you do not need to run any of the commands I mentioned as root. It wouldn’t make sense, --user is for your user services, sudo would change the user to root (which does not have a running systemd user session), so it would error.

Please be specific. You ran these?

sudo systemctl --user preset pipewire-pulse.{socket,service}
sudo systemctl --user daemon-reload
sudo systemctl --user status pipewire-pulse*

All 3 commands should error.

The command I used to get the audio working again (for now) was

systemctl --user start pipewire-pulse.socket

which didn’t have output, so I ran it as root, which has audio working.

But if you ran it as root, it should error. Did it error? Was there any output?

The output for running as sudo was:

❯ sudo systemctl --user start pipewire-pulse.socket
[sudo] password for aero: 
Failed to connect to bus: No medium found

Ok, that’s the expected error, so it did nothing.

What happened is the first time you ran this (without sudo/root), it worked.

systemctl --user start pipewire-pulse.socket

It just needed time to activate the service, after you used a program that triggered the socket by playing audio. Or perhaps it needed to be triggered again, maybe you restarted the audio stream (like pausing and playing a video, or opening a new tab).

Anyway it should be ok now. I recommend rebooting to make sure everything works normally (you shouldn’t need to manually start the socket).

alright, thanks!