Spotify does not play audio


#1
snap --version
snap    2.30.r282.ge1eddad26-1
snapd   2.30.r282.ge1eddad26-1
series  16
arch
kernel  4.9.70-1-lts

Spotify doesn’t play any audio and I get the following errors when I try to play a song.

Gtk-Message: Failed to load module "canberra-gtk-module"
ALSA lib conf.c:3750:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib conf.c:3750:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib conf.c:3750:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default

Also closing spotify doesn’t end the program. Last time I had to Ctrl+C the snap run command I got https://ptpb.pw/xQQF


Spotify snap not working on windows managers
Call for testing: VLC 3.0.0-rc1
Call for testing: VLC 3.0.0-rc1
PulseAudio 'Access Denied' - accessing pulseaudio for audio playback in Fedora 25 and Ubuntu 16.04
#2

We spoke on IRC. I can confirm that spotify plays in strict mode on Ubuntu 17.10 with pulseaudio (verified with pavucontrol). @j605 is running Arch with pulseaudio and it appears that the snap is having trouble using pulseaudio and falling back to alsa.

For now, I’m going to modify the topic to append ‘on Arch’.


#3

Note that @j605 is having trouble with audio in the VLC snap too: Call for testing: VLC 3.0.0-rc1 so this is probably not a spotify-specific issue.


#4

I can also confirm this.


#5

@mborzecki Does it work for you?

Maciej is on Arch.


#6

Works here on Manjaro (built on Arch).


#7

I installed the repo package and I still get the same error.


#8

Ah, ok, so not an issue in the snap.


#9

Oh sorry for my wording. I meant to say I installed snapd from Arch repos(version 2.27) and still experience the same error. Audio in my system has no issues.


#10

Works fine right here. I’m running this version:

maciek@corsair:~ snap version
snap    2.30.r282.ge1eddad26-1
snapd   2.30.r282.ge1eddad26-1
series  16
arch    
kernel  4.14.6-1-ARCH
maciek@corsair:~ 

Also tried the LTS kernel 4.9.70-1-lts, got the same results.

I’ve seen the problem with spotify not closing before when using spotify from AUR and with a repacked spotify RPM on Fedora. Albeit, this was with some older version and I don’t recall seeing it recently.

Please double check that these are connected:

maciek@corsair:~ snap interfaces spotify
Slot                   Plug
:browser-support       spotify
:gsettings             spotify
:home                  spotify
:network               spotify
:opengl                spotify
:pulseaudio            spotify
:unity7                spotify
:x11                   spotify
spotify:spotify-mpris  -
-                      spotify:mount-observe

Another thing you can try is run spotify from the console and enable debugging logs and paste the output: PULSE_LOG=4 SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 /snap/bin/spotify

FWIW, libpulse logs I get here are:

Parsing configuration file '/etc/pulse/client.conf'
/etc/pulse/client.conf.d does not exist, ignoring.
Using shared memory pool with 1024 slots of size 64,0 KiB each, total size is 64,0 MiB, maximum usable slot size is 65472
Trying to connect to {55f76458585f45adb352cdec85634ded}unix:/run/user/1000/pulse/native...
SHM possible: yes
Protocol version: remote 32, local 30
Negotiated SHM: yes
Parsing configuration file '/etc/pulse/client.conf'
/etc/pulse/client.conf.d does not exist, ignoring.
Using shared memory pool with 1024 slots of size 64,0 KiB each, total size is 64,0 MiB, maximum usable slot size is 65472
Trying to connect to {55f76458585f45adb352cdec85634ded}unix:/run/user/1000/pulse/native...
SHM possible: yes
Protocol version: remote 32, local 30
Negotiated SHM: yes

#11

The [community] package is outdated, but we cannot update it at this time. Please stick to snapd-git from AUR.


#12

not sure about arch, its just it doesnot even open on Xubuntu 17.10


#13

@attache If you run it in the terminal (e.g. via snap run spotify), what messages (if any) do you get? Could you please paste them here so that we can analyse this further?


#14

it works now, it just didn’t work yesterday.

now I cannot even remember my p/word.

so christmas is gonna be grimm.


#15

After some discussions in the IRC, snapd is looking at /run/user/1000/snap.spotify/pulse/native for the socket which is not available. Instead of looking at /run/user/1000/pulse/native, it tries /var/run/pulse/native and fails. @mvo suggested creating a symlink to check if it indeed fixes the issue. This workaround fixes the issue so the problem is snapd not looking in the correct directory for the socket. Thanks for the help @mvo and @mborzecki!


#16

To give more detail on the matter at hand:

  • $XDG_RUNTIME_DIR is set to /run/user/1000/snap.spotify inside the snap
  • libpulse tries pulse socket locations in the following order: $XDG_RUNTIME_DIR/pulse/native, /var/run/pulse/native
  • pulse socket is not available in either location

Surprisingly it works on my system, the logs show that instead of trying $XDG_RUNTIME_DIR/pulse/native libpulse goes to {55f76458585f45adb352cdec85634ded}unix:/run/user/1000/pulse/native, as if $XDG_RUNTIME_DIR was completely ignored.


Call for testing: VLC 3.0.0-rc1
#17

This should do the trick:

--- spotify.orig/bin/desktop-launch	2017-11-28 23:24:55.000000000 +0100
+++ spotify/bin/desktop-launch	2017-12-21 12:43:42.987532058 +0100
@@ -145,6 +145,18 @@ if [ -n "$XDG_RUNTIME_DIR" ]; then
     fi
 fi
 
+if [ -n "$XDG_RUNTIME_DIR" ]; then
+    pulsenative="pulse/native"
+    pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
+    pulseaudio_snappath="$XDG_RUNTIME_DIR/$pulsenative"
+    if [ -S "$pulseaudio_sockpath" ]; then
+        if [ ! -e "$pulseaudio_snappath" ]; then
+            mkdir -p -m 700 $(dirname "$pulseaudio_snappath")
+            ln -s "$pulseaudio_sockpath" "$pulseaudio_snappath"
+        fi
+    fi
+fi
+
 # GI repository
 export GI_TYPELIB_PATH=$RUNTIME/usr/lib/girepository-1.0:$RUNTIME/usr/lib/$ARCH/girepository-1.0
 [ "$WITH_RUNTIME" = yes ] && GI_TYPELIB_PATH=$SNAP/usr/lib/gjs/girepository-1.0:$SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$ARCH/girepository-1.0 # add local SNAP assets if a runtime is used

#18

@mborzecki Please can you submit that as a pull request to the desktop helpers. Then @kenvandine and @jamesh can review it :slight_smile:


#19

PR right here:


#20

Curious… why does it work for everybody else?