Run GNOME Shell in a Container

One major issue with developing high-quality GNOME Shell extensions is the lack of continuous integration possibilities. So I thought: Why not try getting GNOME Shell running on the runners of GitHub Actions?

Of course I know that this is exactly what Docker or Podman are not designed to be used for…

What already works:

But I came pretty far already! Feel free to have a look at this repository for the Dockerfile and some usage examples. What I achieved so far:

  • Run GNOME Shell in a Podman container.
  • Run other applications, like gnome-control-center.
  • Capture a screenshot and transfer it to host memory.
  • This works both, locally on my machine and on a GitHub hosted runner.

What works not:

The only missing puzzle-piece seems to be that GNOME Shell fails to load any extensions in this setup (which is a pity since this is the thing I am mostly interested in :smiley: )!

gnome-shell prints the following messages when being launched in the container:

Xlib:  extension "DPMS" missing on display ":99".

(gnome-shell:124): mutter-WARNING **: 08:17:02.384: Failed to use linear monitor configuration: Invalid mode 1600x900 (-nan) for monitor 'unknown unknown'

(gnome-shell:124): mutter-WARNING **: 08:17:02.384: Failed to use fallback monitor configuration: Invalid mode 1600x900 (-nan) for monitor 'unknown unknown'
Xlib:  extension "DPMS" missing on display ":99".
portal is not running: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.portal.IBus exited with status 1
GNOME Shell-Message: 08:17:03.217: Telepathy is not available, chat integration will be disabled.

(gnome-shell:124): Gjs-WARNING **: 08:17:03.292: JS ERROR: Could not load extension ubuntu-dock@ubuntu.com: Error: Missing metadata.json
createExtensionObject@resource:///org/gnome/shell/ui/extensionSystem.js:281:19
_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:594:34
collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17
_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:574:19
_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:608:18
_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:639:18
init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14
_initializeUI@resource:///org/gnome/shell/ui/main.js:257:22
start@resource:///org/gnome/shell/ui/main.js:146:5
@<main>:1:47

GNOME Shell-Message: 08:17:03.914: GNOME Shell started at Wed Jan 27 2021 08:17:03 GMT+0000 (UTC)
GNOME Shell-Message: 08:17:03.923: Registering session with GDM
GNOME Shell-Message: 08:17:03.942: Error registering session with GDM: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.DisplayManager was not provided by any .service files

Both, the Ubuntu-Dock-Error and the GDM-Error are not fatal (I guess). The can be resolved by enabling the GDM service and by removing the directory /usr/share/gnome-shell/extensions/ubuntu-dock@ubuntu.com which contains a CSS file only (ubuntu-desktop is not installed in the image).

Starting gnome-extensions-app in the container gives this error:

(gnome-extensions-app:386): Gjs-WARNING **: 08:02:08.164: JS ERROR: Gio.DBusError: Error calling StartServiceByName for org.gnome.Shell.Extensions: Process org.gnome.Shell.Extensions exited with status 1
_injectToMethod/klass[method]@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:290:25
_makeProxyWrapper/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:267:17
vfunc_startup@resource:///org/gnome/Extensions/js/main.js:69:28
main@resource:///org/gnome/Extensions/js/main.js:503:23
run@resource:///org/gnome/gjs/modules/script/package.js:222:19
start@resource:///org/gnome/gjs/modules/script/package.js:206:5
@/usr/share/gnome-shell/org.gnome.Extensions:1:17

Gjs-Message: 08:02:08.164: JS WARNING: [resource:///org/gnome/Extensions/js/main.js 51]: reference to undefined property "_shellProxy"

(gnome-extensions-app:386): Gjs-WARNING **: 08:02:08.164: JS ERROR: TypeError: this._shellProxy is undefined
vfunc_activate@resource:///org/gnome/Extensions/js/main.js:51:9
main@resource:///org/gnome/Extensions/js/main.js:503:23
run@resource:///org/gnome/gjs/modules/script/package.js:222:19
start@resource:///org/gnome/gjs/modules/script/package.js:206:5
@/usr/share/gnome-shell/org.gnome.Extensions:1:17

The complete output of journalctl

As it’s pretty long but may be helpful, I uploaded the output of journalctl as a Gist: Log output of GNOME Shell Pod · GitHub.

Does anybody have a suggestion how I could approach this last issue?

Thank you very much! And if you know a better place to ask this nerdy question - please point me to it!

2 Likes

(gnome-extensions-app:386): Gjs-WARNING **: 08:02:08.164: JS ERROR: Gio.DBusError: Error calling StartServiceByName for org.gnome.Shell.Extensions: Process org.gnome.Shell.Extensions exited with status 1

org.gnome.Shell.Extensions is a small D-Bus service that provides the shell’s extension API to the app and opens the extension prefs dialogs on its behalf. It can’t do anything useful without the service, and apparently the code that deals with its absence (by showing a “sorry this cannot work” UI) doesn’t handle the case where the service exists, but errors out immediately on start.

Maybe running the service manually in the terminal with

gjs /usr/share/gnome-shell/org.gnome.Shell.Extensions

provides some hint on what is going wrong?

(Neither the app nor the service are needed for loading extensions, so if that doesn’t work either, then that’s a separate issue)

Both, the Ubuntu-Dock-Error and the GDM-Error are not fatal (I guess).

That’s correct BTW. The former is about a corrupt extension and doesn’t affect gnome-shell or other extensions. The latter signals to GDM that the graphical session was started successfully, so it can tear down background processes etc.; it’s not relevant when not running under GDM.

Oh, and you should get in contact with the extensions rebooted project :smiley:

1 Like

Great news, it’s working now (mostly)!

Extension loading worked before (as you guessed); I am not sure why I came to the conclusion that it didn’t…
Running gjs /usr/share/gnome-shell/org.gnome.Shell.Extensions manually simply works. Afterwards I can also open the extensions app. I tried running GNOME Shell a few seconds after booting to make sure that there is not timing issue but the service needs to be started manually regardless.

But anyways; here’s a screenshot from Fly-Pie opened in a headless GNOME Shell:

I wasn’t aware that there is already code for the extensions-rebooted project - great to see this! I’ll see whether I can contribute there.

If you want to, we could try to figure out why the aforementioned service is not started automatically. But it does not seem to be required for my purpose.

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.