Libertine is software suite for runnin X11 apps in non-X11 environments and installing deb-based applications on a system without dpkg. Snappy is a package management system to confine applications from one another. Wouldn’t it be cool to run libertine as a snap?
Yes. Yes it would.
snapd
The first thing to install is snapd itself. You can find installation instructions for many Linux distros at snapcraft.io, but here’s the simple command if you’re on a debian-based operating system:
1
|
|
Ubuntu users may be surprised to find that snapd is already installed on their systems. snapd is the daemon for handling all things snappy: installing, removing, handling interface connections, etc.
lxd
We use lxd as our container backend for libertine in the snap. lxd is essentially a layer on top of lxc to give a better user experience. Fortunately for us, lxd has a snap all ready to go. Unfortunately, the snap version of lxd is incompatible with the deb-based version, so you’ll need to completely remove that before continuing. Skip this step if you never installed lxd:
1 2 3 4 |
|
For installing, in-depth instructions can be found in this blog post by one of the lxd devs. In short, we’re going to create a new group called lxd
, add ourselves to it, and then add our own user ID and group ID to map to root within the container.
1 2 3 4 5 6 |
|
We also need to initialize lxd manually. For me, the defaults all work great. The important pieces here are setting up a new network bridge and a new filestore for lxd to use. You can optionally use zfs if you have it installed (zfsutils-linux
should do it on Ubuntu). Generally, I just hit “return” as fast as the questions show up and everything turns out alright. If anything goes wrong, you may need to manually delete zpools, network bridges, or reinstall the lxd snap. No warranties here.
1 2 3 4 5 6 7 8 9 10 11 |
|
You should now be able to run lxd.lxc list
without errors. It may warn you about running lxd init
, but don’t worry about that if your initialization succeeded.
libertine
Now we’re onto the easy part. libertine
is only available from edge
channels in the app store, but we’re fairly close to having a version that we could push into more stable channels. For the latest and greatest libertine:
1 2 |
|
If we want libertine to work fully, we need to jump through a couple of hoops. For starters, dbus-activation is not fully functional at this time for snaps. Lucky for us, we can fake this by either running the d-bus service manually (/snap/bin/libertined
), or by adding this file to /usr/share/dbus-1/services/com.canonical.libertine.Service.service
1 2 3 |
|
Personally, I always create the file, which will allow libertined to start automatically on the session bus whenever a user calls it. Hopefully d-bus activation will be fixed sooner rather than later, but this works fine for now.
Another issue is that existing deb-based libertine binaries may conflict with the snap binaries. We can fix this by adjusting PATH
in our .bashrc
file:
1 2 |
|
This will give higher priority to snap binaries (which should be the default, IMO). One more thing to fix before running full-force is to add an environment variable to /etc/environment
such that the correct libertine binary is picked up in Unity 8:
1 2 |
|
OK! Now we’re finally ready to start creating containers and installing packages:
1 2 3 4 |
|
If you want to launch your apps in Unity 7 (why not?):
1 2 |
|
When running Unity 8, your apps should show up in the app drawer with all the other applications. This will all depend on libertined running, so make sure that it runs at startup!
I’ve been making a lot of improvements on the snap lately, especially as the ecosystem continues to mature. One day we plan for a much smoother experience, but this current setup will let us work out some of the kinks and find issues. If you want to switch back the deb-based libertine, you can just install it through apt
and remove the change to /etc/environment
.