X11 web kiosk snap - display blanks after a few seconds

Right. I’ve snapped the Epiphany browser and combined it with Ubuntu Frame on a Raspberry Pi4b running Core20 to make a simple digital display. Snap installs (devmode) and runs the daemon. Then it all goes wrong.

The browser appears on the screen and begins to load the webpage (as in the full browser appears, address bar with the pre-set url, the “loading page” animation starts playing), then the screen goes dark. It does not return to the gray “default screen” of Ubuntu Frame, it simply goes dark.

[Edit: clarification – if I load a small quick page that loads in under 2 seconds, it actually loads the page and displays correctly. Then the screen blanks].

If I snap restart web-kiosk.daemon it restarts and opens a new tab in which it tries to open the default url (so I can see there is another tab with the correct site name etc). Then it goes black again.

Also tried snapping the browser for Wayland, but in that case the display becomes corrupted (imagine the display being smudged then pixelated to it is all a mess of lines) so went for X11 instead. But I guess that is beside the point here.

Hoping there is something I’m just blind to here that someone here might see.

Full snapcraft.yaml

name: web-kiosk  # you probably want to 'snapcraft register <name>'
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: TBD # 79 char long summary
description: |
  TBD
confinement: devmode
compression: lzo
grade: devel
base: core20

apps:
  daemon:
    extensions: [gnome-3-38]
    command-chain:
      - env-setup
    command: usr/local/bin/x11_kiosk_launch $SNAP/bin/kiosk
    daemon: simple
    restart-condition: always
    plugs:
      - opengl
      - wayland
      - network
      - network-bind
      - browser-support
      - process-control
      - network-observe
# This is one of four snippets that relate to providing the userspace graphics needed by your application.
# You can treat this as "magic" so long as you don't need to make changes.
# On the Mir discourse forum there's a lot more detail on [the graphics-core20 Snap interface](https://discourse.ubuntu.com/t/the-graphics-core20-snap-interface/23000) and it's use.
plugs:
  graphics-core20:
    interface: content
    target: $SNAP/graphics
    default-provider: mesa-core20
  gnome-3-38-2004:
    default-provider: gnome-3-38-2004
    interface: content
    target: $SNAP/gnome-platform
  gtk-3-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/themes
  icon-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/icons
  sound-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/sounds
  opengl:         # For Mir
  wayland:        # For Mir
  network-bind:   # For Mir (to serve X11)

environment:
  # This is one of four snippets that relate to providing the userspace graphics needed by your application.
  LD_LIBRARY_PATH: $SNAP/graphics/lib:${SNAP}/usr/lib/:${SNAP}/usr/lib/x86_64-linux-gnu/
  LIBGL_DRIVERS_PATH: $SNAP/graphics/dri
  LIBVA_DRIVERS_PATH: $SNAP/graphics/dri
  __EGL_VENDOR_LIBRARY_DIRS: $SNAP/graphics/glvnd/egl_vendor.d
  # Other, generally useful environment settings...
  # XDG config
  XDG_CACHE_HOME:  $SNAP_USER_COMMON/.cache
  XDG_CONFIG_HOME: $SNAP_USER_DATA/.config
  XDG_CONFIG_DIRS: $SNAP/etc/xdg
  # XKB config
  XKB_CONFIG_ROOT: $SNAP/usr/share/X11/xkb
  BROWSER: epiphany

# The `layout` ensures that files can be found by applications where they are expected by the toolkit or application.
layout:
  /usr/share/X11:
    bind: $SNAP/usr/share/X11
  /usr/bin/xkbcomp:
    symlink: $SNAP/usr/bin/xkbcomp
  /usr/share/icons:
    bind: $SNAP/usr/share/icons
  /usr/share/fonts:
    bind: $SNAP/usr/share/fonts
  /etc/fonts:
    bind: $SNAP/etc/fonts
  /usr/lib/x86_64-linux-gnu/epiphany-browser:
    bind: $SNAP/usr/lib/x86_64-linux-gnu/epiphany-browser
  # custom for browser arm64
  /usr/lib/arm64-linux-gnu/epiphany-browser:
    bind: $SNAP/usr/lib/arm64-linux-gnu/epiphany-browser 
  # custom for browser aarch64
  /usr/lib/aarch64-linux-gnu/epiphany-browser:
    bind: $SNAP/usr/lib/aarch64-linux-gnu/epiphany-browser



parts:
  kiosk:
    source: sh/
    plugin: dump
    stage-snaps: 
      - mir-kiosk-x11
    stage-packages:
      - epiphany-browser
      - epiphany-browser-data
      - iso-codes
      - libatk1.0-0
      - libcairo2
      - libdazzle-1.0-0
      - libgcr-base-3-1
      - libgcr-ui-3-1
      - libgdk-pixbuf2.0-0
      - libglib2.0-0
      - libgmp10
      - libgtk-3-0
      - libhandy-0.0-0
      - libhogweed5
      - libjavascriptcoregtk-4.0-18
      - libjson-glib-1.0-0
      - libnettle7
      - libnotify4
      - libpango-1.0-0
      - libsecret-1-0
      - libsoup2.4-1
      - libsqlite3-0
      - libwebkit2gtk-4.0-37
      - libxml2
      - gstreamer1.0-gtk3
      - gsettings-desktop-schemas
     organize:
      'kiosk': bin/kiosk
    override-prime: | # change settings to disable screensaver/asking for epiphany to be default browser.
      snapcraftctl prime
      sed -i '5s/true/false/' usr/share/glib-2.0/schemas/org.gnome.desktop.screensaver.gschema.xml
      sed -i '60s/true/false/' usr/share/glib-2.0/schemas/org.gnome.epiphany.gschema.xml

  # This is one of four snippets that relate to providing the userspace graphics needed by your application.
  # This ensures that your snap doesn't contain its own copy of the userspace drivers

Output of journalctl -xe (removed some apparmor spam)

Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832594] <information> xwayland: XWayland started on X11 display :5
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832742] <information> mirserver: Initial display configuration:
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832789] <information> mirserver: * Output 0: unknown connected, used
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832834] <information> mirserver: . |_ Physical size 0.0" 0x0mm
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832871] <information> mirserver: . |_ Power is on
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832910] <information> mirserver: . |_ Current mode 1024x768 60.00Hz
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832944] <information> mirserver: . |_ Preferred mode 1024x768 60.00Hz
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.832975] <information> mirserver: . |_ Orientation normal
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.833012] <information> mirserver: . |_ Logical size 1024x768
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.833045] <information> mirserver: . |_ Logical position +0+0
Apr 27 13:13:25 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:25.833077] <information> mirserver: . |_ Scaling factor: 1.00
Apr 27 13:13:25 core20 web-kiosk.daemon[23562]: /tmp/tmp.Y04oJdfGjV CLOSE_WRITE,CLOSE
Apr 27 13:13:26 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:26.307093] <information> xwayland: Starting XWayland
Apr 27 13:13:27 core20 kernel: kauditd_printk_skb: 377 callbacks suppressed
Apr 27 13:13:27 core20 kernel: audit: type=1326 audit(1651058007.034:4230): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23583 comm="Xwayland" exe="/snap/web-kiosk/x1/usr/bin/Xwayland" sig=0 arch=c00000b7 syscall=122 compat=0 ip=0xffff8145e4c4 code=0x7ffc0000
Apr 27 13:13:27 core20 kernel: audit: type=1326 audit(1651058007.034:4231): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23583 comm="Xwayland" exe="/snap/web-kiosk/x1/usr/bin/Xwayland" sig=0 arch=c00000b7 syscall=122 compat=0 ip=0xffff8145e4c4 code=0x7ffc0000
Apr 27 13:13:27 core20 kernel: audit: type=1326 audit(1651058007.034:4232): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23583 comm="Xwayland" exe="/snap/web-kiosk/x1/usr/bin/Xwayland" sig=0 arch=c00000b7 syscall=122 compat=0 ip=0xffff8145e4c4 code=0x7ffc0000
lines 801-880/1101 74%
Apr 27 13:13:29 core20 epiphany[23582]: Failed to search secrets in password schema: Failed to execute child process “dbus-launch” (No such file or directory)
Apr 27 13:13:29 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:29.225873] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:33 core20 kernel: kauditd_printk_skb: 197 callbacks suppressed
Apr 27 13:13:33 core20 kernel: audit: type=1400 audit(1651058013.042:4437): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/proc/zoneinfo" pid=23582 comm="PressureMonitor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246242] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246419] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246500] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246585] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246663] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246739] < - ERROR - > xwayland: XCB error: no reply data
Apr 27 13:13:34 core20 web-kiosk.daemon[23561]: [2022-04-27 13:13:34.246811] < -warning- > xwayland: X11 app did not set _NET_WM_PID, grouping it under the default XWayland application
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libzstd.so.1.4.4" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libzstd.so.1.4.4" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libelf-0.176.so" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libelf-0.176.so" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libedit.so.2.0.63" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libedit.so.2.0.63" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libtinfo.so.6.2" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 audit[23637]: AVC apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libtinfo.so.6.2" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4438): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libzstd.so.1.4.4" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4439): apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libzstd.so.1.4.4" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4440): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libelf-0.176.so" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4441): apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libelf-0.176.so" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4442): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libedit.so.2.0.63" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4443): apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libedit.so.2.0.63" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4444): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libtinfo.so.6.2" pid=23637 comm="eadedCompositor" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:34 core20 kernel: audit: type=1400 audit(1651058014.298:4445): apparmor="ALLOWED" operation="file_mmap" profile="snap.web-kiosk.daemon" name="/snap/core20/1408/usr/lib/aarch64-linux-gnu/libtinfo.so.6.2" pid=23637 comm="eadedCompositor" requested_mask="rm" denied_mask="rm" fsuid=0 ouid=0
Apr 27 13:13:39 core20 audit[23611]: SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:39 core20 kernel: audit: type=1326 audit(1651058019.974:4446): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:41 core20 audit[23611]: SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:41 core20 kernel: audit: type=1326 audit(1651058021.502:4447): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:42 core20 audit[23637]: AVC apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/usr/share/zoneinfo-icu/44/le/zoneinfo64.res" pid=23637 comm="WebKitWebProces" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:42 core20 kernel: audit: type=1400 audit(1651058022.598:4448): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/usr/share/zoneinfo-icu/44/le/zoneinfo64.res" pid=23637 comm="WebKitWebProces" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:42 core20 audit[23637]: AVC apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/usr/share/zoneinfo-icu/44/le/timezoneTypes.res" pid=23637 comm="WebKitWebProces" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:42 core20 kernel: audit: type=1400 audit(1651058022.602:4449): apparmor="ALLOWED" operation="open" profile="snap.web-kiosk.daemon" name="/usr/share/zoneinfo-icu/44/le/timezoneTypes.res" pid=23637 comm="WebKitWebProces" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Apr 27 13:13:42 core20 audit[23611]: SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:42 core20 kernel: audit: type=1326 audit(1651058022.670:4450): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:42 core20 audit[23611]: SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:42 core20 audit[23611]: SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000
Apr 27 13:13:42 core20 kernel: audit: type=1326 audit(1651058022.706:4451): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=23611 comm="WebKitNetworkPr" exe="/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess" sig=0 arch=c00000b7 syscall=274 compat=0 ip=0xffffa631b684 code=0x7ffc0000

Epiphany works fine over Wayland with ubuntu-frame on desktop. Whatever problems you see are caused either by your snap recipe or, potentially, bugs with the system you are running on.

Did you test your snap on desktop? Does it also fail there or just on RPi4?

i remember i had to apply hacks for my native electron-kiosk snap to make it work on Pi4, IIRC there are some missing bits in its driver (Pi3 works well)

1 Like

I first tested epiphany/ubuntu-frame on my desktop (step 4-5 of this tutorial), then for initial development I used a VM (Ubuntu Core 20 running on VirtualBox) until the recipe produced a functional snap. Then moved on to the RPI4.

Due to the screen smear issue I re-worked it to X11 using Xwayland. Which does work on the RPI4, except for the sudden screen blanking.

Both the Wayland and the X11 versions work on the test VM. Both break on the RPI4.

And that did it. Simply had to use WEBKIT_DISABLE_COMPOSITING_MODE=1 $SNAP/usr/bin/epiphany-browser ${display_url} and now all websites load without issue. Wonder what exactly is missing in the driver… regardless, thank you very much!

2 Likes

I’ve seen elsewhere that the GL support on Ubuntu Core/RPi4 is problematic. In that case forcing use of GLES worked (using GDK_GL=gles - that was a GDK based project).

2 Likes