Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 835078

Summary: www-client/firefox-98.0: Crashes with hwaccel + nouveau drivers
Product: Gentoo Linux Reporter: Simeon Simeonov <sgs>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED FIXED    
Severity: normal CC: gentoo, ionen, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Simeon Simeonov 2022-03-13 14:07:24 UTC
www-client/firefox-98.0 crashes with:

[sgs@Desktop ~]$ firefox
ATTENTION: default value of option mesa_glthread overridden by environment.
libEGL warning: DRI2: failed to authenticate
ATTENTION: default value of option mesa_glthread overridden by environment.
Exiting due to channel error.

The problem seems to be described here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1744389

The USE flags are:
USE="clang dbus hwaccel lto openh264 pgo pulseaudio system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-webp wayland -debug -eme-free -geckodriver -gmp-autoupdate -hardened -jack -libproxy -screencast (-selinux) -sndio (-system-av1) -system-png -wifi"

Reproducible: Always




[root@Blackmore ~]# emerge --info
Portage 3.0.30 (python 3.10.2-final-0, default/linux/amd64/17.1/no-multilib, gcc-11.2.1, glibc-2.33-r13, 5.16.14 x86_64)
=================================================================
System uname: Linux-5.16.14-x86_64-Intel-R-_Core-TM-_i7-5820K_CPU_@_3.30GHz-with-glibc2.33
KiB Mem:    16294900 total,  10974612 free
KiB Swap:   16777212 total,  16626940 free
Timestamp of repository gentoo: Sun, 13 Mar 2022 10:00:01 +0000
Head commit of repository gentoo: b94e51fbcf381f2ff91059d04429023cf7473e26
Timestamp of repository sgs: Sun, 20 Feb 2022 15:51:45 +0000
Head commit of repository sgs: 70ac57914aa05747fb62bb8b6679f46d46aab69f

sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p2) 2.37
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.34.0-r6::gentoo
dev-lang/python:           3.9.9-r1::gentoo, 3.10.2_p1::gentoo
dev-lang/rust:             1.59.0::gentoo
dev-util/cmake:            3.22.2::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.7-r3::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.25::gentoo
sys-devel/autoconf:        2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.4::gentoo
sys-devel/binutils:        2.37_p1-r2::gentoo
sys-devel/binutils-config: 5.4::gentoo
sys-devel/clang:           13.0.1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/lld:             13.0.1::gentoo
sys-devel/llvm:            13.0.1::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.33-r13::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

sgs
    location: /var/db/repos/sgs
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/sgs.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE all-rights-reserved free-noncomm unRAR NPSL NVIDIA-r2 Skype-TOS"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=haswell -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=haswell -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=n"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_BZIP2_COMMAND="/bin/bzip2"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acpi alsa amd64 bash-completion bindist bluetooth bluray branding bzip2 cairo cdda cdr cli crypt cups custom-cflags dav1d dbus dri dts dvd dvdr elogind emboss encode exif fam ffmpeg flac fortran fuse gdbm gif glamor gpm gtk gtk3 gtk4 http2 iconv icu ipv6 jpeg jpeg2k lcms libglvnd libnotify libtirpc lto mad mng mp3 mp4 mpeg ncurses nls nouveau nptl ogg opengl openmp pam pango pcre pdf pgo png ppds python qt qt5 readline schroedinger sdl seccomp secure-delete smp spell split-usr ssl startup-notification svg theora threads threadsafe tiff truetype type1 udev unicode upower usb v4l v4l2 vdpau vorbis vpx wavpack wayland wxwidgets x264 x265 xattr xcb xml xv xvid xvmc zlib {USE}" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard libinput mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="luajit" LUA_TARGETS="luajit" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Larry the Git Cow gentoo-dev 2022-03-14 16:26:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0bcab291020e064d08220f5c260b1924ae5d0a0

commit f0bcab291020e064d08220f5c260b1924ae5d0a0
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2022-03-14 16:14:44 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-03-14 16:26:17 +0000

    www-client/firefox: add 98.0.1
    
    Bug: https://bugs.gentoo.org/835078
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest              |   98 +++
 www-client/firefox/firefox-98.0.1.ebuild | 1248 ++++++++++++++++++++++++++++++
 2 files changed, 1346 insertions(+)
Comment 2 Joonas Niilola gentoo-dev 2022-03-14 16:29:46 UTC
I'm going to try and reproduce this tomorrow, but maybe https://hg.mozilla.org/releases/mozilla-release/rev/ef9d9b4804f31c7f55401ab50942a331e0c050b5 is related, which landed on 98.0.1.
Comment 3 Ionen Wolkens gentoo-dev 2022-03-14 17:12:00 UTC
Maybe this could be related too given it started being used in the 98.0 ebuild?

--- gentoo-hwaccel-prefs.js
+++ gentoo-hwaccel-prefs.js-r1
@@ -1,3 +1,5 @@
 /* Force hardware accelerated rendering due to USE=hwaccel */
 pref("layers.acceleration.force-enabled",  true);
 pref("webgl.force-enabled",                true);
+pref("gfx.webrender.all",                  true);
+pref("gfx.x11-egl.force-enabled",          true);
Comment 4 Simeon Simeonov 2022-03-15 16:17:58 UTC
98.0.1 didn't fix the problem for me.
Comment 5 Joonas Niilola gentoo-dev 2022-03-16 08:52:29 UTC
So, "works for me". I guess this is somehow related to nouveau and/or running a stable gentoo with unstable firefox. 

As ionen mentioned, you should first try to disable the new hwaccel setting:
Modify /usr/lib64/firefox/browser/defaults/preferences/gentoo-prefs.js to have 
-pref("gfx.x11-egl.force-enabled",          true);
+pref("gfx.x11-egl.force-disabled",          true);

Then you should emerge mesa-progs with +egl +gles2 and see eglinfo. Check for any "failed" output to see your system supports and has a working egl. I guess it could also be that nouveau doesn't support recent enough gles? Try glxinfo| grep '^OpenGL'

You can try:
MOZ_X11_EGL=1 firefox

or emerging firefox with USE -hwaccel.

Anyway I'm thinking maybe gfx.x11-egl.force-disabled needs to be disabled again.
Comment 6 Simeon Simeonov 2022-03-17 21:38:58 UTC
Thank you for the tip!

Firefox 98.0.1 stopped crashing on startup after setting:
ref("gfx.x11-egl.force-disabled",          true);
Comment 7 Joonas Niilola gentoo-dev 2022-03-18 06:14:04 UTC
Thanks for reporting back. Maybe for the next version we'll do 
----------
if has_version x11-drivers/xf86-video-nouveau; then
	echo "ref(\"gfx.x11-egl.force-disabled\",          true);" >> prefs
else
	echo "ref(\"gfx.x11-egl.force-enabled\",          true);" >> prefs
fi

pkg_postinst() {
	if has_version x11-drivers/xf86-video-nouveau; then
		elog "You have nouveau drivers installed, it doesn't support required"
		elog "EGL and therefore 'gfx.x11-egl.force-disabled' has been set for you."
	fi
}
----------
Something like this then.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-18 06:20:45 UTC
The problem with that is that you can't know if the target system will have the same video drivers as the system which built it -- i.e. it's automagic based on system configuration, just in a different way than usual.

You'd need to add almost-no-op USE=video_cards_novueau or similar :(
Comment 9 Ionen Wolkens gentoo-dev 2022-03-18 06:35:20 UTC
Good to keep a warning either way, i.e. I have a system with VIDEO_CARDS="nvidia nouveau" where nouveau is typically not in-use.
Comment 10 Joonas Niilola gentoo-dev 2022-03-18 06:45:42 UTC
Yeah I also thought if it's kept as a "backup" in case nvidia doesn't work, would suck. 

Back to the drawing board then!
Comment 11 Joonas Niilola gentoo-dev 2022-03-18 07:06:06 UTC
(also need to remember it's related to hwaccel+nouveau with conditions)
Comment 12 Larry the Git Cow gentoo-dev 2022-03-23 13:05:06 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6036664650f952b65dda40c7bffd8a5b5f44a05

commit c6036664650f952b65dda40c7bffd8a5b5f44a05
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2022-03-23 12:59:24 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-03-23 13:05:03 +0000

    www-client/firefox: add 98.0.2
    
     - add a patch for dav1d-1.0.0,
     - add a warning for users with hwaccel+nouveau.
    
    Closes: https://bugs.gentoo.org/835078
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest              |   99 +++
 www-client/firefox/firefox-98.0.2.ebuild | 1256 ++++++++++++++++++++++++++++++
 2 files changed, 1355 insertions(+)