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.
- Setup the Crackly PPA:
$ sudo apt-add-repository ppa:kyrofa/crackly
$ sudo apt-get update
- Install Crackly:
$ sudo apt-get install cracklyThat 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.
- 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-snapYou'll end up with snappy-calculator_184.108.40.206_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.
$ cd calculator-snap
$ snappy build .
- On the device with Crackly, install the prerequisite for the calculator app (not necessary on the phone):
$ sudo apt-get install qmlscene
- Now install the calculator snap:
$ sudo crackly install snappy-calculator_220.127.116.11_multi.snap
- 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.
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.