Prototype: A GUI-friendly Snappy

So this is the week of the Ubuntu Online Summit, and many of the sessions are discussing Snappy. As you may know, Snappy is currently pretty geared toward embedded, headless devices. However, it is the successor to Click, and eventually the phones will be based upon it. To drive that effort forward, a few colleagues and I had a session (you can watch the video) where we discussed the path forward for supporting snaps on other devices, specifically the phone and the desktop.

As Alejandro mentioned in the video, the current packaging situation sucks, and we know it. Application developers have to package their application as .deb for the desktop, .click for the phone, and .snap for embedded devices. Debian packaging isn't going away-- we'll always be based on Debian, but the current situation can be improved.

Check out the first part of the video for the session. I gave a demo of a prototype tool that allows snaps to be installed and run alongside .debs and .clicks on both the phone and the desktop. Eventually we'd like Snappy to include such functionality, but until then, you can experiment with this yourself. We provided a link in IRC for a tutorial that walks you through exactly what I did in the video, but if you're watching the video after the fact you probably didn't get it. This post is for you.

The result of the prototyping is called "Crackly" (snap... crackle... nevermind). It's a wrapper around Snappy introducing some other limited functionality. Note that Crackly is not a product we're proposing, simply a tool that enables our prototype, allowing Snaps to run transparently alongside .clicks (or .debs). It'll go away as it's superannuated by features in Snappy.

This tutorial will walk you through installing and using Crackly. It has been tested on the current phone image and a Unity7-based Vivid desktop install.

  1. Setup the Crackly PPA:
    $ sudo apt-add-repository ppa:kyrofa/crackly
    $ sudo apt-get update

  2. Install Crackly:
    $ sudo apt-get install crackly
    That should pull in the relevant dependencies and install two binary utilities: the snappy CLI and crackly CLI. For this tutorial you won't be using the snappy CLI directly (it's used to drop privileges when unpacking the .snap), you'll be using crackly.

  3. You won't be able to reach the Snappy store by default, so you'll have to download (or create) a snap which you can sideload. Crackly specifically disallows installing services (since the phones are using Upstart, among other reasons), so make sure it only has binaries. If you don't feel like making one, I made one for you, you just have to build it into a snap:
    $ git clone https://github.com/kyrofa/calculator-snap
    $ cd calculator-snap
    $ snappy build .
    You'll end up with snappy-calculator_2.0.182.1_multi.snap, which can be installed on both armhf and amd64 (it's QML-- update the package.yaml if you want more architectures). Transfer it to the device on which Crackly is installed.

  4. On the device with Crackly, install the prerequisite for the calculator app (not necessary on the phone):
    $ sudo apt-get install qmlscene

  5. Now install the calculator snap:
    $ sudo crackly install snappy-calculator_2.0.182.1_multi.snap

  6. Finally, you should be able to open the dash (on Unity7) or the app scope (on Unity8), and you'll notice a new calculator app (with the icon from the QML calculator) which you should be able to launch. Doing so will run the app under the control of Ubuntu Core Launcher, exactly like any other Snappy-based system.

Limitations

There are a number of limitations to be aware of when experimenting with this prototype:

  • Crackly functionality is limited to installing/removing. No update or hw-assign is available, for example.
  • If you're running this on a current phone image, you'll need it mounted read/write rather than read-only.
  • If you're running this on the current phone image, unless you're using an arale (or newer) your kernel won't support seccomp filters until OTA9. This is an important part of the Snappy confinement model and Ubuntu Core Launcher will refuse to launch without it. As a workaround, included in the Crackly PPA is an Ubuntu Core Launcher with a patch applied to launch even if seccomp filters aren't available (note that this is an unofficial patch and will not be released).
  • The calculator snap discussed above currently runs unconfined for various reasons. Still working on that bit.

Comments

Nice! Keep coming with new posts related to snappy Core, embedded devices and GUI seems really interesting if I could install apps on embedded devices then we can make an app store for IOT.
And is it possible to run GUI application on ubuntu core for embedded purposes by installing mir or x11?

By pyros2097

Reply

Our interests align! More posts will be coming as we make progress :) . Feel free to subscribe if you don't want to have to check back periodically!

Right now it's only possible to run a GUI application contained within a Snappy package on an actual Snappy-based system if that system is running on the amd64 architecture. The reason is because the Mir framework has so far only been made for amd64 (not arm etc.). You can do it on a non-Snappy-based system using Crackly as described in the post, but that's only because X/Mir can be provided by the OS. We're working on bringing the Mir framework to other architectures, though.

Also note that we're currently working on moving the functionality contained within Crackly into Snappy proper, so we're definitely making progress on this issue.

By Kyle

Reply