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.

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

[Flatpak Ref]
Title=vlc

Maybe the title should be “Firefox”?

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?

@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 .

@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 :)

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

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

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).

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.

14 Comments

Leave a Reply

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

* Checkbox GDPR is required

*

I agree

Software
Virtual 3D online exhibition with MapBox GL JS

For my last semester in university (summer semester 2018) at the KIT, I was part of a project to create an “online art exhibition”. We planned to produce different media formats in smaller groups. One for video, another for text and promotion and one for the online presence. I’ve figured …

Software
Host your own Mapbox GL JS vector tiles map

I’ve done some research recently on how I could host my own online map viewer with a MapBox GL JS instance, an excellent and modern open-source alternative for Google Maps. The server should also serve own preprocessed map data from OpenStreetmap planet extracts. No external or third-party service will be …

Software
1
Easily setup Signal 2FA on Nextcloud 14

Two-factor authentication (short 2FA) is an important security concept to secure unauthorized access to your web applications. Popular online services like Google Mail, Instagram or Facebook already provide this mechanism to secure user accounts with an additional one-time token. Considering someone is able to obtain your username and password combination, …