Would someone create an electron snap for this forum?

You’re not the first one. I can’t replicate on my machine. Any ideas @Wimpress on what is going on here? Anything to do with the snap side of things?

@niemeyer this seems to be the bug you are encountering…?
https://stackoverflow.com/questions/17202741/why-does-mmap-fail-with-permission-denied-for-the-destination-file-of-a-file-c

I don’t know… can’t dig in right now but will try to check later.

@elopio when you get a chance, can you check to see if you get that same error. I know it wasn’t loading properly for you.

I get many of these apparmor denials:

= AppArmor =
Time: Mar 31 11:43:32
Log: apparmor=“ALLOWED” operation=“file_mmap” profile=“snap.snapcraft-forum.snapcraft-forum” name="/dev/shm/.org.chromium.Chromium.VptaMT" pid=5384 comm=“Chrome_IOThread” requested_mask=“m” denied_mask=“m” fsuid=1000 ouid=1000
File: /dev/shm/.org.chromium.Chromium.VptaMT (write)
Suggestion:

  • adjust program to create files and directories in /dev/shm/snap.$SNAP_NAME.*

Using the snap in --devmode works for me. I’m in zesty:

$ snap version
snap    2.23.1+17.04
snapd   2.23.1+17.04
series  16
ubuntu  17.04
kernel  4.10.0-14-generic

that might be the issue here, i’m on xenial

Have not tested in Zesty, it uses strict confinement - so I’m not sure what the problem is there. I can’t imagine it is any setting in the app. @Wimpress - any ideas if this needs to be addressed in Zesty or via electron-builder, or even in my package.json?

some helpful additions (i hope)
https://github.com/ryanleesipes/snapcraft-forum/pull/2

1 Like

i played with a zesty VM on the weekend and saw the same mmap() error, looking at dmesg output i actually see apparmor denials for /dev/shm/ …

installing the snap with --devmode works around it …

could that be a kernel thing ? i.e. using a -hwe kernel on xenial or a new kernel on zesty ?

@ogra - those are allowed by the browser-support and pulseaudio interfaces. Are they specified? Are they connected?

yes and yes, as i said, the very same snap works flawless on my 16.04 installs whihc both use the original 4.4 kernel … trying out a 16.10 ubuntu-gnome and a 17.04 ubuntu-gnome on the weekend i coundt get it to run on both without --devmode, which makes me think it is a kernel issue.

I can confirm this on zesty (4.10.0-15.17-generic):

$ sudo snap install snapcraft-forum --edge
$ snapcraft-forum
...
mmap() failed: Permission denied
mmap() failed: Permission denied
mmap() failed: Permission denied

with the following denials:

Apr 10 09:47:42 localhost kernel: [245540.761710] audit: type=1400 audit(1491835662.097:1159): apparmor="DENIED" operation="file_mmap" profile="snap.snapcraft-forum.snapcraft-forum" name="/dev/shm/pulse-shm-3385262665" pid=4756 comm="snapcraft-forum" requested_mask="m" denied_mask="m" fsuid=1000 ouid=1000
Apr 10 09:47:43 localhost kernel: [245542.442016] audit: type=1400 audit(1491835663.777:1160): apparmor="DENIED" operation="file_mmap" profile="snap.snapcraft-forum.snapcraft-forum" name="/dev/shm/.org.chromium.Chromium.NRaA58" pid=4756 comm="Chrome_IOThread" requested_mask="m" denied_mask="m" fsuid=1000 ouid=1000

This may be related to some mediation fixes surrounding mmap. Let me talk to the apparmor devs and if needed I can propose a PR.

The zesty kernel has the updates for mmap mediation (related to the flock bug) that require changes to the policy. This will affect other Ubuntu releases when those patches are reintroduced. I’ll prepare a PR.

@jdstrand Curiously, per my note above, I got mmap errors on Xenial still. Any ideas?

@niemeyer do you use a 4.4 kernel or one of the hwe ones ?

@niemeyer - it depends on the kernel you are running. The patchset in question is one of the ones that was in play during the kernel/snapd/dpkg issue.

Ah, yes, that’s like it: 4.4.0-67-generic

FYI, https://github.com/snapcore/snapd/pull/3165

I thought for Electron apps to work using electron-builder we needed yarn support in Snapcraft?

i worked on the code a little more on the weekend (will provide PRs ASAP) … i fixed all the icon and dash issues (the app icon now is found properly and also allows to pin it to the launchers (at least in gnome (x11) and unity under 16.04). all xdg-open issues should be fixed with this one (as long as you have xdg-open installed). i also added a tray icon and added “minimize to tray” so that the app can stay around minimized and recieve desktop notifications. sadly it suffers the same icon issue as the telegram-sergiuens app under unity regarding the icon display of the tray icon (works fine in gnome), seems the rocketchat one has a working one so i’ll try to get that fixed in the next iteration …

i’ll also try to add a notification counter to the tray icon and add spell checking support for the input … once these two are there i’ll stop :wink:

a test snap can be found at: http://people.canonical.com/~ogra/snaps/snapcraft-forum_1.1.2_amd64.snap

install it with “sudo snap install --dangerous /path/to/snap” if you want to test it.