Hi, I’m trying to follow the tutorial to snap the hello world Electron app. It worked fine up to step 3 (got the Electron app running on Ubuntu Classic), but after step 4 (convert into a kiosk app) the snap won’t run on either Ubuntu Classic (on my desktop) or Ubuntu Core (an armhf build running on a
Raspberry Pi 3).
Ubuntu Classic
On Ubuntu Classic the issue seems to be that it can’t find a Wayland socket, but the suggested fix for this doesn’t seem to work. One thing that isn’t clear to me from the tutorial is whether on Ubuntu Classic miral-kiosk and the electron-hello-world-kiosk apps should be running as root or my user, but no combination seems to work.
If I run the electron app as my user I get:
/snap/electron-hello-world-kiosk/x2/bin/xwayland-kiosk-launch: line 117: /var/snap/electron-hello-world-kiosk/x2/i3.config: Permission denied
and if I run it with sudo I get:
Error: Unable to find a valid Wayland socket in /run/user/0
Ubuntu Core
On Ubuntu Core if I run it as my user I get:
Error: Unable to find a valid Wayland socket in /run/user/1000
Is a Wayland server running?
You could try running as root
and if I run it with sudo I get:
[18706:0720/112140.582507:FATAL:atom_main_delegate.cc(194)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
/snap/electron-hello-world-kiosk/x1/bin/xwayland-kiosk-launch: line 151: 18706 Trace/breakpoint trap "$@"
/snap/electron-hello-world-kiosk/x1/bin/xwayland-kiosk-launch: line 1: kill: (-18140) - No such process
I’m wondering if there’s some mismatch of user id between the Wayland socket and the Electron snap, but I’m a bit lost to be honest.
The kiosk set up runs the apps as snap services, meaning they run as root. The tutorials are written with that assumption. So running “as your user” is not working by design at the moment.
Can you confirm mir-kiosk is running on your devices? journalctl -u snap.mir-kiosk* can give you a hint why, if it is not.
On Ubuntu Classic the mir-kiosk snap needs to be installed with --devmode to work “as intended” but, as it takes over the display, this isn’t a very convenient way to run things during development.
I’d recommend using this approach when testing your snap on desktop:
Just a sidenote … beyond the missing unzip in build-packages, the snapcraft.yaml at:
also does not have
daemon: simple
set for the application … so this can not really work …
EDIT: oops, ignore that, there is a second step to turn it into a kiosk app later in the tutorial (this is really confusing, especially since the first one can not really work on core)
Hmm, I don’t think I have the mir-kiosk snap installed on desktop. I followed the instructions in the Wayland kiosk tutorial which the X11 kiosk and Electron kiosk tutorials build upon. That includes installing these apt packages:
By the time you’ve made it through those three tutorials it’s all quite confusing so I wouldn’t be surprised if I’m doing something wrong. It would be easier to follow if the Electron kiosk tutorial just stood alone and only covered the steps needed for an Electron kiosk.
This isn’t a huge problem for me because I have two monitors plugged into my desktop PC.
Thanks very much for filing that @ogra. The updated tutorial doesn’t seem to have landed on tutorials.ubuntu.com yet, but following the updates that were made in the PR I was able to get this to work.
Side note: I do feel I need to dig a bit more into the security implications of Electron running as root with Chromium’s sandbox turned off as that seems like a problem for the real application I want to snap!
This should not be any problem given you are running under snap confinement. The kernel will take care of your security via apparmor, seccomp filtering, cgroups and namespaces. All you have done is to drop a duplicate sandbox running inside another one. If you run on core in some kind of appliance image you typically wont even have a user on the system anyway.
I can run the example with glxgears. I get the following error though when I run:
/snap/pygame-demo/x28/bin/xwayland-kiosk-launch: line 151: bin/pygame: No such file or directory
The launcher seems to look for the app run script in :
/snap/pygame-demo/x28/usr/bin
Looking for a bit more help. I have just included the layout and the parts involved.
Basically, I am trying to build pygame. It needs the sdl2-config file which it tries to find in /usr/bin/sdl2-config. So, what I tried to do is add a layout to bind the file. Nonetheless, it fails to find the file.
What I think might be possible issues:
The layout is applied after the all the part is built ?
Or stage-packages happens after python-packages ?
The config file from pygame cannot use the binding for some reason.
Do u think any of these are reasonable ? And any suggestion ? Thanks in advance!
Layouts are only applied on an installed snap, not during building. If it’s a binary to be called, you should set your $PATH correctly, rather than using a layout, too.
@Saviq: I don’t suppose you have any advice on how this example might be made to work as the snap_daemon user rather than root, as I’m being asked to do in order to pass snap store review here? Are you aware of anyone getting xwayland-kiosk-launch to run as a non-root user?