From Gentoo Wiki
Jump to:navigation Jump to:search

Firefox is Mozilla's web browser. It is not the same thing as Firefox OS, which was a full operating system.

Aurora is the "unbranded" version of Mozilla's Firefox.


USE flags

USE flags for www-client/firefox Firefox Web Browser

clang Use Clang compiler instead of GCC
dbus Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc)
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
eme-free Disable EME (DRM plugin) cabability at build time
geckodriver Enable WebDriver support
gmp-autoupdate Allow Gecko Media Plugins (binary blobs) to be automatically downloaded and kept up-to-date in user profiles
hardened Activate default security enhancements for toolchain (gcc, glibc, binutils)
hwaccel Force-enable hardware-accelerated rendering (Mozilla bug 594876)
jack Add support for the JACK Audio Connection Kit
lto Enable Link Time Optimization (LTO). Requires Gold linker when using GCC or LDD linker when using Clang
openh264 Use media-libs/openh264 for H.264 support instead of downloading binary blob from Mozilla at runtime
pgo Add support for profile-guided optimization using gcc-4.5, for faster binaries. This option will double the compile time.
pulseaudio Add support for PulseAudio sound server
screencast Enable support for remote desktop and screen cast using media-video/pipewire
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
sndio Enable support for the media-sound/sndio backend
system-av1 Use the system-wide media-libs/dav1d and media-libs/libaom library instead of bundled.
system-harfbuzz Use the system-wide media-libs/harfbuzz and media-gfx/graphite2 instead of bundled.
system-icu Use the system-wide dev-libs/icu instead of bundled.
system-jpeg Use the system-wide media-libs/libjpeg-turbo instead of bundled.
system-libevent Use the system-wide dev-libs/libevent instead of bundled.
system-libvpx Use the system-wide media-libs/libvpx instead of bundled.
system-webp Use the system-wide media-libs/libwebp instead of bundled.
wayland Enable dev-libs/wayland backend
wifi Enable wireless network functions

The above list of USE flag is not comprehensive. Use equery (part of app-portage/gentoolkit) for a full list:

user $equery uses www-client/firefox


To compile the source version of Firefox ESR, issue:

root #emerge --ask www-client/firefox

Be aware that non-ESR versions are not getting stabilized. Stable versions of www-client/firefox-bin may be more recent.

Emerging the source version of Firefox can be a long process; a pre-compiled (binary) version does exist in the Gentoo repository, however users of the pre-built package should note the warning below and this message. To emerge the Firefox binary, issue:

root #emerge --ask www-client/firefox-bin
The disadvantage of using pre-compiled www-client/firefox-bin package is that almost all of the USE flags in the list above cannot be set. Be aware that setting these flags while using this package will not alter the binary.


Running under Wayland

Since Firefox 65, it is possible to run Firefox natively under Wayland by launching it with the GDK_BACKEND=wayland environment variable set after having emerged Firefox with the USE flag wayland enabled. From a terminal:

user $GDK_BACKEND="wayland" firefox

Also, make sure that the generic Wayland environment variables XDG_RUNTIME_DIR, WAYLAND_DISPLAY, and XDG_SESSION_TYPE are exported correctly to ensure that GDK can communicate with the compositor.

To set Firefox to always open using the Wayland backend, set the following environment variable in the user's shell. Bash is the default user shell on Gentoo systems:

FILE ~/.bash_profile
# Enable Wayland support for Mozilla Firefox

Enabling multitouch

Xinput2 scrolling

This brings touch scrolling and multitouch support for Firefox:

MOZ_USE_XINPUT2 environment variable has to be set to a value of 1 in /etc/env.d/80firefox, or just before launching firefox in a shell. for example:

user $MOZ_USE_XINPUT2="1" firefox

This also eliminates the predefined scroll step size for touchpad scrolling! All scrolling will be really smooth.

Wacom tablets/touchscreens may need extra configuration so they emit true touch events for X.

Multitouch zoom

This only works when the multitouch events reach Firefox, therefore the Xinput2 activation above has to be done first.

Description about:config option Value
Multitouch activation gestures.enable_single_finger_input False
Zoom in cmd_fullZoomReduce
Zoom out browser.gesture.pinch.out cmd_fullZoomEnlarge

Middle mouse scroll (autoscroll)

Traditionally in Linux, the middle mouse button is used to paste the currently selected (highlighted) text into a text field. On Windows systems, the middle mouse button in Firefox is used for click-and-drag scrolling up and down the page. This functionality can be enabled in Firefox by opening about:config and setting the following value[1]:

  • general.autoScroll = true

Middle click-and-drag scrolling should now be enabled.

Although not necessary, sometimes it is desirable to disable all other middle-click functionality within Firefox when using click-and-drap scrolling. Open about:config and set the following values to disable middle-click functionality:

  • middlemouse.contentLoadURL = false
  • middlemouse.openNewWindow = false
  • middlemouse.paste = false


Firefox >= 54 has 4 threads enabled by default. Threads can be adjusted by modifying the following in the about:config interface:

Description about:config option Value
Increase the threads dom.ipc.processCount N

Where N is an integer number.

Audio backend

Firefox's cubeb audio library supports a number of different backends[2][3].

Description about:config option Value
JACK media.cubeb.backend jack

Disabling percent-encoding

Normally, URLs that are copied from the address bar get percent-encoded. This may cause an annoyance when certain non-Latin symbols (such as Cyrillic) get encoded, as they become unreadable to humans.

To disable percent-encoding when copying from the address bar, set the about:config option network.standard-url.escape-utf8 to false.

Unfortunately Firefox does not support non-Latin symbols in anchors, those remain encoded (not percent-encoded, though).

Disable enforced digital signatures verification in Firefox >=48

This concerns mandatory add-ons signature in Firefox and can lead to security issues.

Method 1

Create this file:

FILE /usr/lib/firefox/config.js
try {
  Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {})
catch(ex) {}

Then insert this:

FILE /usr/lib/firefox/defaults/pref/channel-prefs.js
pref("general.config.obscure_value", 0);
pref("general.config.filename", "config.js");

Method 2

Method 3

This patch works for both firefox 49 and firefox 51, and seems to be robust to changes.

FILE /etc/portage/patches/www-client/firefox/no-signature-force-check.patch
--- a/build/mozconfig.common.override 2017-02-06 14:26:05.891721140 +0900
+++ b/build/mozconfig.common.override 2017-02-06 14:25:41.115763755 +0900
@@ -9,3 +9,4 @@
 # to override anything done previously.
 # The common expected usage is for try builds with nondefault options.

The following patch also works for firefox 49.

FILE /etc/portage/patches/www-client/firefox-49.0/no-signature-force-check.patch
diff --git a/browser/ b/browser/
index 7637236..2264bf5 100755
--- a/browser/
+++ b/browser/
@@ -27,7 +27,16 @@ fi
 # Enable building ./signmar and running libmar signature tests
+# Disable 'safe' browsing
+# Disable checking that add-ons are signed by the trusted root
+# Disable enforcing that add-ons are signed by the trusted root

Then set xpinstall.signatures.required to false.

Special URLs

Firefox includes a few dozen special URLs that can be helpful in determining more information about various Firefox settings. These URLs can be entered into the Super Bar (via copy and paste) to view the special pages. A few of the more significant ones include:

  • about:addons - Page for managing extensions.
  • about:buildconfig - Page containing build information about the currently running version of Firefox. Use this page to check what compiler flags were set during Firefox's build.
  • about:cache - Information about the Network Cache Storage Service.
  • about:config - Modify internal browser settings and preferences.
  • about:memory - Measure and show memory reports, free memory, etc.
  • about:networking - Analyze current network information such as HTTP, socket, and DNS connections.
  • about:plugins - List installed plugins such as Widevine Content Decryption Module (DRM software).
  • about:support - A page containing technical information that might be useful when trying to solve a problem. Includes information on WebGL, Window Protocol (X11 or Wayland), and compositing graphics backends.
  • about:telemetry

Finally, about:about will display the whole list of Firefox' “about” pages. A description for each page is available at Firefox and the "about" protocol.

See also Firefox chrome:// document URLs.

XDG integration

In order to make Firefox use XDG file associations set Content Type's Action to /usr/bin/xdg-open

To ensure Firefox is being used by other applications for handling HTTP and HTTPS links, run the following commands:

user $xdg-mime default firefox.desktop x-scheme-handler/http
user $xdg-mime default firefox.desktop x-scheme-handler/https
user $xdg-mime default firefox.desktop text/html

Running under KDE

Firefox is built with GTK, and by default will use the GTK file picker. To enable the KDE file picker, install kde-plasma/xdg-desktop-portal-kde, which is installed by default if kde-plasma/plasma-meta is installed. After that set widget.use-xdg-desktop-portal to true in about:config.


Running in sandbox

Please see Simple sandbox for suggestions on sandboxing Firefox.

SSL/TLS security enhancements

Some about:config SSL/TLS security options which are not defaults (as of Firefox 52.2.0) that increase the security of HTTPS connections are listed below. Two of them rarely break access to websites.

Description about:config option Value
Minimal TLS version set to 1.1. Default is 1 meaning TLS 1.0, unsecure. May break access to some badly configured websites. security.tls.version.min 2
Avoiding old SSL/TLS version. May break access to some badly configured websites. security.ssl.require_safe_negotiation true
Inform user about insecure SSL/TLS negociation (broken padlock). security.ssl.treat_unsafe_negotiation_as_broken true
Require Online Certificate Status Protocol. Introduces some latency. security.OCSP.require true
Strict Certificate Pinning. security.cert_pinning.enforcement_level 2
Don't use DES. security.ssl3.rsa_des_ede3_sha false
Don't use RC4. security.ssl3.rsa_rc4_128_md5 (if present) false
Don't use RC4. security.ssl3.rsa_rc4_128_sha (if present) false
No Google SSL False Start. security.ssl.enable_false_start false

Safer browsing with add-ons

Many users are concerned about their privacy (tracking, bubbling, targeting, etc) while web browsing. Installing Add-ons can aid in adding an extra level of privacy to their browsing.

The add-on menu can be accessed by navigating the following menus: Hamburger button (top right under the X) → Add-ons

Occasionally certain add-ons will use key press event listeners for input from the user. FireFox's "Search for text when I start typing" feature can conflict with key press event listeners used by add-ons. This feature can be disabled by navigating to Hamburger button (top right under the X) → Preferences → Browsing and unchecking the "Search for text when I start typing" option.

uBlock Origin

An ad blocker with lower resource usage, using same lists as Adblock.

Mozilla Add-ons page:




NoScript blocks JavaScript that is normally enabled by default. It can keep users safe and speed up web browsing.

Mozilla Add-ons page:



Point and click to forbid/allow any class of requests made by your browser. Use it to block scripts, iframes, ads, Facebook, etc. uMatrix can also be used for spoofing HTTP referrer, spoofing User Agent strings, blocking hyperlink auditing and forcing strict HTTPS. Note, uMatrix can break many websites and most websites need configuration changes to work correctly.

Mozilla Add-ons page:


Video speed controller

Using an HTML5 video speed controller can be helpful in accelerating the playback rate of HTML 5 video. This is useful when binging video content on sites that do not offer increases in video playback speed (such as Amazon Prime Video or Netflix).

Mozilla Add-ons page:



gtk+:3 pulls in DBUS

Since version ≥53.0, Firefox has dropped gtk+:2 support urging Larry to use gtk+:3. This, however, by default, pulls-in annoyances like DBUS. This can be avoided by using a patch from BSD available in bug #669234 or the mv overlay.

Please note that, when running Firefox under native Wayland (i.e. not using XWayland), Firefox will implicitly try to use DBus to enable its remote control feature and crash, likely with a segfault, due to the lack of DBus. Thus, it is necessary to invoke Firefox with the --no-remote command-line argument or MOZ_NO_REMOTE environment variable set (to anything).


If Firefox crashes for no apparent reason every few minutes with an error message like ABORT: X_GLXDestroyContext: GLXBadContext; 15 requests ago it might help to add the Firefox user(s) to the video group:

root #gpasswd -a <username> video

Lack of sound (www-client/firefox)

If Firefox built with the gstreamer USE flag does not play sounds, and some web sites tell you to install Flash to play music, make sure that the necessary codecs are installed:

root #emerge gst-plugins-meta:1.0

Lack of sound (www-client/firefox-bin)

www-client/firefox-bin expects PulseAudio. Alsa-only systems might work around this limitation by using media-sound/apulse. For this to work you'll need to modify Firefox sandbox settings by going to about:config and adding "/dev/snd/" (note the trailing slash) to "security.sandbox.content.write_path_whitelist" option.

If you're storing ALSA settings in /home, also, be sure to add "/home/<username>/.asoundrc" to the "security.sandbox.content.write_path_whitelist" option. Whitelist path could be separated by comma.

Since around Firefox 58 there is additional modification needed to work around seccomp sandbox: security.sandbox.content.syscall_whitelist = 16

Now you can go ahead and create alias for running firefox through apulse:

user $alias firefox='apulse firefox-bin'

Screen tearing / stuttering smooth scrolling

Build www-client/firefox with USE flag hwaccel. See the mentioned Mozilla bug for background information.

This doesn't work with www-client/firefox-bin as the USE flag is not available.

Green video screen (youtube)

If disabling (graphics) acceleration in settings does not work, disabling the equivalent options under about:config like layers.acceleration.force-enabled (85.0) might.

Windows decorations missing in Fluxbox since FF-91.3.0

See also

  • Thunderbird — Mozilla's solution to the e-mail client.

External resources