Headphones audio stuck on HSP/HFP

Hey there,

I am using a pair of bluetooth headphones and recently upgraded Fedora. The audio quality of the headphones is abysmal, so while checking what was going on in the sound menu, I noticed that the ALSA option has disappeared (what I used before), and I am stuck with HSP/HFP (which runs in mono and sounds horrible). I used the same headphones yesterday with Alsa too, with no problems at all.

I have been trying to figure out what is going on. Running pipewire gets me this:

$ pipewire
[E][03189.417226] mod.protocol-native | [module-protocol-:  606 lock_socket()] server 0x563c95d3b200: unable to lock lockfile '/run/user/1000/pipewire-0.lock': Resource temporarily unavailable (maybe another daemon is running)
[E][03189.417811] pw.conf      | [          conf.c:  412 load_module()] 0x563c95d209a0: could not load mandatory module "libpipewire-module-protocol-native": Resource temporarily unavailable
[E][03189.418168] default      | [      pipewire.c:  123 main()] failed to create context: Resource temporarily unavailable

I tried to run a systemctl --user restart pipewire.service too, with no luck.

Would you have idea on how to fix this? Thanks in advance for your help

Please check if the services and sockets are running correctly.
Have a look here how to do it.

1 Like
$ systemctl --user status pipewire.*
● pipewire.socket - Multimedia System
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; vendor preset: ena>
     Active: active (running) since Fri 2021-10-29 11:41:33 BST; 3min 12s ago
   Triggers: ● pipewire.service
     Listen: /run/user/1000/pipewire-0 (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire.socket

Oct 29 11:41:33 fedora systemd[3410]: Listening on Multimedia System.

● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; vendor preset: d>
    Drop-In: /usr/lib/systemd/user/pipewire.service.d
             └─00-uresourced.conf
     Active: active (running) since Fri 2021-10-29 11:41:38 BST; 3min 7s ago
TriggeredBy: ● pipewire.socket
   Main PID: 3642 (pipewire)
      Tasks: 4 (limit: 38009)
     Memory: 9.4M
        CPU: 264ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.servi>
             ├─3642 /usr/bin/pipewire
             └─3656 /usr/bin/pipewire-media-session

Oct 29 11:41:38 fedora systemd[3410]: Started PipeWire Multimedia Service.

$ systemctl --user status pipewire-pulse.*
● pipewire-pulse.service - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.service; disabled; vendor pre>
     Active: active (running) since Fri 2021-10-29 11:41:38 BST; 3min 56s ago
TriggeredBy: ● pipewire-pulse.socket
   Main PID: 3643 (pipewire-pulse)
      Tasks: 2 (limit: 38009)
     Memory: 3.5M
        CPU: 186ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire-pulse>
             └─3643 /usr/bin/pipewire-pulse

Oct 29 11:41:38 fedora systemd[3410]: Started PipeWire PulseAudio.

● pipewire-pulse.socket - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.socket; enabled; vendor prese>
     Active: active (running) since Fri 2021-10-29 11:41:33 BST; 4min 1s ago
   Triggers: ● pipewire-pulse.service
     Listen: /run/user/1000/pulse/native (Stream)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/pipewire-pulse.soc>

Oct 29 11:41:33 fedora systemd[3410]: Listening on PipeWire PulseAudio.

$ systemctl --user status wireplumber
Unit wireplumber.service could not be found.

I think I just don’t have wireplumber for some reason

install wireplumber then and try again after it has been activated.

1 Like

Sorry, this refers to F35.
In your case:

systemctl --user status pipewire-media-session

You can test if change to wire-plumber gives better result:
Changes/WirePlumber - Fedora Project Wiki
see > how to switch

1 Like

Hmm. So what I get is

$ systemctl --user status pipewire-media-session
Unit pipewire-media-session.service could not be found.

dnf swap does nothing as a consequence, but I can’t find it on the repos either

$ sudo dnf swap wireplumber pipewire-media-session
Last metadata expiration check: 0:02:54 ago on Sun 31 Oct 2021 22:12:55 GMT.
No match for argument: wireplumber
No packages marked for removal.
No match for argument: pipewire-media-session
Error: Unable to find a match: pipewire-media-session

$ sudo dnf install wireplumber
Last metadata expiration check: 0:04:10 ago on Sun 31 Oct 2021 22:12:55 GMT.
No match for argument: wireplumber
Error: Unable to find a match: wireplumber

Edit:

$ sudo dnf install pipewire-media-session
Last metadata expiration check: 0:03:02 ago on Mon 01 Nov 2021 10:31:50 GMT.
No match for argument: pipewire-media-session
Error: Unable to find a match: pipewire-media-session

Hmm, I think I know what’s happening.
Running /usr/bin/pipewire-media-session causes the following error:

$ /usr/bin/pipewire-media-session
[E][04514.455456] spa.bluez5.native | [backend-native.c: 1399 sco_listen()] listen(): Address already in use
[E][04514.459844] spa.bluez5.native | [backend-native.c: 1886 register_profile_reply()] RegisterProfile() failed: org.bluez.Error.NotPermitted
[E][04514.460070] spa.bluez5.native | [backend-native.c: 1886 register_profile_reply()] RegisterProfile() failed: org.bluez.Error.NotPermitted

So I would assume there is some kind of conflict going on with bluez. That said, that doesn’t really explain why there isn’t a service I can activate at all.

I saw here that it could have been caused by some configs carrying over from Arch (I did move some dotfiles from my past Manjaro install), but I can’t really find anything beyond a pipewire folder in ~/.config

Hi!

So I am bringing this up again as I recently updated to F35 with wireplumber and the problem oddly persists.

This time I am met with

$ journalctl -xe | grep wireplumber
Dec 19 14:55:59 fedora wireplumber[2893]: trying to set invalid profile 1, codec 0, 00000011 00000010
Dec 19 14:56:06 fedora wireplumber[2066]: stopped by signal: Terminated
Dec 19 14:56:06 fedora wireplumber[2066]: disconnected from pipewire

I went to check for possible upgrades and after upgrading ALSA, I now have

 journalctl -xe | grep wireplumber
Dec 19 15:08:27 fedora wireplumber[2077]: stopped by signal: Terminated
Dec 19 15:08:27 fedora wireplumber[2077]: disconnected from pipewire
Dec 19 15:09:56 fedora wireplumber[2898]: Failed to register battery provider. Error: org.freedesktop.DBus.Error.UnknownMethod
Dec 19 15:09:56 fedora wireplumber[2898]: BlueZ Battery Provider is not available, won't retry to register it. Make sure you are running BlueZ 5.56+ with experimental features to use Battery Provider.

I then added the flag --experimental in ExecStart on /lib/systemd/system/bluetooth.service, then rebooted, with still no success and just getting this in journalctl:

$ journalctl -xe | grep wireplumber
Dec 19 15:18:13 fedora wireplumber[2048]: stopped by signal: Terminated
Dec 19 15:18:13 fedora wireplumber[2048]: disconnected from pipewire

The sound keeps working via the internal device, just not with ALSA

Please check with systemctl --user status session.slice | grep -i 'pipewire\|pulse\|wireplumber'.

Btw, from your post:

There a solution for

From the other forum here.

But I suggest, you could test it by creating new user, and see if everything work normal. If by creating new user everything is normal, then you could find or delete any dot file leftover from previous distro Setting.

What I get is

$ systemctl --user status session.slice | grep -i 'pipewire\|pulse\|wireplumber'
             ├─pipewire-pulse.service
             │ └─3482 /usr/bin/pipewire-pulse
             ├─pipewire.service
             │ └─3480 /usr/bin/pipewire
             └─wireplumber.service
               └─3481 /usr/bin/wireplumber

Regarding the bluez issue: sorry, I should’ve specified that adding the --experimental flag did solve that specific problem (that I guess was unrelated to the one I am having right now)

Maybe you could try to check file configuration in /usr/share/wireplumber/main.lua.d/50-alsa-config.lua, then find the following line:

-- Apply properties on the matched object.
    apply_properties = {
    -- Use ALSA-Card-Profile devices. They use UCM or the profile
    -- configuration to configure the device and mixer settings.
    ["api.alsa.use-acp"] = true,

Check if your setting are true.

1 Like

It’s set as true, the other options are commented out though

There are reported issue with wireplumber 0.4.2 and it should be already fixed since F35 already on wireplumber 0.4.5.

But if you read on comment from George Kiagiadakis, there are two solution and the one that pushed to upstream (update) are Environment=GIO_USE_VFS=local.

If you already with newest wireplumber version and the problem persist, maybe you could use the second solution Environment=GVFS_DISABLE_FUSE=1 and place it in sudo nano /usr/lib/systemd/user/wireplumber.service and change part Environment. Save and run sudo systemctl restart --user wireplumber.

Yesterday I tested it again and suddenly ALSA worked upon reboot, but now it isn’t anymore for some reason. Very weird.

I tried to apply the 2nd solution in the meantime, but I get this when restarting systemctl:

$ sudo systemctl restart --user wireplumber
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)

Try without sudo, youll get pop up for inserting passwd.

systemctl --user ...rest of command ... refers to the logged-in users session. No need for password.

As the error-messages says, if it is a need to manage a remote system, for a user who fears the terminal you can do it the following way:

sudo systemctl --machine=<user>@.host --user ...rest of command ...

1 Like
$ systemctl restart --user wireplumber
Warning: The unit file, source configuration file or drop-ins of wireplumber.service changed on disk. Run 'systemctl --user daemon-reload' to reload units.

Then I tried with

$ systemctl restart wireplumber
Failed to restart wireplumber.service: Unit wireplumber.service not found.

systecmtl --user daemon-reload

followed by
systemctl --user restart wireplumber

The daemon reload is normally required when unit/configuration file for a service is modified.

Just get the problem when I left my laptop and it go to sleep mode when it still playing streaming music. Then when I login, the problem arise.

[rizal@fedora ~]$ systemctl status --user wireplumber
● wireplumber.service - Multimedia Service Session Manager
     Loaded: loaded (/usr/lib/systemd/user/wireplumber.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-12-22 20:53:56 WIB; 2h 17min ago
   Main PID: 1833 (wireplumber)
      Tasks: 4 (limit: 3893)
     Memory: 22.7M
        CPU: 4min 48.040s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/wireplumber.service
             └─1833 /usr/bin/wireplumber

Dec 22 23:10:50 fedora wireplumber[1833]: error reading timerfd: Resource temporarily unavailable
Dec 22 23:10:53 fedora wireplumber[1833]: sbc_decode failed: -3
Dec 22 23:10:54 fedora wireplumber[1833]: error reading timerfd: Resource temporarily unavailable
Dec 22 23:11:02 fedora wireplumber[1833]: sbc_decode failed: -3
Dec 22 23:11:08 fedora wireplumber[1833]: sbc_decode failed: -3
Dec 22 23:11:09 fedora wireplumber[1833]: error reading timerfd: Resource temporarily unavailable
Dec 22 23:11:16 fedora wireplumber[1833]: sbc_decode failed: -3
Dec 22 23:11:24 fedora wireplumber[1833]: sbc_decode failed: -3
Dec 22 23:11:29 fedora wireplumber[1833]: sbc_decode failed: -3
Dec 22 23:11:35 fedora wireplumber[1833]: error reading timerfd: Resource temporarily unavailable
[rizal@fedora ~]$ systemctl status --user pipewire
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; disabled; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/user/pipewire.service.d
             └─00-uresourced.conf
     Active: active (running) since Wed 2021-12-22 20:53:56 WIB; 2h 18min ago
TriggeredBy: ● pipewire.socket
   Main PID: 1832 (pipewire)
      Tasks: 2 (limit: 3893)
     Memory: 23.7M
        CPU: 3min 19.532s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─1832 /usr/bin/pipewire

Dec 22 21:36:35 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.headset-head-unit-81) client missed 1 wakeups
Dec 22 21:42:26 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.headset-head-unit-81) client missed 1 wakeups
Dec 22 21:55:26 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.headset-head-unit-81) client missed 2 wakeups
Dec 22 22:14:59 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.headset-head-unit-81) client missed 1 wakeups
Dec 22 22:45:31 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.a2dp-sink-81) client missed 1 wakeups
Dec 22 23:03:17 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.a2dp-sink-81) client missed 1 wakeups
Dec 22 23:09:31 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.a2dp-sink-74) client missed 1 wakeups
Dec 22 23:09:51 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.a2dp-sink-74) client missed 1 wakeups
Dec 22 23:10:36 fedora pipewire[1832]: mod.client-node: (bluez_output.FC_E8_06_81_4D_74.headset-head-unit-88) client missed 19 wakeups
Dec 22 23:10:36 fedora pipewire[1832]: mod.client-node: (bluez_input.FC_E8_06_81_4D_74.headset-head-unit-89) client missed 3 wakeups

The way I restore all codecs available for my device:

First close all media player including gnome setting.

$ systemctl restart alsa-restore
$ systemctl restart alsa-state
$ systemctl restart --user pipewire
$ systemctl restart --user wireplumber

First it will reload all compatible codecs for the device. Then restart every service from ground up relating to sound.