Score:0

KIOSK - Running Firefox Snap on Ubuntu Core 20 inside Ubuntu-Frame

jp flag

Appreciate any help in answering if it is possible to run snap version of Firefox on Ubuntu Core 32-bit IoT within Ubuntu-Frame?

I'm currently using Raspberry Pi 4 (4GB), but planning to move the SD Card to Raspberry Pi Zero 2W (so using the 32-bit armhf architecture for compatibility, although the Pi Zero 2 is 64-bit?) in accordance with this article (appreciate performance could be insufferable).

I've successfully followed this guide to use wpe-webkit-mir-kiosk, however the browser seems to crash if I navigate to certain pages, and doesn't appear very stable for my usage case. Plus the web application I'm hoping to use only officially supports Firefox on Linux, Edge on Windows, and Chrome on Android (from the developer).

  • It seems that Ubuntu-Frame supports a local display via Wayland. I can't work out if this supersedes mir-kiosk (which I have also tried to provide the display output via Wayland).
  • Firefox supports Wayland in recent versions with MOZ_ENABLE_WAYLAND=1. Firefox cannot be set as daemon, so will not launch on startup as other snap packages do.
  • These are all snap packages supported on Ubuntu Core snap install ubuntu-frame | snap install firefox

I have Ubuntu Core 20 (32-bit) running on the Pi 4, and have installed all the snap packages successfully, I just cannot work out how, or if it is possible to get Firefox to connect the Wayland display output?

Currently I am getting the following when starting Firefox: Error: no DISPLAY environment variable specified

I have tried following this guide, but it is really beyond my understanding having not worked with snap packages before, although I believe I have a good understanding of the concepts from my professional experience.

I don't know if the below is helpful, do I need to run Firefox as the root user?

Ubuntu Core: ubuntu-frame runs as root on Core, thus the Wayland socket is located at /run/user/0/wayland-0

Forcing a $DISPLAY environmental variable understandably does not have any success.

I feel like this should be possible, and would greatly appreciate any advice on a way forward. Would be very happy to share/blog the entire build once complete. Effectively, it should make a nice light-weight client browser Kiosk.

user535733 avatar
cn flag
I suspect that if it were possible today, [this demo](https://www.youtube.com/watch?v=nhf3sU3JFxI) would havre used Firefox instead of the same wpe-webkit-mir-kiosk that you used. Please keep in mind that Snaps, Mir, Ubuntu Frame, and Firefox are all all under active development by different teams, and that Ubuntu Frame is particularly new and raw. That you have discovered bugs is expected -- please report them. As an Ubuntu Frame tester, you might get better answers and advice participating in the Mir and Ubuntu Frame threads at https://discourse.ubuntu.com/c/mir/15.
jp flag
Thanks for your consideration @user535733. I agree, the fact that these technologies are very recent, gives me more hope that this should be possible, and someone will know more than me on how to achieve it! [Canonical launches Ubuntu Frame](https://ubuntu.com/blog/canonical-launches-ubuntu-frame-the-foundation-for-embedded-displays) *October 2021* | [Ubuntu Makes Firefox Snap Default in 21.10](https://www.omgubuntu.co.uk/2021/09/ubuntu-makes-firefox-snap-default) *October 2021* | [Ubuntu Core 20 Linux for IoT](https://ubuntu.com/blog/ubuntu-core-20-secures-linux-for-iot) *February 2021*
Score:1
ru flag

There are numerous step necessary to make that work.

1/ Test Firefox would start:

In a shell, as root, run (use sudo -i to become root):

WAYLAND_DISPLAY=wayland-0 MOZ_ENABLE_WAYLAND=1 firefox http://www.askubuntu.com

2/ Automate ubuntu-frame at startup

If you are not on a Ubuntu, you probably need to run this once:

snap set ubuntu-frame daemon=true

You should also remove the mir package (that would otherwise take memory):

snap remove wpe-webkit-mir-kiosk

3/ Automate firefox at startup

You need con configure a systemd service. For that, you need to create a file /etc/systemd/system/firefox-frame.service with this content:

[Unit]
Description=Firefox Display
After=snap.ubuntu-frame.daemon.service
After=getty.target
Conflicts=display-manager.service

[Service]
Type=simple
Environment=HOME=/root
Environment=WAYLAND_DISPLAY=wayland-0
Environment=MOZ_ENABLE_WAYLAND=1
Environment=XDG_RUNTIME_DIR=/run/user/0
Environment=XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
ExecStart=/usr/bin/firefox --kiosk http://www.askubuntu.com
Nice=15

[Install]
WantedBy=default.target

Test this with ("firefox-frame" is the name of your file above)

systemctl daemon-reload
systemctl start firefox-frame

If all is ok, you can enable it definitively with

systemctl enable firefox-frame

PS: I am currently using Debian, with native firefox-esr.

Score:0
cn flag

There are differences between snaps developed for use within a traditional desktop session and those developed for IoT devices.

The Firefox snap is maintained by Mozilla (as can be seen from https://snapcraft.io/firefox) and targets a traditional desktop session (only). So far as I know there is currently no expectation of it working on Ubuntu Core.

Getting Firefox to work as a daemon on Ubuntu Core will need some (re)work of the snap packaging. I doubt the Mozilla team will be interested in doing this work, but I've not asked them.

If you're interested in attempting the repackaging I documented the process and some of the potential issues on this Wiki: Embedding IoT GUI with Ubuntu Frame.

Good luck!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.