Skip to content

Spotify: PulseAudio: Unable to connect: Connection refused #2169

Closed

Description

@xexpanderx

Slackware current

Flatpak version 1.0.2

See title

Steps to reproduce

Before starting spotify I issue this in shell:
exportxprop -root -notype PULSE_SERVER | tr -d ' '``

and then

flatpak run com.spotify.Client/x86_64/stable

which gives me this:


ALSA lib ../../pulse/pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib ../../src/dlmisc.c:170:(snd_dlsym_verify) unable to verify version for symbol _snd_pcm_plug_open
ALSA lib ../../src/dlmisc.c:296:(snd1_dlobj_cache_get) symbol _snd_pcm_plug_open is not defined inside [builtin]

No idea how to fix this. I have Spotify opened, but no sound.

Activity

  1. TingPing commented on Oct 2, 2018

    @TingPing
    Member

    Does this happen with other Flatpaks?

  2. xexpanderx commented on Oct 2, 2018

    @xexpanderx
    Author

    This is the first time I try to use Flatpak, do you have any other package I may try that requires pulseaudio?

  3. alexlarsson commented on Oct 3, 2018

    @alexlarsson
    Member

    flatpak is supposed to read the PULSE_SERVER env var, see the code at:
    https://github.com/flatpak/flatpak/blob/master/common/flatpak-run.c#L344

    Maybe its some form it can't accept though, it can only do unix: ones atm? What is the value of the env var for you?

  4. xexpanderx commented on Oct 3, 2018

    @xexpanderx
    Author

    Hi,

    The value is:

    echo $PULSE_SERVER 
    "{ca2c3d36d123493d9a89cae35b7c676a}unix:/tmp/pulse-cKwRHHS8pmwY/native"
    
  5. chopfitzroy commented on Dec 19, 2018

    @chopfitzroy

    @xexpanderx did you find a solution? I am experiencing the same problem.

  6. xexpanderx commented on Dec 19, 2018

    @xexpanderx
    Author

    @xexpanderx did you find a solution? I am experiencing the same problem.

    No, I gave up, too much of a hassle.

  7. chopfitzroy commented on Dec 19, 2018

    @chopfitzroy

    Fair enough I will comment here if I find anything simple.

  8. refi64 commented on Dec 19, 2018

    @refi64
    Collaborator

    Based on #878, this seems to occur if $XDG_RUNTIME_DIR is empty when PulseAudio was started. Try adding:

    export XDG_RUNTIME_DIR=/run/user/$(id -u)
    
  9. chopfitzroy commented on Dec 19, 2018

    @chopfitzroy

    Hey @kirbyfan64,

    I added that to my .zshrc and now I get the following error:

    error: Unable to allocate instance id
    

    I also tried install xdg-utils in case this was required but it made no difference.

  10. chopfitzroy commented on Dec 21, 2018

    @chopfitzroy

    After reading a little more I tried adding:

    export XDG_RUNTIME_DIR=/run/user/$(id -u)
    

    To my /etc/profile this stopped the above error, but did not resolve the issues.

  11. refi64 commented on Dec 21, 2018

    @refi64
    Collaborator

    Now, what's the value of $PULSE_SERVER?

  12. chopfitzroy commented on Dec 21, 2018

    @chopfitzroy

    Hey Kirby so I actually got it by running:

    PULSE_SERVER=unix:/tmp/pulse-PKdhtXMmr18n/native flatpak run com.discordapp.Discord
    

    However I did notice when I run it without:

    export XDG_RUNTIME_DIR=/run/user/$(id -u)
    

    Added to the /etc/profile
    I get the following errors:

    sh: xdg-mime: command not found
    

    Any idea what that may be? And what it may effect?

  13. refi64 commented on Dec 22, 2018

    @refi64
    Collaborator

    (commenting on the new issue)

  14. KaMiila commented on Oct 26, 2019

    @KaMiila

    Just finished a -current install and grabbed spotify with flatpak. I was able to get audio working by creating an executable script and running spotify from that. here is the code:

    #!/bin/bash
    export xprop -root -notype PULSE_SERVER | tr -d ' '
    PULSE_SERVER=unix:/tmp/pulse-PKdhtXMmr18n/native
    /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=spotify --file-forwarding com.spotify.Client @@U %U @@

  15. IronOxidizer commented on May 21, 2020

    @IronOxidizer

    Thanks @CrashyBang and @KaMiila, your solutions worked wonderfully for my similar issue with Discord Flatpak. I'll detail my exact procedure for anyone else:

    Step 1: Add the following lines to ~/.xinitrc (before the line that starts WM)

    mkdir -p "$HOME/.cache/xdg_runtime_dir"
    export XDG_RUNTIME_DIR="$HOME/.cache/xdg_runtime_dir"
    

    Step 2: Create a script (mine is ~/.local/bin/Discord) with the following lines

    #!/bin/sh
    export xprop -root -notype PULSE_SERVER | tr -d ' '
    PULSE_SERVER=unix:/tmp/pulse-PKdhtXMmr18n/native
    flatpak run com.discordapp.Discord
    

    Step 3: Change the permission on the script to make it runnable
    chmod a+x ~/.local/bin/Discord

    Step 4: Restart/reload your WM and run the script. If Discord still has no sound the first time you run it after this procedure, kill all Discord processes (check htop) and try again. Sometimes xdg_runtime_dir is not populated before discord launches so it can't connect to PulseAudio but after restarting Discord, it should work.

  16. added 2 commits that reference this issue on Jan 7, 2021
    86bc3e0
    c45fecd
  17. smcv commented on Jan 7, 2021

    @smcv
    Collaborator

    #4059 should make most (all?) of the workarounds given here unnecessary.

  18. added a commit that references this issue on Jan 12, 2021
    2dc0006
  19. added a commit that references this issue on Jan 12, 2021
    fe95ef6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions