Problems running Electron app in mir-kiosk on kvm

I can run mir-kiosk-apps.

I have problems with my electron app. I followed this tutorial:

When i launch the app, I see only a black screen on mir-kiosk.
dmesg log is:
[ 907.008094] audit: type=1400 audit(1589216923.311:303): apparmor=“STATUS” operation=“profile_replace” profile=“unconfined” name=“snap.electron-hello-world-kiosk.electron-hello-world-kiosk” pid=11091 comm=“apparmor_parser”
[ 907.012192] audit: type=1400 audit(1589216923.315:304): apparmor=“STATUS” operation=“profile_replace” profile=“unconfined” name=“snap.electron-hello-world-kiosk.daemon” pid=11090 comm=“apparmor_parser”
[ 907.516157] audit: type=1400 audit(1589216923.819:305): apparmor=“STATUS” operation=“profile_replace” info=“same as current profile, skipping” profile=“unconfined” name=“snap-update-ns.electron-hello-world-kiosk” pid=11093 comm=“apparmor_parser”
[ 918.902760] audit: type=1400 audit(1589216935.208:306): apparmor=“ALLOWED” operation=“capable” info=“optional: no audit” error=-1 profile=“snap.electron-hello-world-kiosk.daemon” pid=11138 comm=“snap-exec” capability=12 capname=“net_admin”

@admdebian I’m trying to understand what you are doing and what is failing. There’s no errors being reported in that dmesg log. You may have better success with snap logs:

snap log -n 60 electron-hello-world-kiosk

To help us reproduce the problem could you answer the following:

  1. You’ve built using the final YAML from the tutorial?
  2. Does your snap work running as a non-daemon? Vis:
mir-kiosk& # no "sudo"
electron-hello-world-kiosk
  1. mir-kiosk is working for mir-kiosk-apps as described in the original post?
  2. You’re on a desktop: is that X11 or Wayland based?
  3. Are you using the “Method 1” or “Method 2” approach described in the original post or the later approach in comment 4?
  4. What are the exact commands are you entering?

I’ve tried 5 different snaps on 2 different systems.

Os list

  • 1.os: Ubuntu 18.04 LTS (x86)
  • 2.os: An Ubuntu Core Virtual Machine hosted by 1.os.

Command to start mir-kiosk on 1.os:

sudo mir-kiosk --x11-output 800x600

Command to launch the virtual machine for 2.os:

sudo kvm -smp 2 -m 1500 -netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -device\
virtio-net-pci,netdev=mynet0 -vga qxl -drive file=ubuntu-core-18-amd64.img,format=raw

App list
I tried all the apps in standard and in devmode:

  • 1.app: wpe-webkit-mir-kiosk
  • 2.app: chromium-mir-kiosk
  • 3.app: mir-kiosk-apps
  • 4.app: mir-kiosk-scummvm
  • 5.app: electron-hello-world-kiosk

On 1.os:

  • 1.app, 5.app, 2.app
    it starts in about 1-10 minutes (a lot of time!). The app is very slow to start but it’s very fast after the boot.

  • 3.app, 4.app
    it starts

On 2.os:

  • 1.app, 2.app, 5.app
    it doesn’t start

  • 3.app, 4.app
    it starts

2.os - snap logs wpe-webkit-mir-kiosk -n60:

2020-05-14T09:56:00Z -[1429]: <https://wpewebkit.org/> Crash!: The renderer process crashed. Reloading the page may fix intermittent failures.
2020-05-14T09:56:00Z wpe-webkit-mir-kiosk.browser[768]: EGLDisplay Initialization failed: EGL_NOT_INITIALIZED
2020-05-14T09:56:00Z -[1429]: Renderer process terminated and failed to recover within 1000ms

Process restart

2020-05-14T09:56:01Z wpe-webkit-mir-kiosk.browser[768]: EGLDisplay Initialization failed: EGL_NOT_INITIALIZED
2020-05-14T09:56:01Z -[1429]: Renderer process terminated and failed to recover within 1000ms
2020-05-14T09:56:01Z -[1429]: <https://wpewebkit.org/> Crash!: The renderer process crashed. Reloading the page may fix intermittent failures.
2020-05-14T09:56:01Z -[1429]: <https://wpewebkit.org/> Crash!: The renderer process crashed. Reloading the page may fix intermittent failures.
2020-05-14T09:56:01Z systemd[1]: Stopping Service for snap application wpe-webkit-mir-kiosk.browser...
2020-05-14T09:56:01Z systemd[1]: Stopped Service for snap application wpe-webkit-mir-kiosk.browser.
2020-05-14T09:56:05Z systemd[1]: Started Service for snap application wpe-webkit-mir-kiosk.browser.
2020-05-14T09:56:05Z wpe-webkit-mir-kiosk.browser[18105]: realpath: '': No such file or directory

On 2.os mir-kiosk starts at boot and I can see the mouse pointer and the orange splash screen.

Snap source code (see edits.txt):

https://github.com/Admdebian/test-electron-quick-start-snap

Snap install on 2.os:

snap install electron-hello-world-kiosk_0.10_amd64.snap --devmode

2.os - snap connections | grep electron:

browser-support  electron-hello-world-kiosk:browser-support  :browser-support    -
network          electron-hello-world-kiosk:network          :network            -
network-bind     electron-hello-world-kiosk:network-bind     :network-bind       -
opengl           electron-hello-world-kiosk:opengl           :opengl             -
pulseaudio       electron-hello-world-kiosk:pulseaudio       pulseaudio:service  -
wayland          electron-hello-world-kiosk:wayland          mir-kiosk:wayland   -

2.os - snap logs -n 60 electron-hello-world-kiosk:

2020-05-14T09:35:02Z systemd[1]: Started Service for snap application electron-hello-world-kiosk.daemon.
2020-05-14T09:35:45Z electron-hello-world-kiosk.daemon[19103]: pci id for fd 8: 1b36:0100, driver (null)
2020-05-14T09:35:46Z electron-hello-world-kiosk.daemon[19103]: glamor: EGL version 1.4:
2020-05-14T09:35:47Z electron-hello-world-kiosk.daemon[19103]: (EE)
2020-05-14T09:35:47Z electron-hello-world-kiosk.daemon[19103]: Fatal server error:
2020-05-14T09:35:47Z electron-hello-world-kiosk.daemon[19103]: (EE) wl_display@1: error 2: no memory
2020-05-14T09:35:47Z electron-hello-world-kiosk.daemon[19103]: (EE)
2020-05-14T09:35:47Z electron-hello-world-kiosk.daemon[19103]: i3: Cannot open display
2020-05-14T09:35:48Z -[19278]: cannot open display: :89
2020-05-14T09:35:48Z systemd[1]: snap.electron-hello-world-kiosk.daemon.service: Service hold-off time over, scheduling restart.
2020-05-14T09:35:48Z systemd[1]: snap.electron-hello-world-kiosk.daemon.service: Scheduled restart job, restart counter is at 1.
2020-05-14T09:35:48Z systemd[1]: Stopped Service for snap application electron-hello-world-kiosk.daemon.
2020-05-14T09:35:48Z systemd[1]: Started Service for snap application electron-hello-world-kiosk.daemon.
2020-05-14T09:37:05Z electron-hello-world-kiosk.daemon[19288]: pci id for fd 8: 1b36:0100, driver (null)
2020-05-14T09:37:05Z electron-hello-world-kiosk.daemon[19288]: glamor: EGL version 1.4:
2020-05-14T09:37:05Z electron-hello-world-kiosk.daemon[19288]: (EE)
2020-05-14T09:37:05Z electron-hello-world-kiosk.daemon[19288]: Fatal server error:
2020-05-14T09:37:05Z electron-hello-world-kiosk.daemon[19288]: (EE) wl_display@1: error 2: no memory
2020-05-14T09:37:05Z electron-hello-world-kiosk.daemon[19288]: (EE)
2020-05-14T09:37:06Z electron-hello-world-kiosk.daemon[19288]: i3: Cannot open display
2020-05-14T09:37:06Z -[19516]: cannot open display: :29
2020-05-14T09:37:06Z systemd[1]: snap.electron-hello-world-kiosk.daemon.service: Service hold-off time over, scheduling restart.
2020-05-14T09:37:06Z systemd[1]: snap.electron-hello-world-kiosk.daemon.service: Scheduled restart job, restart counter is at 2.
2020-05-14T09:37:06Z systemd[1]: Stopped Service for snap application electron-hello-world-kiosk.daemon.
2020-05-14T09:37:06Z systemd[1]: Started Service for snap application electron-hello-world-kiosk.daemon.

No:

localhost:~$ electron-hello-world-kiosk
Error: Unable to find a valid Wayland socket in /run/user/1000
Is a Wayland server running?
You could try running as root

With sudo:

/snap/electron-hello-world-kiosk/x1/bin/xwayland-kiosk-launch: line 1: kill: (-30650) - No such process

None

Thanks for your time and your articles!

Hi @admdebian for QEMU/KVM you want the qemu-virgil snap, otherwise you won’t get graphics, the lack of which would explain the EGL errors.

With the above, I can:

snap install mir-kiosk
snap install --beta wpe-webkit-mir-kiosk

and all comes up as expected.

You shouldn’t need --devmode as everything should work confined - those apparmor logs are benign.


As for slowness on X11… I think it may be due to the fact that in that scenario the WPE and Chromium daemons run in the background, and wait for Wayland to become available (i.e. you run mir-kiosk).

If you snap restart wpe-webkit-mir-kiosk right after you start mir-kiosk, does it still take so long to start?

You can see what’s happening with journalctl -u '*mir-kiosk*' -f.


Your Electron snap Just Worked™ for me, too. Just needed to snap connect electron-hello-world-kiosk:wayland if on desktop, and snap restart electron-hello-world-kiosk after mir-kiosk was started.

1 Like

With qemu-virgil the EGL error disappeared, thank you!