Using Firefox/Wayland on Mir servers

Firefox will work “out of the box” on Mir servers that are configured to support X11 applications. But Firefox has support for Wayland and it would be good to enable this.

There are a couple of things that need doing for Firefox to use Wayland on Mir servers:

  1. It needs MOZ_ENABLE_WAYLAND set in the Firefox environment.
  2. Secondly, it needs gfx.webrender.all set to true in the user options of the current profile.

While the latter can be set in the Firefox GUI I found it convenient to write a script that patches all profiles:

$ cat `which`

if [ -f prefs.js ]; then
  echo Checking profile \'$(pwd)\'

  if [ ! -f user.js ] || ! grep -q "gfx.webrender.all" user.js; then
    echo Fixing user.js for profile \'$(pwd)\'
    echo 'user_pref("gfx.webrender.all", true);' >> user.js
  find ~/.mozilla/firefox/ -name prefs.js -execdir $0 \;

I hope you find this useful.

1 Like

Is it possible for you provide an example snap yaml? Or is there some doc/template I can follow to write a snap for firefox?


I am trying to bulid a mir-kiosk firefox snap.

name: mir-firefox
version: '0.1'
summary: GLMark2 IoT example kiosk
description: GLMark2 IoT example kiosk, using Wayland
base: core18
confinement: devmode
grade: devel

    command: "/snap/firefox/current/firefox"
    -  opengl
    -  wayland

    plugin: nil
      - firefox

After compiling the snap and running it. I get this in the terminal. The firefox actually starts in a new window not in the mir-kiosk window.

ake@jake-Parallels-Virtual-Platform:~$ snap run mir-firefox

(firefox:21789): Gtk-WARNING **: 21:04:52.733: Locale not supported by C library.
	Using the fallback 'C' locale.

(firefox:21789): GdkPixbuf-WARNING **: 21:04:52.909: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
Gtk-Message: 21:04:52.950: Failed to load module "canberra-gtk-module"
Gtk-Message: 21:04:52.955: Failed to load module "canberra-gtk-module"

This file exists in /var/lib/snapd/hostfs/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0

I tried to add the path to the snap. I get this error during compiling. I don’t have idea what to do. Can you help?



I am making a little progress.

I understand the error means the /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache does not exist. I can make a new loaders.cache by running gdk-pixbuf-query-loaders

    command: "/snap/firefox/current/firefox"
    -  home
    -  desktop
    -  opengl
    -  wayland

    plugin: nil
      - firefox
    override-build: |
# this will not work since $SNAP is read only file system
      /root/parts/firefox/install/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > $SNAP/loaders.cache 

      bind: $SNAP

where should I save the loaders.cache?

There are various options, here’s a similar problem being addresses recently:

@alan_g the error is gone. But the firefox is not opened in side the mir-kiosk window. What should do I now?

@zhex900 you need to figure out how to get firefox to connect to the Wayland socket provided by mir-kiosk. From your description any of the following could be happening:

  1. firefox isn’t starting
  2. firefox is starting, connecting to the X11 socket provided by your desktop environment and appearing on your desktop
  3. firefox is starting, connecting to the Wayland socket provided by your desktop environment (if any) and appearing on your desktop

You have to figure out which of these is happening and what to do about it.

In all these possibilities your problems are related to the snap you are building, and not to Mir. If that’s the case, they are better discussed as a new “Problems snapping firefox” thread on the snapcraft forum. Not here.

Thank you for your help. I have some direction now.