Try out Firefox on Wayland easily

Today I finally managed to compile and run a Firefox version, which was patched to work on Wayland natively. To achieve this, I used the forked and enhanced Firefox version of the Red Hat developer Martin Stransky.

For all those who are unaware of the Wayland project, it’s an succesor to the very old, but still common X display server for Linux operating systems. Compared to X, Wayland is a lot smaller in its code base, written from scratch, far more secure and build up on the newest 3D graphic driver stack. Unfortunately not all big Linux applications support it yet. The work on Wayland compatibility for Firefox was already requested some years ago and it was not moving forward very fast. Fortunately, some days ago it looks like the first patches have been merged into master.

Firefox running natively on Wayland using ArchLinux x64

So again, I gave it a try and this time my buildscript, which I submitted to the AUR compiled fine and I also was able to run Firefox without using xwayland :) So here are the few steps to get it working (in this case I’m using pacaur as an AUR helper script):

pacaur -S firefox-wayland-git
GDK_BACKEND=wayland firefox

As expected it is not stable nor usable yet but at least it is a proof that the Firefox developers getting closer to solving this issue and are still working on it!

Even easier: Test it with precompiled and sanboxed Flatpak-Repo

Further, I was testing out Flatpak, a project of the Gnome Foundation, which is a kind of cross-Linux package manager for precompiled packages and also provides a very useful sandboxing approach.

So why not build a Firefox Flatpak with Wayland patches so it is even easier for others to try out on all the operating systems without having to always recompile it (which would take many hours and consume a lot of memory …). First I forked a custom Firefox Flatpak repository on Github from the user kinvolk (thanks!) and customized it to compile Martin Stranskys repository with Wayland patches. I had to be sure that the systems Wayland socket is accessible inside the sandbox, which was already the case.

Well, and that’s how you can test the Flatpak (assumed you have a Flatpak client already installed):

flatpak --user remote-add --no-gpg-verify firefox-wayland-git https://onny.project-insanity.org/files/firefox-wayland-git/repo
flatpak --user install firefox-wayland-git org.mozilla.firefox
flatpak --env GDK_BACKEND=wayland run org.mozilla.firefox

That’s it, Firefox should start on your Wayland desktop! Please note that this might run even slower here, especially because it was build in debug mode.

Update 01.2018: This article was featured on the popular US open source news site Phoronix in February 2017.

💬 Are you interested in our work or have some questions? Join us in our public Signal chat pi crew 👋
🪙 If you like our work or want to supprot us, you can donate MobileCoins to our address.

Comments

  1. Thanks for doing this!
    I noticed a small typo in firefox.flatpakref.in:

    [Flatpak Ref]
    Title=vlc

    Maybe the title should be “Firefox”?

  2. Hi,

    i’ve installed it via flatpack on Fedora 25 and get this error:

    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173

    any hint on what could it be?

  3. Any chance you could just sign that package to avoid the need to siable the gpg verification?

  4. @Federico: Okay than maybe it helps starting Firefox with a fresh profile. Even the Flatpak app is sandboxed, it is still configured to access your home directory and your usual Firefox profile. So you could move and backup your .mozilla directory temporarly or start Firefox with “-p” for the profile manager.
    Further issues can be reported to the bug report here: https://bugzilla.mozilla.org/show_bug.cgi?id=635134 .

  5. @onny, tried both with the “-p” switch and removing my .mozilla directory with the same exact error.
    I’m going to open an bug report!

    thanks a lot for the package and for the support so far :)

  6. Have same error in fedora 25.
    Really the situation is:
    fedora’s comand line do not understand what is “–env GDK_BACKEND=wayland” if to delete it – you get an error

    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173

  7. I am not sure, but I think the command have to be
    GDK_BACKEND=’wayland’ flatpak run org.mozilla.firefox

  8. It segfaulted for me too in Xorg but worked ‘fine’ under Wayland.

    And as Stanislav pointed out, you have a typo in the command, flatpak has a –foo=bar syntax (note the equals sign).

  9. It seems that the run command should be fixed:

    flatpak run –env=GDK_BACKEND=’wayland’ org.mozilla.firefox

    Otherwise, flatpack complains that it doesn’t know the `–env` command or that there is no enough parameters to `–env`. However, even after this, I am getting the same assertion as reported above:

    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173

    I am on latest Arch Linux running Gnome 3.22.3 on Wayland. I have tried to install FireFox using sudo and `flatpak –user`, but it is just the same. Here is what I went through:

    $ sudo pacman -S flatpak
    $ flatpak remote-add –user –from gnome https://sdk.gnome.org/gnome.flatpakrepo
    $ flatpak remote-add –user –from gnome-apps https://sdk.gnome.org/gnome-apps.flatpakrepo
    $ flatpak remote-add –user –no-gpg-verify firefox-wayland-git https://onny.project-insanity.org/files/firefox-wayland-git/repo
    $ flatpak –user install firefox-wayland-git org.mozilla.firefox
    $ flatpak run –env=GDK_BACKEND=wayland org.mozilla.firefox
    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173

    Then I have tried to do that same with sudo:

    $ sudo flatpak remote-add –from gnome https://sdk.gnome.org/gnome.flatpakrepo
    $ sudo flatpak remote-add –from gnome-apps https://sdk.gnome.org/gnome-apps.flatpakrepo
    $ sudo flatpak remote-add –no-gpg-verify firefox-wayland-git https://onny.project-insanity.org/files/firefox-wayland-git/repo
    $ sudo flatpak install firefox-wayland-git org.mozilla.firefox
    $ flatpak run –env=GDK_BACKEND=wayland org.mozilla.firefox
    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173
    $ sudo flatpak run –env=GDK_BACKEND=wayland org.mozilla.firefox
    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173

    Even –help doesn’t work:

    $ sudo flatpak run –env=GDK_BACKEND=wayland org.mozilla.firefox –help
    Assertion failure: false, at /run/build/firefox/security/sandbox/linux/SandboxInfo.cpp:173

    NOTE: “–env=GDK_BACKEND=wayland” doesn’t change a thing.

Leave a Reply

Your email address will not be published. Required fields are marked *