Building a snap for a wayland compositor

I’ve been looking but unable to find documentation around what needs to be done to package a wayland compositor, in this case Sway.

First question would be simply is it possible and does it make sense to do?

I thought it seemed like the simplest way to package sway since it depends on some packages that don’t exist in Ubuntu 18.10 even, like json-c 0.13.

Building a snap for it works just fine but running it is where I’m unclear how to move forward. Even in devmode I get an error that the DRM device can not be found. I thought I’d at least be able to run it in devmode and then move forward with figuring out how to define the required privileges to run something like a wayland compositor from a snap.

I know there is a snap wayland interface, so the sway snap should provide that interface? I’m unclear on how that is supposed to be done.

given the mir-kiosk snap is exactly that (a standalone wayland compositor), building any other wayland compositor should indeed be possible too …

the mir-kiosk snap source can be found at:

2 Likes

Oh, thanks! I thought mir-kiosk was a wayland app and not a standalone compositor. I’ll give its configuration a try with the sway snap.

I thought this (using the slots and plugs from mir-kiosk) had solved it, I was able to run sway, but now after upgrading to snapcraft 3.0 to do a clean build on a VM for core18 and trying to run the installed snap I’m again getting:

Unable to create backendDRM device

The change I made was for apps to be:

apps:
  sway:
    command: usr/bin/sway
    slots:
      - wayland
    plugs:
      - opengl

Am I missing something else mir-kiosk is doing?

@alan_g @greyback @Saviq you helped make the Mir snap, are any of you able to help here? :slight_smile:

There might be some extra magic, the people @Ads20000 summoned should be able to help …

How much it makes sense isn’t clear. There is currently no way I see for a launcher to execute other programs installed on the system. (See https://forum.snapcraft.io/t/how-to-confine-a-desktop-shell/6561.)

The (hopefully temporary) approach I’ve taken with snapping egmde is making it a “classic” snap. That has the unfortunate side-effect that it only works on 18.04LTS.

HTH

I just tried snapcraft 3.0 but ran into a bunch of problems I couldn’t resolve quickly. When I have time I’ll dig into what the changes are.

I still have to dig in more but wanted to mention that I’ve now tried classic confinement as well and it actually core dumps when I try to run sway after installing the snap.

You may already know this, but with “classic” things get very fragile unless the build environment, base and runtime environment match up. For example, build on 18.04, core18 & run on 18.04 is a working combination.

classic also limits you to classic systems (server/desktop) where you typically already have a working non-snap compositor available … the use-case of running a kiosk app on top of your compositor under Ubuntu Core will not be possible with a classic snap …

just have some success with classic and devmode here:

But still there is many work todo. Many features inside snapd are actively in development.

I see this old thread reawakening, so I’ll post some notes here.

I’m responsible for three snaps for Wayland compositors:

The current state of art with a confined desktop is described here:

I’ve also been experimenting with solving some of the issues with running a confined desktop.

1 Like

Hi @alan_g,

i just want to publish “weston” as snap.

But it’s name is already registerd… Is it possible to find out, who try to build a snap for ?

I think that’s covered in the docs: