Shell hacking on Silverblue

It has been a while now that I switched to Fedora Silverblue as my primary operating system, and I really dig the separation of using

  • an immutable operating system
  • flatpak for graphical applications
  • toolbox for non-graphical development

You probably know that flatpak is not only a great option for running graphical applications, but also for developing them — in particular when using the amazing GNOME Builder.

It is however not an option for developing core desktop components like gnome-shell — sadly old-fashioned JHBuild is still the tool of choice there. And on Silverblue, the cleanest option for installing that tool is inside a toolbox container.

The whole process is not completely straight-forward and took me a while to figure out, which is why I’m now sharing it in this friendly service blog.

Creating a toolbox

Fortunately that first step is easy enough:

host$ toolbox create --container jhbuild
host$ toolbox enter --container jhbuild

Installing jhbuild

Next we need to install jhbuild inside the toolbox. That process is not fundamentally different from installing it on a traditional distribution like Fedora Workstation, except for one caveat: The jhbuild sysdeps command relies on PackageKit, which is not available inside the container.

Using dnf builddep is one way to get around that, I opted for a small helper script that automates the jhbuild setup:

toolbox$ ./sb-jhbuild-setup.sh gnome-shell

Setting it up to run gnome-shell

We can now use jhbuild to build GNOME modules, just like we would do normally ((And as normally, we install any missing dependencies that we run into, while cursing at the computer in despair)):

toolbox$ jhbuild build --skip=WebKit gnome-shell

For most modules, we are done now — we can simply run them through jhbuild run inside the toolbox.

Big surprise though: That doesn’t apply to running a wayland compositor like gnome-shell. We need quite a bit more there, namely

  • suitable graphics drivers
  • access to the “real” /tmp directory
  • access to the host’s logind

Graphics drivers are a relatively easy problem to fix, we just need to install the correct package. And for the last two items, toolbox thankfully makes the host filesystem available under /run/host inside the container.

As you may have guessed: There’s another script to automate those steps, which then allows us to run gnome-shell in nested mode:

toolbox$ su -c ./sb-gnome-shell-setup.sh
toolbox$ jhbuild run dbus-run-session gnome-shell --wayland --nested

Setting up a jhbuild session

In a lot of cases, nested mode is good enough for testing changes. But sometimes we really want to test a full session.

With some help from this excellent guide, here’s a last script which sets up a dedicated JHBuild session that can be selected at login time:

host$ ./sb-session-setup.sh

And that’s it!

All scripts mentioned in this post are available on my GNOME GitLab ((as well as a couple of convenience wrappers)); issues and merge requests are open, in case you have any suggestions.

This entry was posted in Uncategorized. Bookmark the permalink.