I maintain this snap: https://github.com/mmartinortiz/retro-virtual-machine-snap , but I do not develop or maintain the original software.
Today the application was updated to a new version. I modified the snap to make use of the new
deb package. The new version runs without problems, but there is no sound. I’ve checked that the
deb version has sound (not only in my laptop, but in other user’s laptops).
All plugs (including sound) are enabled.
I’m not that expert packaging applications in Snaps, and any tip or guidance to debug this issue is appreciated.
I’ve gone a bit further in my investigation. Launching the snap from the command line, I saw that it is related to ALSA
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
I found that I need to enable the
ALSA plug and install
libasound2. I did both, but then:
404 Not Found [IP: 220.127.116.11 80]
Fetched 0 B in 0s (0 B/s)
Package fetch error: The item '/root/.cache/snapcraft/download/libasound2-data_1.1.3-5ubuntu0.5_all.deb' could not be fetched: 404 Not Found [IP: 18.104.22.168 80]
Let’s continue the investigation…
snapcraft clean I get a new error when I try to build.
↪ snapcraft build --debug
Launching a VM.
Build environment is in unknown state, cleaning first.
info failed: The following errors occurred:
instance "snapcraft-mmartinortiz-retro-virtual-machine" does not exist
launch failed: Remote "snapcraft" is unknown or unreachable.
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
This is not looking good
You can use
snapcraft --use-lxd to build on lxd containers instead of multipass VMs, it’s usually faster. About the sound issue, shouldn’t the application be using pulseaudio instead of alsa directly? Does adding
libpulse-dev to build-packages and libpulse0 to stage-packages help?
Update: now I see that you’re using a binary deb instead of building the application from sources, so adding libpulse-dev doesn’t make any difference.
Thanks for your feedback.
--use-lxd I got a link libraries error when using
snapcraft try and later
snap try. Upgrading to
core22 did not help either. I’m getting different errors for them. I’m getting a bit discourage here with the use of snap
@tigarmo recently worked on “try” so maybe he knows what could be happening here.
Regarding sound issues: since you’re staging a binary build, is it possible that the previous version had pulseaudio output enabled by default but this new version uses alsa directly, causing the sound issues? If this is the case maybe @lucyllewy has some trick to make it work (I used layouts to remap
/usr/share/alsa and connected the alsa interface, but that was not enough to get sound from the ZX Spectrum emulator).
I created https://snapcraft-alsa.readthedocs.io/en/latest/ to get alsa running by piping it through pulse audio. Might be worth checking out the instructions there.
I finally got it working. I think that what made the trick was mapping or exposing the alsa.conf file, I followed the tip of this comment.
But I also updated the base to
core22, removed some interfaces already provided by the
gnome plugin and also all the libraries in the stage-packages, leaving only those for audio.
One last thing to mention: I could not debug the mapping of the
alsa.conf file with
--devmode, because I could not find where it become installed or get a shell into the snap to see if the mapping occurred. I had to release it, and install from the store, to be able to test it. I do not know if there is a better way to do this.
same problem facing on my intel arc pc, it says ; [snapcraft.yaml] is missing, how can fix this issue?
I just wanted to say thank you for this. It solved a problem I had with missing asound.conf and the ALSA dependency, and I wouldn’t have been able to fix it without your snapcraft.yaml and excellent write-up.
Edit: Here’s my snapcraft.yaml, in case it helps anyone: https://github.com/degville/psst-snap/blob/main/snap/snapcraft.yaml