Pulseaudio on core18 and desktop-qt5


#1

I am trying to snap my music making application, audovia-classic, using core18 and desktop-qt5 and the pulseaudio plug, but when I try to play music, the application reports: “… Find resources for using MIDI on your specific system …”.
The desktop-launch file has the statement: “append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/pulseaudio”, but after installing the snap, the directory: /snap/audovia-classic/current/usr/lib/x86_64-linux-gnu/ does not contain the pulseaudio directory.
I would be grateful for any help to resolve this issue.

The snapcraft.yaml file is as follows:

name: audovia-classic
version: ‘4.0’
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap’s description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.

grade: stable
architectures: [ amd64 ]
confinement: strict
base: core18

apps:
audovia-classic:
command: desktop-launch $SNAP/opt/Audovia/Audovia.sh
plugs: [ home, network, pulseaudio, x11, desktop, opengl ]

parts:
my-part:
plugin: nil
override-build: |
cp -r opt $SNAPCRAFT_PART_INSTALL/
cp -r usr $SNAPCRAFT_PART_INSTALL/
after: [ desktop-qt5 ]


#2

Stage the libpulse0 package should do the trick.


#3

Thank you for your reply.
I have now staged libpulse0 and the pulseaudio directory has now been created.
However, my application is still failing with the same error message.
I would like to thank you for your help as I think it has made me get a bit closer to the solution.


#4

I have attempted to debug my snap using snappy-debug and it appears that read access is being denied to a number of files under the /proc directory that actually have read permission set.
I would be grateful if anyone could advise if there is anything I can do to enable my snap to have read access to this directory.
My application runs properly outwith a snap but within the snap, it starts normally but gives an error when it tries to produce music.
Here is the output from snappy-debug:

donald@donald-VirtualBox:~$ sudo snappy-debug.security scanlog
INFO: following ‘/var/log/syslog’. If have dropped messages, use:
INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug
kernel.printk_ratelimit = 0
= AppArmor =
Time: May 11 19:51:00
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/proc/3323/mountinfo" pid=3323 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=1000
File: /proc/3323/mountinfo (read)
Suggestions:

  • adjust program to not access ‘@{PROC}/@{pid}/mountinfo’
  • add ‘mount-observe’ to ‘plugs’

= AppArmor =
Time: May 11 19:51:02
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/proc/3323/net/if_inet6" pid=3323 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
File: /proc/3323/net/if_inet6 (read)
Suggestions:

  • adjust program to not access ‘@{PROC}/@{pid}/net/if_inet6’
  • adjust program to not access ‘@{PROC}/@{pid}/net/if_inet[0-9]*’
  • add one of ‘firewall-control, network-control, network-observe’ to ‘plugs’
  • add ‘network-bind’ to ‘plugs’

= AppArmor =
Time: May 11 19:51:02
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/proc/3323/net/ipv6_route" pid=3323 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
File: /proc/3323/net/ipv6_route (read)
Suggestions:

  • adjust program to not access ‘@{PROC}/@{pid}/net/ipv6_route’
  • adjust program to not access ‘@{PROC}/@{pid}/net/ipv[0-9]*_route’
  • add one of ‘firewall-control, network-control, network-observe’ to ‘plugs’
  • add ‘network-bind’ to ‘plugs’

= AppArmor =
Time: May 11 19:51:02
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/proc/3323/net/if_inet6" pid=3323 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
File: /proc/3323/net/if_inet6 (read)
Suggestions:

  • adjust program to not access ‘@{PROC}/@{pid}/net/if_inet6’
  • adjust program to not access ‘@{PROC}/@{pid}/net/if_inet[0-9]*’
  • add one of ‘firewall-control, network-control, network-observe’ to ‘plugs’
  • add ‘network-bind’ to ‘plugs’

#5

have you added these plugs yet ?


#6

Thank you for your response. I have now added mount-observe and network-bind to plugs and manually connected mount-observe.
The application is still failing to generate music.
Here are the first few lines of the debug log:

donald@donald-VirtualBox:~$ sudo snappy-debug.security scanlog
[sudo] password for donald:
INFO: following ‘/var/log/syslog’. If have dropped messages, use:
INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug
kernel.printk_ratelimit = 0
= AppArmor =
Time: May 12 13:09:29
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us" pid=6281 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
File: /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us (read)
Suggestion:

  • adjust program to not access ‘/sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us’

= AppArmor =
Time: May 12 13:09:29
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us" pid=6281 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
File: /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us (read)
Suggestion:

  • adjust program to not access ‘/sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us’

= AppArmor =
Time: May 12 13:09:29
Log: apparmor=“DENIED” operation=“open” profile=“snap.audovia-classic.audovia-classic” name="/sys/fs/cgroup/cpu,cpuacct/cpu.shares" pid=6281 comm=“java” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
File: /sys/fs/cgroup/cpu,cpuacct/cpu.shares (read)
Suggestion:

  • adjust program to not access ‘/sys/fs/cgroup/cpu,cpuacct/cpu.shares’

#7

@songbuilder,

Maybe you can refer how audacity snap deals with audio part ( https://github.com/diddlesnaps/audacity/blob/master/snap/snapcraft.yaml) although you faced the cgroup messages. I had partial errors that are similar to yours when I packed my snap that also needs audio and video functions but apparmor denied by /proc/$pid/cgroup actually didn’t affect audio which meant it works well.


#8

@woodrow,

I am very grateful to you for pointing me in the right direction. I eventually found https://github.com/diddledan/snapcraft-alsa and followed the advice therein and my snap now makes music.
My snapcraft.yaml file is here for your reference:

name: audovia-classic
version: ‘4.0’
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap’s description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.

grade: stable
architectures: [ amd64 ]
confinement: strict
base: core18

apps:
audovia-classic:
command: desktop-launch alsa-launch $SNAP/opt/Audovia/Audovia.sh
plugs: [ home, network, pulseaudio, x11, desktop, opengl ]

parts:
#specify remote part build order
alsa:
after: [alsa-lib, alsa-plugins]
alsa-lib:
# configflags needed until LP#1766878 is fixed
configflags:
- --prefix=/usr
- --sysconfdir=/etc
- --libexec=/usr/lib
- --libdir=/usr/lib
- --localstatedir=/var
- --with-configdir=/snap/audovia-classic/current/usr/share/alsa
- --with-plugindir=/snap/audovia-classic/current/usr/lib/alsa-lib
- --disable-alisp
- --disable-aload
- --disable-python
- --disable-rawmidi
- --disable-static
- --disable-topology
- --disable-ucm
- --enable-symbolic-functions
alsa-plugins:
after: [alsa-lib]
# configflags needed until LP#1766878 is fixed
configflags:
- --prefix=/usr
- --sysconfdir=/etc
- --libexec=/usr/lib
- --libdir=/usr/lib
- --localstatedir=/var
- --disable-arcamav
- --disable-avcodec
- --disable-jack
- --disable-mix
- --disable-oss
- --disable-usbstream
- --with-plugindir=/snap/audovia-classic/current/usr/lib/alsa-lib
- --disable-static
- LDFLAGS=-L$SNAPCRAFT_STAGE/usr/lib

audovia-classic:
after: [ alsa, desktop-qt5 ]
plugin: nil
override-build: |
cp -r opt $SNAPCRAFT_PART_INSTALL/
cp -r usr $SNAPCRAFT_PART_INSTALL/


#9

@songbuilder, Great to hear that, and in the meantime I’ll be happy to understand if someone can solve the cgroup problems as sometime I felt it’s quite annoying as oobe.


#10

architectures: [ amd64 ]

I am curious. Is this really limited to amd64, I wonder?


#11

architectures: [ amd64 ] was specified because the application uses a 64-bit version of Java. I am not able to advise if this was really necessary.