Is it even possible to have Chromium inside a MIR Kiosk?

After trying to lock down Ubuntu desktop to make a kiosk, and failing, my research and the general concenseus lead me to believe that Ubuntu core running MIR kiosk is the proper way to do it. Well I have spent a week trying to get get chromium to run on ubuntu core at a specified url.

I am starting to think maybe the security of self contained snaps means I can’t make a snap that starts chromium? There are many tutorials on making snaps with like retro games, or spinning gears, but none on how to make a web kiosk, which I would imagine is the most common example use case. I am struggling with this, or to find an example. This makes me think its not possible at present?

Does one have to build chromium oneself so one can call it? Is it not possible to just call it as a command?

Any help or high level thoughts would be greatly appreciated.

Eventaully I would like to have a python flask app running on the device, and then start up chromium and point it at that flask url. The coding the flask app was easy, packaging is taking much longer, and harder to get right.

This is the snapcraft.yaml file I have been working:

name: project-terminal
version: '0.1'
summary: Web Terminal test project
description: Demo project to test if possible
base: core20
confinement: classic  # strict / classic / devmode
grade: devel  # Change from devel -> stable for release

#    daemon: simple
#    restart-condition: always
      - env-setup
    command: bin/
    # chromium --kiosk

  - build-on: amd64

    plugin: dump
    stage-snaps: [mir-kiosk-x11, chromium]
    source: .
    organize: bin/

# Needed by Mir and/or Xwayland
    bind: $SNAP/usr/share/X11
    symlink: $SNAP/usr/bin/xkbcomp
    bind: $SNAP/usr/share/icons
    bind: $SNAP/usr/share/fonts
    bind: $SNAP/etc/fonts

  opengl:         # For Mir
  wayland:        # For Mir
  network-bind:   # For Mir (to serve X11)
usr/local/bin/x11_kiosk_launch chromium --kiosk

And when it starts:

$ project-terminal 
++ dirname /run/user/1000
+ real_xdg_runtime_dir=/run/user
+ '[' '!' -O /run/user ']'
++ dirname /run/user
+ inotifywait --event create /run
Setting up watches.
Watches established.

… and nothing happens

Bonus question: Is there a way to make it save downloaded snaps when building, instead of redownloading the same snaps everytime it downloads?

Any recommendations?

It is, in principle, possible to have chromium running in a web kiosk snap. The Mir team investigated that some years ago. The conclusion of that work was that there was too much work required managing the building, configuring and packaging to maintain such a snap within our resources.

There is a web kiosk snap (that doesn’t use chromium, but a more targeted browser) maintained by glancr:

Your snap is waiting for a Wayland server to start. (I presume you intend to use mir-kiosk for this?)

Chromium has native support for Wayland, why are using X11?

Thanks for the replies, trying to understand them.

Maybe this has changed, but it says so here “”:

Toolkits without Native support for Wayland

  • Chromium

Yes, that has changed since the tutorial was written.

Yes 100%! Sounds like I am missing something obvious?

Thanks for this insight. If it was too much for you guys, theres no chance I will be able to get it working. So I wil abandon Chromium completely. I looked at WPE Webkit, but I thought it was for making apps with HTML/CSS, I didnt realise its a full browser. Hopefully I can make it work. Thank you!

wpe-webkit-mir-kiosk is definitely the best supported kiosk browser in the store currently, but if you really need chromium you should consider simply using an electron kiosk app. this will use the chromium browser engine but with less overhead …

Thanks for that. I dont really need chromium, just a browser that can handle normal html/css/js, with html5 widgets (like date picker), most complicated it gets is css flexbox and css grid.

Its a pity snap get chromium does list a start url and kiosk mode option, that would make things very simple I imagine.

In this tutorial:

It says one can test wayland support with

miral-app -kiosk -terminal '/path/to/my_application'

I am not going to use chromium, but just for learning’s sake I tried:

miral-app -kiosk -terminal chromium

And it displays:
[18303:18303:0727/] Unable to open X display.

Is it expected that it should start up and be inside the window?

AFAICT this is a problem with the chromium snap, not chromium:

So now going full steam ahead with wpe-webkit-mir-kiosk thank you, however documentation seems a bit thin as far as I can tell.

To verify my dev env:
miral-app -kiosk -terminal 'glmark2-wayland --fullscreen'
Works, however with and without the fullscreen flag, both cases render it as a window about 1/4 size of my screen.

I then tried:

snap set wpe-webkit-mir-kiosk url=
miral-app -kiosk -terminal /snap/bin/wpe-webkit-mir-kiosk.cog

It brings up a window, but it shows a terminal instead of a browser. I feel like I am stabbing at the dark instead of folloing documentation, any insights or suggested reading material?

wpe-webkit-mir-kiosk runs as a daemon and starts automatically (simply installing mir-kioks (or the newer ubuntu-frame) and then installing wpe-webkit-mir-kiosk afterwards should get you all you need, there is no manual stuff necessary beyond setting the value for “url” to point where you want it … there are plenty of commercial Ubuntu Core based installs out there with exactly this setup) , don’t try to run it manually as miral-app …

I’m not clear on what you are trying to do here?

You seem to be following a tutorial about packaging an application for use as a “kiosk app”. And are at the step of testing that it works with Wayland.

But wpe-webkit-mir-kiosk is already packaged as a “kiosk app” so all of that is unnecessary.

Hi Guys, sorry I am talking utter twaddle, I tried orginally just running it and ran into problem then, tried to resolve it with some attempts from the tutorials, but didnt fix it, and then messed up the post. Sorry running on very little sleep, been trying to to make a web kiosk every night until about 4am this last wek.

On a dev enviroment I tried:

sudo snap install wpe-webkit-mir-kiosk

then later

sudo snap install wpe-webkit-mir-kiosk --devmode

This is how I tried to run it

snap set wpe-webkit-mir-kiosk url=

And I get

+ snapctl is-connected wayland
+ echo Wayland interface not connected!
Wayland interface not connected!
+ exit 1

Thats why I tried the miral-app stuff. Can it not run on dev PC, should I load it onto computer running core (I am working on that but its currently not booting)?

on an Ubuntu Core or Ubuntu Server install (it is important that there is no GUI already running) you do:

sudo snap install mir-kiosk 
sudo snap install wpe-webkit-mir-kiosk
sudo snap set wpe-webkit-mir-kiosk url=

this is all …

after installing mir-kiosk you should see a short orange flash and afterwards a black screen with mouse pointer … (if you decide to use the more modern ubuntu-frame you will see a gray gradient instead of the orange flash)

after installing wpe-webkit-mir-kiosk and waiting a little (it takes a bit to set up its runtime environment on first install) you should see the webkit page …

after running the snap set ... command you should then see the page (the browser will restart automatically and point to the new URL IIRC)