Core20 command format

Hello!

On base core18 i had the command

command: desktop-launch xwayland-kiosk-launch "$SNAP/main/kiosk" "--no-sandbox"

When i switched to core20 it says that i cannot use the " char.

I tried to create a run.sh bash:

desktop-launch xwayland-kiosk-launch "$SNAP/main/kiosk" "--no-sandbox"

and replaced the command with bin/run.sh but xwayland-kiosk-launch script is not generated anymore in snap bin.

Any thoughts?

We cannot see the content of your snap, nor your snapcraft.yaml. You have to find your script and then use that knowledge.

I have copied the file from here: xwayland-kiosk-helper/xwayland-kiosk-launch at master · MirServer/xwayland-kiosk-helper · GitHub

Now it says:

Jun 25 08:10:30 ubuntu kiosk.daemon[16670]: i3: Cannot open display
Jun 25 08:10:30 ubuntu kiosk.daemon[16656]: (EE) Failed to activate virtual core keyboard: 2(EE)
Jun 25 08:10:30 ubuntu kiosk.daemon[16656]: Fatal server error:
Jun 25 08:10:30 ubuntu kiosk.daemon[16656]: (EE)
Jun 25 08:10:30 ubuntu kiosk.daemon[16656]: Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
Jun 25 08:10:30 ubuntu kiosk.daemon[16656]: XKB: Failed to compile keymap

Is there another “xwayland-kiosk-launch” ?

except for the first command you will need to use the full path for all subsequent command-chain commands in that line … this is new in core20

I didn’t mean “where did you copy your script from?”, I meant “find where snapcraft places your script in the snap image”.

I don’t think that https://github.com/MirServer/xwayland-kiosk-helper has been used with core20 before, so you’re in new territory. You likely need to tweak a few thing due to the snapcraft packaging changes. One of those things is adapting to files being packaged in different places.

The reason this has likely not been used with core20 is that the recommended approach changed years ago:

Replying also to @ogra.

My main question, which i think it will guide me in the right direction, is:

Why when using “xwayland-kiosk-launch” in commmand, the “/snap/kiosk/current/bin/xwayland-kiosk-launch” file is generated? Because when i put the command in bash script the file is missing.

Which script copies/generates “xwayland-kiosk-launch” file in core18?

Files are copied into the snap by snapcraft, based on snapcraft.yaml.

Just look in the snap to see where xwayland-kiosk-launch ends up:

find /snap/yoursnap/current/ -name xwayland-kiosk-launch

typically it comes from a part in your snapcraft.yaml like:

and you would call it as $SNAP/bin/xwayland-kiosk-launch in the command: line under core20, while on core18 you do not need to explicitly state the path … no idea why the shell script does not work though, have you tried adding set -x to get some output ?

I started my yaml from https://github.com/ogra1/electron-kiosk-simplified/blob/main/snap/snapcraft.yaml#L48, so it’s mostly the same.

I have used the command:

   command: desktop-launch $SNAP/bin/xwayland-kiosk-launch $SNAP/main/kiosk --no-sandbox

And now i received:

Ensure that 'desktop-launch $SNAP/bin/xwayland-kiosk-launch $SNAP/main/kiosk --no-sandbox' is installed with the correct path.

I don’t know what do you mean by set -x. Where should i put it?

did you try @alan_g’s command above to make sure xwayland-kiosk-launch is actually in that path ?

the set -x would have been in your run.sh shell script right below the #! /bin/sh (or bash) line … this makes the shell print out all lines and their results while it executes them. it makes debugging shell scripts easy …

Sorry for the wait, i had to rebuild it.

I have found as @alan_g said.
The command worked as:

desktop-launch $SNAP/usr/local/bin/xwayland-kiosk-launch "$SNAP/main/kiosk" "--no-sandbox"

Anyway, i’m back at this error:

$ sudo snap run kiosk.daemon

/root/snap/kiosk/common/.cache/gio-modules/libgiognomeproxy.so: cannot open shared object file: No such file or directory
Failed to load module: /root/snap/kiosk/common/.cache/gio-modules/libgiognomeproxy.so
/root/snap/kiosk/common/.cache/gio-modules/libgiognutls.so: cannot open shared object file: No such file or directory
Failed to load module: /root/snap/kiosk/common/.cache/gio-modules/libgiognutls.so
/root/snap/kiosk/common/.cache/gio-modules/libdconfsettings.so: cannot open shared object file: No such file or directory
Failed to load module: /root/snap/kiosk/common/.cache/gio-modules/libdconfsettings.so
/root/snap/kiosk/common/.cache/gio-modules/libgiolibproxy.so: cannot open shared object file: No such file or directory
Failed to load module: /root/snap/kiosk/common/.cache/gio-modules/libgiolibproxy.so
Failed to rename /root/snap/kiosk/x6/.local/share/mime/audio/x-aiff.xml.new as /root/snap/kiosk/x6/.local/share/mime/audio/x-aiff.xml: No such file or directory
ERROR: update-mime-database /root/snap/kiosk/x6/.local/share/mime exited abnormally with status 1
##################################################################################
If you are experiencing problems with your GUI app (e.g. bad fonts), please run:
  snap connect kiosk:x11-plug kiosk:x11
##################################################################################
ERROR: ld.so: object '/snap/kiosk/x6/lib/libxwayland-preload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
_XSERVTransSocketCreateListener: failed to bind listener
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
(EE) 
Fatal server error:
(EE) Failed to activate virtual core keyboard: 2(EE) 
i3: Cannot open display
/snap/kiosk/x6/usr/local/bin/xwayland-kiosk-launch: line 151: 110154 Segmentation fault      (core dumped) "$@"
/snap/kiosk/x6/usr/local/bin/xwayland-kiosk-launch: line 1: kill: (-109904) - No such process

Is there any hope it will work on core20?

I see that there is a requirement " A device running Ubuntu Core 18."

Is any other way to run electronjs on mir-kiosk?

Hmm, that seems overly restrictive now. In principle, any version of Linux with support for snapd and with mesa graphics support in the kernel ought to be usable

I have some other updates to make to the tutorials queued up, and will add that to the list.

Sorry, I know very little about electronjs. Did I read recently that it has native support for Wayland? In which case you don’t need the complexity of the workarounds for X11.

Electron has Wayland behind a flag now, accessible with --enable-features=UseOzonePlatform --ozone-platform=wayland since Electron 12.

I believe on big limitation atm is that it has no Client Side Decorations, but I’m insure how important they are in Mir.

For “kiosk” applications I doubt client side decorations are necessary, but only you know what your app needs.

Yes, found it and waiting for this build to finish. It takes way too long… I’ll come back with a feedback.

It worked on local pc ubuntu 20 amd64.

It compiled on rpi 4 b with ubuntu 20 arm64.

But when i run it i get:

 sudo snap run kiosk.daemon
+ desktop-launch /snap/kiosk/x8/main/kiosk --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland

(kiosk:85625): Gtk-WARNING **: 14:30:51.473: Failed to parse /etc/gtk-3.0/settings.ini: Permission denied

Maybe @ogra can take a look in journal log?

journalctl -r -n 100 | grep "kiosk.daemon"
Jun 25 14:29:53 ubuntu kiosk.daemon[84768]: + desktop-launch /snap/kiosk/x8/main/kiosk --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland
Jun 25 14:29:53 ubuntu systemd[1]: Started Service for snap application kiosk.daemon.
Jun 25 14:29:53 ubuntu systemd[1]: Stopped Service for snap application kiosk.daemon.
Jun 25 14:29:53 ubuntu systemd[1]: snap.kiosk.daemon.service: Scheduled restart job, restart counter is at 4.
Jun 25 14:29:53 ubuntu systemd[1]: snap.kiosk.daemon.service: Succeeded.
Jun 25 14:29:53 ubuntu mir-kiosk.daemon[2144]: error in client communication (pid 84594)
Jun 25 14:29:53 ubuntu mir-kiosk.daemon[2144]: file descriptor expected, object (16), message create_pool(nhi)
Jun 25 14:29:53 ubuntu audit[2144]: AVC apparmor="DENIED" operation="file_receive" profile="snap.mir-kiosk.daemon" name="/dev/shm/.org.chromium.Chromium.5faAyM" pid=2144 comm="Mir/Wayland" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.825:3581): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.825:3580): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/etc/fonts/conf.avail/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/etc/fonts/conf.avail/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.733:3579): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/etc/gtk-3.0/settings.ini" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/etc/gtk-3.0/settings.ini" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.117:3577): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.117:3576): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.117:3575): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.117:3574): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.117:3573): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu kernel: audit: type=1400 audit(1624631392.117:3572): apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/local/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:52 ubuntu audit[84594]: AVC apparmor="DENIED" operation="open" profile="snap.kiosk.daemon" name="/usr/share/fonts/" pid=84594 comm="kiosk" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Jun 25 14:29:43 ubuntu kiosk.daemon[84570]: + desktop-launch /snap/kiosk/x8/main/kiosk --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland
Jun 25 14:29:43 ubuntu systemd[1]: Started Service for snap application kiosk.daemon.

EDIT
This was another error output:

sudo snap run kiosk.daemon
+ desktop-launch /snap/kiosk/x8/main/kiosk --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland
rm: cannot remove '/root/snap/kiosk/x8/.local/share/mime/application': Directory not empty
Failed to rename /root/snap/kiosk/x8/.local/share/mime/application/vnd.framemaker.xml.new as /root/snap/kiosk/x8/.local/share/mime/application/vnd.framemaker.xml: No such file or directory
ERROR: update-mime-database /root/snap/kiosk/x8/.local/share/mime exited abnormally with status 1

(kiosk:90203): Gtk-WARNING **: 14:34:41.193: Failed to parse /etc/gtk-3.0/settings.ini: Permission denied

(kiosk:90203): Gtk-WARNING **: 14:34:41.432: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
/snap/kiosk/x8/bin/run.sh: line 3: 90203 Aborted                 (core dumped) desktop-launch "$SNAP/main/kiosk" "--no-sandbox" "--enable-features=UseOzonePlatform" "--ozone-platform=wayland"

I don’t recognize all the errors, but the set up for gdk-pixbuf loaders is broken. (Usually handled by desktop-launch IIRC.)

Check that your plugs are connected especially interfaces like *-themes.

I have stopped the daemon, the “pixbuf loaders” error did not appear anymore. Only:

Failed to parse /etc/gtk-3.0/settings.ini: Permission denied