Cannot access file /usr/share/alsa/alsa.conf

Hello !

I’m trying to build my first snap, and of course, it builds ok but it’s not running :slight_smile:

I’m trying to enumerate the machine’s sound devices, using alsa (libasound2).

The enumeration goes well, but then I try to open the device to get its details, and that when the app fails :slight_smile:

ALSA lib conf.c:3750:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL hw:0
Can't open card 0: No such file or directory

The error occurs when calling snd_ctl_open() (at line 72 in src/ui/ui.c if you clone the repository).

I’m new to snaps, so I might have made something wrong. I’ve looked on this forum and stackoverflow and some random, probably outdated, blogposts, but I couldn’t make it work.

Here’s my snapcraft.yaml file :

name: picaster
version: "0.3-git"
summary: PiCaster
description: |
  PiCaster is a podcast recording and streaming application,
  easy to use for beginners, but with enough functionality
  to suit the needs of intermediate or experienced podcasters.

confinement: devmode

    command: desktop-launch picaster
    plugs: [alsa,pulseaudio,home,gsettings,x11,desktop,network,network-bind,removable-media]

grade: devel

    after: [desktop-gtk3]
    plugin: autotools
    source-type: git
      - build-essential
      - libgtk-3-dev
      - libasound2-dev
      - libasound2

Should you want to compile the repo “by hand” :

sudo apt install build-essential libgtk-3-dev libasound2-dev
git clone
cd picaster
autoreconf -fiv
./configure datadir=$(pwd)

Then run src/picaster

Thanks for your help !

alsa is a bit weird in that it hardcodes paths in its configuration files so you need to jump through a number of hoops to get it to work to snap things that use it when starting from scratch.

IIRC, @Wimpress and/or @lucyllewy made this easier for people. Perhaps they can comment?

I’ve build some “remote parts” which are attempting to fix things, but there’s still an issue with the paths they generate because of

Thanks, I’ve subscribed to the bug’s notifications and I shall report back when it’s fixed.

IF you do not use the $SNAPCRAFT_PROJECT_NAME variable anywhere in your snapcraft.yaml (which you do not seem to do), you should be safe from this bug and be able to just use the remote part.