Snaps to develop a Web kiosk on Ubuntu Core (using Wayland)

Hey all,
I’ve been focused on enabling Ubuntu Core for embedded graphical applications using Wayland - things like web kiosk, digital signage and industrial user interfaces. Myself and @alan_g are working on documentation for this, but I wanted to share a tool and an example web kiosk snap for you to try out

First off, we wanted to make testing a GUI snap as easy as possible, so allow me to announce ubuntu-core-vm - a simple utility that brings up Ubuntu Core in a VM:

snap install --beta ubuntu-core-vm --devmode

For the first run, create a VM running the latest Core image:

sudo ubuntu-core-vm init edge

From then on, you can spin it up with:

sudo ubuntu-core-vm

You should see Ubuntu Core booting in new window. It’ll ask you the usual questions to activate the Core image - once completed you can log in. Note the login instructions from Core are inaccurate, change to similar to those ubuntu-core-vm gives you:

ssh -p 5555 $USERNAME@localhost

Now you’re inside the VM, you can install Mir-kiosk with

snap install mir-kiosk

and once completed, you should see the orange-fade-to-black animation to say it is working.

Now let’s install something interesting:

snap install --beta chromium-mir-kiosk

It won’t work until you run this command however (provisional, should go away soon)

snap connect chromium-mir-kiosk:wayland-socket-dir mir-kiosk:wayland-socket-dir

Need to restart the daemon, this will do it:

snap stop chromium-mir-kiosk
snap start chromium-mir-kiosk

and you should see a fullscreen webpage in your VM! (There are some configuration options in the snap, have a play!)

In summary, ubuntu-core-vm will help you develop your graphical snaps, and chromium-mir-kiosk is a nice example of what’s possible!

Have a great weekend all!
-G

9 Likes

Nice!

I went a little further. This is a ThinkPad X61s running Ubuntu Core 16 on the bare metal, no VM. Running your Chromium snap.

DSC_0001

7 Likes

@popey oh sweet! Thanks for giving that a go!
-G

@greyback No problemo. What’s next? Some docs that tell us how to bring other applications to this? I can imagine an electron (GTK) based music player might like to have a full screen kiosk mode. Perhaps other applications too.

1 Like

Yes, we’ve been writing docs. The PR for the first two tutorials is here:

https://github.com/canonical-websites/tutorials.ubuntu.com/pull/755

2 Likes

Just trying the understand. What exactly will be the end result/product ?

We’re thinking of use-cases like digital signage, interactive kiosks, embedded device displays and industrial controllers, things which need a single full-screen application running continually. These are products which can really benefit from Ubuntu Core’s security and reliability.
-G

3 Likes

Is there anything magic required to get this running on bare metal? As a non-developer desktop enthusiast it may be over my head but I had an old desktop and hard disk that I thought I would use for my first playing with core. Everything step by step seemed to work fine but I just have a black screen with a cursor.

Once Ubuntu Core is set up on a VM or bare metal there’s nothing “magic” to get chromium-mir-kiosk running, the process is exactly the same.

The original point of this post is the existence of a VM that does this, so there are steps above to set up the VM that should be replaced by setting up your old desktop.

Did you successfully set up your old desktop and get an ssh login session to it? Or did things go wrong after that?

It is an old Dell Core-2 Optiplex and everything worked perfectly as expected (including “orange fade to black animation”) up to the point of

snap start chromium-mir-kiosk

which even that simply reported “started” as I would expect. It is just that the display on the device only shows a black screen and a graphics cursor which responds to the mouse.

First guess: you’re running the default “stable” core snap, but chromium-mir-kiosk requires “edge”. Try updating core (which will restart the machine) and after the restart try starting chromium again:

sudo snap refresh core --edge

It updated and rebooted but I’m still at a black screen and graphic cursor.
I had originally only had the chromium kiosk and was wondering if the computer was properly talking to the monitor so I tried mir-kiosk-apps. The photo viewer started ok, then I switched to clocks with no problem so when I rebooted it started with clocks on the screen. When I run
snap start chromium-mir-kiosk
It goes immediately to the black screen and when I say “stop” it goes back to clocks. Again I didn’t have the apps on there in the beginning, but should I remove them for some reason?
Also the command said that mir-kiosk should be on beta, should it rather be on edge?

Using mir-kiosk from “beta” is fine: the changes currently on “edge” won’t matter here. It is clearly working (as proven by the mir-kiosk-apps).

The problem lies in the combination of the chromium-mir-kiosk snap and your setup. That is hard to diagnose remotely (especially as I’m unfamiliar with the details of that snap). He’s not around until Monday, but @greyback may have some ideas about how to clarify what is going wrong and possibly propose a workaround or fix.

I know it doesn’t help you much, but chromium-mir-kiosk works with various pieces of kit I have tried around my office.

PS if you’re looking for things to try with Ubuntu Core and graphics how about this: Graphical Snaps for Ubuntu IoT Devices?

Can you check if journalctl -u snap.chromium-mir-kiosk* shows any relevant errors?

Sorry, it took me two edits because I didn’t know what I was doing and was getting partial data. I think I have it now

   -- Logs begin at Fri 2018-06-22 15:12:00 UTC, end at Fri 2018-06-22 15:16:19 UTC. --
Jun 22 15:12:08 localhost.localdomain systemd[1]: Started Service for snap application chromium-mir-kiosk.chromium.
Jun 22 15:12:09 localhost.localdomain chromium-mir-kiosk.chromium[1714]: mkdir: cannot create directory ‘/run/user/0’: Permission denied
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Documents': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Desktop': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Downloads': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Music': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Pictures': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Videos': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Templates': No such file or directory
Jun 22 15:12:10 localhost.localdomain chromium-mir-kiosk.chromium[1714]: mkdir: cannot create directory ‘/run/user/0’: Permission denied
Jun 22 15:12:11 localhost.localdomain chromium-mir-kiosk.chromium[1714]: could not connect to wayland server
Jun 22 15:12:11 localhost.localdomain chromium-mir-kiosk.chromium[1714]: (EE)
Jun 22 15:12:11 localhost.localdomain chromium-mir-kiosk.chromium[1714]: Fatal server error:
Jun 22 15:12:11 localhost.localdomain chromium-mir-kiosk.chromium[1714]: (EE) Couldn't add screen
Jun 22 15:12:11 localhost.localdomain chromium-mir-kiosk.chromium[1714]: (EE)
Jun 22 15:12:12 localhost.localdomain chromium-mir-kiosk.chromium[1714]: i3: Could not mkdir(/run/user/0/snap.chromium-mir-kiosk/i3): No such file or directory
Jun 22 15:12:12 localhost.localdomain chromium-mir-kiosk.chromium[1714]: i3: Check permissions of $XDG_RUNTIME_DIR = '/run/user/0/snap.chromium-mir-kiosk'
Jun 22 15:12:16 localhost.localdomain chromium-mir-kiosk.chromium[1714]: [2785:2785:0622/151216.844734:WARNING:browser_main_loop.cc(271)] Gtk: cannot open display: :0
Jun 22 15:12:16 localhost.localdomain chromium-mir-kiosk.chromium[1714]: /snap/chromium-mir-kiosk/9/bin/chromium-browser.launcher: line 1: kill: (2729) - No such process
Jun 22 15:12:16 localhost.localdomain systemd[1]: snap.chromium-mir-kiosk.chromium.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 15:12:16 localhost.localdomain systemd[1]: snap.chromium-mir-kiosk.chromium.service: Unit entered failed state.
Jun 22 15:12:16 localhost.localdomain systemd[1]: snap.chromium-mir-kiosk.chromium.service: Failed with result 'exit-code'.
Jun 22 15:12:17 localhost.localdomain systemd[1]: snap.chromium-mir-kiosk.chromium.service: Service hold-off time over, scheduling restart.
Jun 22 15:12:17 localhost.localdomain systemd[1]: Stopped Service for snap application chromium-mir-kiosk.chromium.
Jun 22 15:12:17 localhost.localdomain systemd[1]: Started Service for snap application chromium-mir-kiosk.chromium.
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: mkdir: cannot create directory ‘/run/user/0’: Permission denied
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Documents': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Desktop': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Downloads': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Music': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Pictures': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Videos': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Templates': No such file or directory
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: mkdir: cannot create directory ‘/run/user/0’: Permission denied
Jun 22 15:12:17 localhost.localdomain chromium-mir-kiosk.chromium[2805]: glamor: EGL version 1.4 (DRI2):
Jun 22 15:12:18 localhost.localdomain chromium-mir-kiosk.chromium[2805]: Require OpenGL version 2.1 or later.
Jun 22 15:12:18 localhost.localdomain chromium-mir-kiosk.chromium[2805]: Failed to initialize glamor
Jun 22 15:12:18 localhost.localdomain chromium-mir-kiosk.chromium[2805]: Failed to initialize glamor, falling back to sw
Jun 22 15:12:18 localhost.localdomain chromium-mir-kiosk.chromium[2805]: i3: Could not mkdir(/run/user/0/snap.chromium-mir-kiosk/i3): No such file or directory
Jun 22 15:12:18 localhost.localdomain chromium-mir-kiosk.chromium[2805]: i3: Check permissions of $XDG_RUNTIME_DIR = '/run/user/0/snap.chromium-mir-kiosk'
Jun 22 15:12:22 localhost.localdomain chromium-mir-kiosk.chromium[2805]: ATTENTION: default value of option force_s3tc_enable overridden by environment.
Jun 22 15:12:22 localhost.localdomain chromium-mir-kiosk.chromium[2805]: shm_open() failed: Permission denied
Jun 22 15:12:22 localhost.localdomain chromium-mir-kiosk.chromium[2805]: Failed to create secure directory (/run/user/0/snap.chromium-mir-kiosk/pulse): No such file or directory
Jun 22 15:12:22 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3331:3331:0622/151222.705751:ERROR:sandbox_linux.cc(378)] InitializeSandbox() called with multiple threads in process gpu-process.
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3295:3346:0622/151223.282315:ERROR:bus.cc(394)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3295:3295:0622/151223.560393:WARNING:password_store_factory.cc(240)] Using basic (unencrypted) store for password storage. See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_password_storage.md for more information about password storage options.
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: LaunchProcess: failed to execvp:
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: xdg-desktop-menu
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: LaunchProcess: failed to execvp:
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: xdg-icon-resource
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3295:3319:0622/151223.904574:WARNING:shell_integration_linux.cc(324)] Could not install icon chrome-mebpkjlidhbhcijdfilbkcapobaejicc-Default.png at size 16.
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: LaunchProcess: failed to execvp:
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: xdg-icon-resource
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3295:3319:0622/151223.916223:WARNING:shell_integration_linux.cc(324)] Could not install icon chrome-mebpkjlidhbhcijdfilbkcapobaejicc-Default.png at size 128.
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: LaunchProcess: failed to execvp:
Jun 22 15:12:23 localhost.localdomain chromium-mir-kiosk.chromium[2805]: xdg-desktop-menu
Jun 22 15:12:26 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3295:3295:0622/151226.278597:ERROR:display_info_provider.cc(189)] Not implemented reached in virtual void extensions::DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform(const display::Display &, extensions::api::system_display::DisplayUnitInfo *)
Jun 22 15:12:27 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3331:3331:0622/151227.246042:WARNING:gl_context_glx.cc(288)] Could not disable vsync: driver does not support swap control
Jun 22 15:12:33 localhost.localdomain chromium-mir-kiosk.chromium[2805]: [3295:3324:0622/151233.639872:ERROR:udev_watcher.cc(60)] Failed to begin udev enumeration.

Hi @dshimer ,
just to verify, are you running snap start chromium-mir-kiosk as root?

From the log, this error is a likely candidate:

mkdir: cannot create directory ‘/run/user/0’: Permission denied

as it means $XDG_RUNTIME_DIR will not exist, something which Xwayland needs. The script tries to create it itself, but maybe apparmor is preventing it?

As a workaround, can you create the directory yourself and then see if the snap works?
Thanks
-G

I don’t think the user calling snap start… matters, as it’s just a wrapper around systemctl - it’s a system service, it always runs as root. mir-kiosk itself wouldn’t work if not ran as root, would it?

Which makes the permission error all the more confusing…

Tried the command, and tried it with sudo. I made the folder manually and here is the journalctl output which has been cut to just the last attempt.

Jun 26 09:44:15 localhost.localdomain systemd[1]: Started Service for snap application chromium-mir-kiosk.chromium.
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Documents': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Desktop': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Downloads': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Music': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Pictures': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Videos': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ln: failed to create symbolic link '/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Templates': No such file or directory
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: glamor: EGL version 1.4 (DRI2):
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: Require OpenGL version 2.1 or later.
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: Failed to initialize glamor
Jun 26 09:44:16 localhost.localdomain chromium-mir-kiosk.chromium[8250]: Failed to initialize glamor, falling back to sw
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: shm_open() failed: Permission denied
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8747:8778:0626/094417.665116:ERROR:bus.cc(394)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8747:8747:0626/094417.705030:WARNING:password_store_factory.cc(240)] Using basic (unencrypted) store for password storage. See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_password_storage.md for more information about password storage options.
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: ATTENTION: default value of option force_s3tc_enable overridden by environment.
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8773:8773:0626/094417.745189:ERROR:sandbox_linux.cc(378)] InitializeSandbox() called with multiple threads in process gpu-process.
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: LaunchProcess: failed to execvp:
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: xdg-desktop-menu
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: LaunchProcess: failed to execvp:
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: xdg-icon-resource
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8747:8759:0626/094417.816415:WARNING:shell_integration_linux.cc(324)] Could not install icon chrome-mebpkjlidhbhcijdfilbkcapobaejicc-Default.png at size 16.
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: LaunchProcess: failed to execvp:
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: xdg-icon-resource
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8747:8759:0626/094417.839797:WARNING:shell_integration_linux.cc(324)] Could not install icon chrome-mebpkjlidhbhcijdfilbkcapobaejicc-Default.png at size 128.
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: LaunchProcess: failed to execvp:
Jun 26 09:44:17 localhost.localdomain chromium-mir-kiosk.chromium[8250]: xdg-desktop-menu
Jun 26 09:44:18 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8747:8747:0626/094418.130194:ERROR:display_info_provider.cc(189)] Not implemented reached in virtual void extensions::DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform(const display::Display &, extensions::api::system_display::DisplayUnitInfo *)
Jun 26 09:44:18 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8773:8773:0626/094418.486374:WARNING:gl_context_glx.cc(288)] Could not disable vsync: driver does not support swap control
Jun 26 09:44:23 localhost.localdomain chromium-mir-kiosk.chromium[8250]: [8747:8763:0626/094423.795382:ERROR:udev_watcher.cc(60)] Failed to begin udev enumeration.

I also noticed that the ln error contains the path

/root/snap/chromium-mir-kiosk/9/snap/chromium-mir-kiosk/9/Documents

but if I…

$ sudo ls /root/snap/chromium-mir-kiosk/9

it shows the following

Desktop Documents Downloads Music Pictures Public Templates Videos

when based on the error I would expect to find a snap subdir under 9. Again I am a barely technical non-developer so don’t really understand what I’m looking for but am hoping to provide the insight of such future users who might have a public space and an old box that would fit the bill as a web kiosk.

@dshimer thanks for trying that. Something is odd alright. Could you share the output of “snap interfaces” please?