Raspberry Pi 4 Model B issue starting kiosk

Hey there! I have been following the electron-kiosk tutorial and things seems to be a bit out of order for arm64 but it eventually worked on Ubuntu Desktop but having issue on Ubuntu Core. (Both Desktop and Core were tested on Pi)

On Desktop x11 plug works but as described by the tutorial to switch it with wayland for core and hence things fail.

Error running snap run electron-hello-world-kiosk and ofcourse I stopped the service before running this command.

Error log without sudo:

Error: Unable to find a valid Wayland socket in /run/user/1000
Is a Wayland server running?
You could try running as root

Error log with sudo:

If you are experiencing problems with your GUI app (e.g. bad fonts), please run:
  snap connect electron-hello-world-kiosk:x11-plug electron-hello-world-kiosk:x11
##################################################################################
_XSERVTransSocketCreateListener: failed to bind listener
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
glamor: EGL version 1.4:
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Failed to create scanout resource
(EE) 
(EE) Backtrace:
(EE) 0: /snap/electron-hello-world-kiosk/x1/usr/bin/Xwayland (xorg_backtrace+0x5c) [0xaaaaafce2dac]
(EE) 
(EE) Segmentation fault at address 0x0
(EE) 
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE) 
i3: Cannot open display

The futex facility returned an unexpected error code./snap/electron-hello-world-kiosk/x1/bin/xwayland-kiosk-launch: line 151:  5652 Aborted                 "$@"
/snap/electron-hello-world-kiosk/x1/bin/xwayland-kiosk-launch: line 1: kill: (-5487) - No such process

Some notes:

  • None of the demo kiosk apps on snapcraft.io works on Pi 4 Model B.
  • Mir-Kiosk does seem to work as expected as I can see orange sceen which goes black.
  • I read something about the OpenGL issue on Pi4. Is it relative?
  • Mir-Kiosk-Kodi logs out clearly that OpenGL drivers are not supported.
  • I was not able to test the snap on core20 because gnome-3-34 does not support it and seems the newer version is still under development.
  • More of a Pi thing but even after setting up gpu_mem using the snap set system pi-config.gpu-mem option, all snaps shows DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory Failed to create scanout resource
  • Installed glances to review the system performance and seems nothing is over-killing the system so memory issue log is weird.

I have more stats and logs if that helps in anyway but overall not able to run any kiosk on raspberry pi 4 model b.

Here is my yaml:

name: electron-hello-world-kiosk
version: '0.1'
summary: Hello World Electron app
description: |
  Simple Hello World Electron app as an example
base: core18
confinement: strict
grade: devel

environment:
  XWAYLAND_FULLSCREEN_WINDOW_HINT: window_role="browser-window"

apps:
  electron-hello-world-kiosk:
    command: desktop-launch xwayland-kiosk-launch "$SNAP/electron-helloworld/electron-quick-start" "--no-sandbox"
    plugs:
    - browser-support
    - network
    - network-bind
    - opengl
    - pulseaudio
    - wayland

  daemon:
    daemon: simple
    restart-condition: always
    command: desktop-launch xwayland-kiosk-launch "$SNAP/electron-helloworld/electron-quick-start" "--no-sandbox"
    plugs:
    - browser-support
    - network
    - network-bind
    - opengl
    - pulseaudio
    - wayland

parts:
  electron-helloworld:
    plugin: nodejs
    nodejs-version: 15.5.0
    nodejs-package-manager: npm
    source: https://github.com/electron/electron-quick-start.git
    after: [desktop-gtk3]
    override-build: |
      PATH=$PATH:$SNAPCRAFT_PART_SRC/../npm/bin 
      case $SNAPCRAFT_ARCH_TRIPLET in
        "i386-linux-gnu") ARCH="ia32";;
        "x86_64-linux-gnu") ARCH="x64";;
        "arm-linux-gnueabihf") ARCH="armv7l";;
        "aarch64-linux-gnu") ARCH="arm64";;
        *) echo "ERROR: electron does not support the '$SNAPCRAFT_ARCH_TRIPLET' architecture" && exit 1;;
      esac
      npm install electron electron-packager &&
      ./node_modules/.bin/electron-packager . --overwrite --platform=linux --arch=$ARCH --output=release-build --prune=true
      cp -v -R ./electron-quick-start-linux-$ARCH $SNAPCRAFT_PART_INSTALL/electron-helloworld
    stage-packages:
      - libasound2
      - libgconf-2-4
      - libnss3
      - libx11-xcb1
      - libxss1
      - libxtst6
      - libdrm2
      - libgbm1
      - libwayland-server0

    build-snaps:
      - node/15/stable

    build-packages:
      - nodejs
      - npm
      - unzip

  # Adapted from snapcraft-desktop-helpers https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/snapcraft.yaml#L183
  desktop-gtk3:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: gtk
    plugin: make
    make-parameters: ["FLAVOR=gtk3"]
    build-packages:
      - build-essential
      - libgtk-3-dev
    stage-packages:
      - libxkbcommon0  # XKB_CONFIG_ROOT
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libgtk-3-0
      - libgdk-pixbuf2.0-0
      - libglib2.0-bin
      - libgtk-3-bin
      - unity-gtk3-module
      - libappindicator3-1
      - locales-all
      - xdg-user-dirs
      - ibus-gtk3
      - libibus-1.0-5    

  xwayland-kiosk-helper:
    plugin: cmake
    source: https://github.com/MirServer/xwayland-kiosk-helper.git
    build-packages: [ build-essential ]
    stage-packages: [ xwayland, i3, libegl1-mesa, libgl1-mesa-glx ]

Thanks for any help and snapcraft is a great product, maybe some updated docs/examples will help the beginners to get started easily.