[SOLVED] No sound in the Remmina snap

The remmina snap, defined here seems to have the right interfaces, LD_LIBRARY_PATH and the wrapper to connect to pulseaudio, but it doesn’t work on Ubuntu, from the logs I see messages related to freerdp, that pulse is not working correctly (error 4317).

On fedora 32 works perfectly, so I was wondering if I was doing it right, or if it’s just an Ubuntu issue.

I was also doing some tests in another dirty branch as I’d like to fix both pulseaudio and wayland integration.

May I have some help? Thanks!

I’d try removing the pawrapper script and the LD_LIBRARY_PATH environment variable, both of these should be sorted out with magic in the Gnome extension itself and it’s probably unwise to double up on it. (Assuming Remmina has native Pulseaudio support it should be all that’s needed, if it doesn’t, keep reading).

In the WIP snap, I notice the alsa-pulseaudio part in your script, this trails back to Daniels alsa-mixin repo but I think how you’ve currently got it isn’t actually doing anything. If Remmina has Pulse support directly this is basically not required, but if it doesn’t, you’re missing the libasound2-plugins stage package, and should also add

layout:
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib

and

environment:
  ALSA_CONFIG_PATH: $SNAP/etc/asound.conf

Alternatively use the alsa-mixin in full as intended here https://snapcraft-alsa.readthedocs.io/en/latest/snapcraft_usage.html

1 Like

Thanks a lot James!

I’m going to test it right away.

Yes, Remmina and FreeRDP have builtin support for pulseaudio

Nope, still the same issue, I also have removed all the part related to ALSA, but I get this errors:

ALSA lib conf.c:3916:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL default
[16:07:50:470] [44125:44213] [ERROR][com.freerdp.channels.rdpsnd.client] - snd_mixer_attach failed
ALSA lib conf.c:3916:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[16:07:51:030] [44125:44213] [ERROR][com.freerdp.channels.rdpsnd.client] - snd_pcm_open failed

That’s because freerdp try to fallback to Alsa when Pulse is not working.

The strange pulseaudio messages I’ve got are the following:

[16:06:54:750] [44125:44214] [ERROR][com.freerdp.channels.rdpsnd.client] - [dynamic] pulse entry returns error 4317
[16:06:54:750] [44125:44214] [INFO][com.freerdp.channels.rdpsnd.client] - [dynamic] Loaded pulse backend for rdpsnd
[16:06:54:750] [44125:44214] [ERROR][com.freerdp.channels.rdpsnd.client] - [dynamic] Unable to load sound playback subsystem pulse because of error 4317
[16:06:54:750] [44125:44214] [INFO][com.freerdp.channels.rdpsnd.client] - [dynamic] Loaded alsa backend for rdpsnd

The strange thing is that now also on Fedora it doesn’t work

I spun up a fresh Ubuntu 20.04 VM and tried the following,

snap run --shell remmina
paplay $example.mp3
source $SNAP/bin/pawrapper
paplay $example.mp3

Both paplay failed.

I cloned the Remmina master branch, removed LD_LIBRARY_PATH, removed the wrapper from the command (but kept the part), but importantly, removed the instances of stage: and prime:. Rerunning the paplay above, the audio worked fine (and presumably Remmina proper would too, but I’m a bit strapped for time to setup a proper RDP server to test fully with right now).

Unfortunately, the snap inflates from 40MB to 170MB in size.

The most obvious explaination to me right now would be the use of stage and prime to trim the size of the snap down is probably being too aggressive and is stripping away some files needed to keep Pulse functional, and I wouldn’t expect alsa-mixin to fix this (it proxies through pulse anyway, more indirection won’t help).

git diff below for reference

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index d247acfd..0a77ad06 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -7,7 +7,6 @@ base: core18
 
 environment:
   DISABLE_WAYLAND: "1"
-  LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
 
 layout:
   /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0:
@@ -21,9 +20,7 @@ slots:
 
 apps:
   remmina:
-    # desktop-launch (used under the covers in gnome-3-28 extension) seems to
-    # be broken when setting up wayland env so we disable it
-    command: bin/pawrap $SNAP/usr/bin/remmina
+    command: bin/remmina
     extensions: [gnome-3-28]
     common-id: org.remmina.Remmina.desktop
     plugs:
@@ -66,8 +63,6 @@ parts:
   pulse-utils:
     plugin: nil
     stage-packages:
-      - pulseaudio
-      - pulseaudio-utils
       - libsndfile1
       - libxcb1
       - libasyncns0
@@ -78,19 +73,6 @@ parts:
       - libogg0
       - libvorbis0a
       - libpulse0
-    prime:
-      - usr/lib/*/pulseaudio/libpulsecommon-8.0.so*
-      - usr/lib/*/libpulse.so*
-      - usr/lib/*/libpulse-simple.so*
-      - usr/lib/*/libsndfile.so*
-      - usr/lib/*/libxcb.so*
-      - usr/lib/*/libasyncns.so*
-      - usr/lib/*/libFLAC.so*
-      - usr/lib/*/libvorbisenc.so*
-      - usr/lib/*/libXau.so*
-      - usr/lib/*/libXdmcp.so*
-      - usr/lib/*/libogg.so*
-      - usr/lib/*/libvorbis.so.*
   freerdp:
     after:
       - pulse-utils
@@ -319,70 +301,3 @@ parts:
       - gstreamer1.0-libav
       - dbus-x11
       - xdg-user-dirs
-
-    override-build: |
-      set -ex
-      snapcraftctl build
-    stage:
-      - usr/bin/gtk3-demo
-      - usr/lib/*/libFLAC.so*
-      - usr/lib/*/libXau.so*
-      - usr/lib/*/libXdmcp.so*
-      - usr/lib/*/libappindicator3.so.*
-      - usr/lib/*/libasyncns.so*
-      - usr/lib/*/libavahi*.so.*
-      - usr/lib/*/libavcodec.so.*
-      - usr/lib/*/libavutil.so.*
-      - usr/lib/*/libcacard.so.*
-      - usr/lib/*/libcrystalhd.so.*
-      - usr/lib/*/libdbusmenu-glib.so.*
-      - usr/lib/*/libdbusmenu-gtk3.so.*
-      - usr/lib/*/libgdbm.so.*
-      - usr/lib/*/libgomp.so.*
-      - usr/lib/*/libgsm.so.*
-      - usr/lib/*/libindicator3.so.*
-      - usr/lib/*/libmp3lame.so.*
-      - usr/lib/*/libnspr4.so
-      - usr/lib/*/libnss3.so
-      - usr/lib/*/libnssutil3.so
-      - usr/lib/*/libnuma.so.*
-      - usr/lib/*/libogg.so*
-      - usr/lib/*/libopenjp2.so.*
-      - usr/lib/*/libopus.so.*
-      - usr/lib/*/libphodav-2.0.so.*
-      - usr/lib/*/libplc4.so
-      - usr/lib/*/libplds4.so
-      - usr/lib/*/libpulse-mainloop-glib.so.*
-      - usr/lib/*/libpulse-simple.so*
-      - usr/lib/*/libpulse.so*
-      - usr/lib/*/libshine.so.*
-      - usr/lib/*/libsnappy.so.*
-      - usr/lib/*/libsndfile.so*
-      - usr/lib/*/libsodium.so.*
-      - usr/lib/*/libsoxr.so.*
-      - usr/lib/*/libspeex.so.*
-      - usr/lib/*/libspice-client-glib-2.0.so.*
-      - usr/lib/*/libspice-client-gtk-3.0.so.*
-      - usr/lib/*/libswresample.so.*
-      - usr/lib/*/libthai.so.*
-      - usr/lib/*/libtheoradec.so.*
-      - usr/lib/*/libtheoraenc.so.*
-      - usr/lib/*/libtwolame.so.*
-      - usr/lib/*/libusbredirhost.so.*
-      - usr/lib/*/libusbredirparser.so.*
-      - usr/lib/*/libva-drm.so.*
-      - usr/lib/*/libva-x11.so.*
-      - usr/lib/*/libva.so.*
-      - usr/lib/*/libvdpau.so.*
-      - usr/lib/*/libvncclient.so.*
-      - usr/lib/*/libvorbis.so.*
-      - usr/lib/*/libvorbisenc.so*
-      - usr/lib/*/libvpx.so.*
-      - usr/lib/*/libwavpack.so.*
-      - usr/lib/*/libwebpmux.so.*
-      - usr/lib/*/libx264.so.*
-      - usr/lib/*/libx265.so.*
-      - usr/lib/*/libxcb.so*
-      - usr/lib/*/libxkbfile.so.*
-      - usr/lib/*/libxvidcore.so.*
-      - usr/lib/*/pulseaudio/libpulsecommon-8.0.so*
2 Likes

Lovely!
This is the first time I understand the staging and priming part.

I’ve tested the big snap and it works now, I’ll do some other tests and I’ll try to remove what is obvious, like the gtk3-demo.

I’ll update the thread when I’ll something acceptable

Thanks so much!

if you want to cut down in size you should really consider using an extension … both gnome extensions ship all required libs and a working pulseaudio setup OOTB …

Thanks Oliver!

We already use

extensions: [gnome-3-28]

That means I can cut most of the libs in the stage-packages?

https://gitlab.com/Remmina/Remmina/-/blob/snap-audio-and-wayland/snap/snapcraft.yaml#L222

I should remove the staged packages that are already listed here: https://snapcraft.io/docs/gnome-3-34-extension#heading--packages

see the cleanup part at:

Great! I was using a more selective cleanup.

Now I went down to 71 MB, that is more than acceptable for a fat application like Remmina.

Thanks a lot to both of you, this helped me quite a lot and now I’m much less frustrated about snap :-p

CC: @James-Carroll

1 Like

now, if you want to trade size for startup speed, you could try adding:

compression: lzo

to the toplevel of your snapcraft.yaml … that will make it grow again but massively speed up the first start of your app …

Thanks! Sorry, I saw this just now

1 Like

Great discussion. I have the same problem with the sound in Remmina snap. I’m trying to solve it now, thanks. :handshake: