We have an Electron app that we are looking to bring to snap. We package our snap with the latest electron-builder. I set the app to confinement: devmode and install it with snap install my-app_0.0.1_amd64.snap --devmode, yet it still just seems to crash when trying to launch it. On Ubuntu 16.04, I see it open in the launcher bar and then flash blue a few times, and then it goes away.
All debugging docs I’ve read just mention to run in --devmode to try and figure issues like this out, but our app wont even run this way. What can I do?
If interested, the latest snaps (in strict mode) for the app can be found here.
I also tried using snappy-debug and I just get the following 3 log entries before the app closes. Doesn’t look like any errors to me?
We’ve recently introduced first class support for strace, so you can just run snap run --strace <snap app> and get it under strace. I’ve also heard from good sources that @mvo wants to get gdb working under the same scheme, so soon that’ll be doable too.
Something else you can do today with applications, which you might already be aware, is running a shell inside the confined space via snap run --shell <snap app>. This will allow you to more easily introspect and play with the system in the same way the application is playing.
Finally, there’s a chance @jdstrand will look into this and know exactly what to do for sorting the problem. That happens surprisingly often.
$ snap refresh core --beta
$ snap run --gdb test-snapd-tools.echo my-app
error: cannot find current revision for snap test-snapd-tools: readlink /snap/test-snapd-tools/current: no such file or directory
Gconf is an old, deprecrated settings API and usually the policy violations can be ignored. If your snap is trying to use gconf specifically, I suggest moving over to gsettings instead (this is the standard for many years and something the chromium content API can use (I’m not an electron developer so may need to ask others about that)). I suspect electron is simply trying to use gconf first. In devmode it can use it but in strict mode it would try moving on to something it can use.
Yes, this is because you are launching your application directly (ie, outside of confinement) rather than through the launcher (which launches it under confinement).
Because your snap doesn’t work in devmode, this suggests you are missing something from your snap that is otherwise available on your system. The strace calls can help, but you’re right, it is a firehose of information. I suggest looking for open() calls since that will show you what your snap is trying to use and perhaps not finding. Eg: snap run --strace myapp 2>&1 | grep open