gnome-shell crashes (fatal error logged in create_fallback_offscreen) when attempting to enable second monitor on second GPU (Nvidia >= 495) in a Wayland session

Bug #1964037 reported by Chris Halse Rogers
118
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Mutter
Fix Released
Unknown
OEM Priority Project
Fix Released
Critical
jeremyszu
mutter (Ubuntu)
Fix Released
High
Daniel van Vugt
nvidia-graphics-drivers-495 (Ubuntu)
Won't Fix
High
Unassigned
nvidia-graphics-drivers-510 (Ubuntu)
Won't Fix
High
Unassigned

Bug Description

This is on my weird desktop setup, with one monitor plugged into an AMD card and one into an NVIDIA card.

When using the Wayland session, by default Shell will come up on the monitor connected to the AMD card, and the second (NVIDIA) monitor will be blank. Attempting to enable the second monitor in Display Settings will immediately and reproducibly crash gnome-shell.

This is trivial for me to reproduce, so if you need patches tested I can easily do so.

ProblemType: Crash
DistroRelease: Ubuntu 22.04
Package: gnome-shell 41.3-1ubuntu1
ProcVersionSignature: Ubuntu 5.15.0+bcachefs.git20211116.1fa97551d-1.1-generic 5.15.2
Uname: Linux 5.15.0+bcachefs.git20211116.1fa97551d-1-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu78
Architecture: amd64
CasperMD5CheckResult: pass
CrashCounter: 1
CurrentDesktop: ubuntu:GNOME
Date: Tue Mar 8 09:37:51 2022
DisplayManager: gdm3
ExecutablePath: /usr/bin/gnome-shell
InstallationDate: Installed on 2021-11-02 (125 days ago)
InstallationMedia: Ubuntu 21.10.0 2021.10.19 amd64 "bcachefs" (20211028)
ProcCmdline: /usr/bin/gnome-shell
ProcEnviron:
 LANG=en_AU.UTF-8
 LANGUAGE=en_AU:en
 PATH=(custom, user)
 SHELL=/usr/bin/fish
 XDG_RUNTIME_DIR=<set>
RelatedPackageVersions: mutter-common 41.3-3ubuntu1
Signal: 5
SourcePackage: gnome-shell
StacktraceTop:
 () at /lib/x86_64-linux-gnu/libmutter-9.so.0
 () at /lib/x86_64-linux-gnu/libmutter-9.so.0
 () at /lib/x86_64-linux-gnu/libmutter-9.so.0
 () at /lib/x86_64-linux-gnu/libmutter-9.so.0
 meta_monitor_mode_foreach_crtc () at /lib/x86_64-linux-gnu/libmutter-9.so.0
Title: gnome-shell crashed with signal 5
UpgradeStatus: Upgraded to jammy on 2021-11-02 (124 days ago)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
separator:

Revision history for this message
Chris Halse Rogers (raof) wrote :
tags: removed: need-amd64-retrace
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yeah having 'meta_monitor_mode_foreach_crtc' in the stack trace supports your bug description well, but we need a more detailed stack trace yet. Maybe try installing the libmutter debug symbols and then crashing it again?

Changed in gnome-shell (Ubuntu):
status: New → Incomplete
tags: added: hybrid nvidia nvidia-wayland wayland wayland-session
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Also keep in mind the configuration you want is known to not work: bug 1959888, bug 1963701.

Still, we also need to avoid crashes.

Revision history for this message
Apport retracing service (apport) wrote :

StacktraceSource:
 #0 0x00007f06fc89ea7c in ?? ()
 #1 0x000000000000022e in ?? ()
 #2 0x000000000000022f in ?? ()
 #3 0x0000000000000000 in ?? ()
StacktraceTop:
 ?? ()
 ?? ()
 ?? ()
 ?? ()

Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt
Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt
Changed in gnome-shell (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Apport retracing service (apport) wrote : Crash report cannot be processed

Thank you for your report!

However, processing it in order to get sufficient information for the
developers failed (it does not generate a useful symbolic stack trace). This
might be caused by some outdated packages which were installed on your system
at the time of the report:

no debug symbol package found for libnvidia-gl-495
no debug symbol package found for libjpeg-turbo8
no debug symbol package found for libnvidia-extra-495
no debug symbol package found for libcrypt1
no debug symbol package found for libgdk-pixbuf-2.0-0

Please upgrade your system to the latest package versions. If you still
encounter the crash, please file a new report.

Thank you for your understanding, and sorry for the inconvenience!

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: gnome-shell crashes when attempting to enable second monitor

That's unfortunate. Sounds like it might be bug 1964120 though.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Let's try again. Same issue in bug 1965246.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

From your ShellJournal.txt:

[ 137.444673] Extravaganza gnome-shell[4141]: Created gbm renderer for '/dev/dri/card1'
[ 137.444965] Extravaganza gnome-shell[4141]: Failed to allocate onscreen framebuffer for /dev/dri/card1: Failed to create gbm_surface: Operation not permitted
[ 137.445019] Extravaganza gnome-shell[4141]: GNOME Shell crashed with signal 5
[ 137.445019] Extravaganza gnome-shell[4141]: == Stack trace for context 0x55f3af3d0300 ==
[ 137.445096] Extravaganza gnome-shell[4141]: Failed to create fallback offscreen framebuffer: Failed to create texture 2d due to size/format constraints

Revision history for this message
Chris Halse Rogers (raof) wrote :

Would you like a full backtrace? I can install debug symbols and trigger this.

summary: - gnome-shell crashes when attempting to enable second monitor
+ gnome-shell crashes when attempting to enable second monitor on second
+ GPU (Nvidia >= 495) in a Wayland session
Changed in gnome-shell (Ubuntu):
importance: Undecided → High
assignee: nobody → Daniel van Vugt (vanvugt)
status: Invalid → Confirmed
information type: Private → Public
tags: added: multimonitor
Changed in gnome-shell (Ubuntu):
status: Confirmed → Triaged
Changed in mutter (Ubuntu):
importance: Undecided → High
assignee: nobody → Daniel van Vugt (vanvugt)
status: New → Triaged
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: gnome-shell crashes when attempting to enable second monitor on second GPU (Nvidia >= 495) in a Wayland session
Download full text (6.6 KiB)

Using the main branches:

#0 0x00007f3255a9fccf in g_log_structured_array ()
    at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007f3255a9ff99 in g_log_default_handler ()
    at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00005618851da1fd in default_log_handler
    (log_domain=0x7f3254e5b2c6 "mutter", log_level=6, message=0x5618885d6810 "Failed to create fallback offscreen framebuffer: Failed to create texture 2d due to size/format constraints", data=0x0) at ../src/main.c:297
#3 0x00007f3255aa13fa in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007f3255aa16e3 in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007f3254dfec77 in create_fallback_offscreen
    (renderer_native=0x561885ea18f0, cogl_context=0x5618861d2750, width=1920, height=1200) at ../src/backends/native/meta-renderer-native.c:1213
#6 0x00007f3254dfef76 in meta_renderer_native_create_view
    (renderer=0x561885ea18f0, logical_monitor=0x561886d4f540, output=0x56188865d4a0, crtc=0x7f320018a610) at ../src/backends/native/meta-renderer-native.c:1288
#7 0x00007f3254c9a75d in meta_renderer_create_view
    (renderer=0x561885ea18f0, logical_monitor=0x561886d4f540, output=0x56188865d4a0, crtc=0x7f320018a610) at ../src/backends/meta-renderer.c:102
#8 0x00007f3254c9a7cd in create_crtc_view
    (logical_monitor=0x561886d4f540, monitor=0x561888572e80, output=0x56188865d4a0, crtc=0x7f320018a610, user_data=0x561885ea18f0)
    at ../src/backends/meta-renderer.c:133
#9 0x00007f3254c7ec1b in foreach_crtc
    (monitor=0x561888572e80, mode=0x56188772e740, monitor_crtc_mode=0x56188621d670, user_data=0x7fffdc9b9760, error=0x0)
    at ../src/backends/meta-logical-monitor.c:247
#10 0x00007f3254c82d04 in meta_monitor_mode_foreach_crtc
    (monitor=0x561888572e80, mode=0x56188772e740, func=0x7f3254c7ebb4 <foreach_crtc>, user_data=0x7fffdc9b9760, error=0x0)
    at ../src/backends/meta-monitor.c:1955
#11 0x00007f3254c7ecb5 in meta_logical_monitor_foreach_crtc
    (logical_monitor=0x561886d4f540, func=0x7f3254c9a78d <create_crtc_view>, user_data=0x561885ea18f0) at ../src/backends/meta-logical-monitor.c:274
#12 0x00007f3254c9a8ee in meta_renderer_real_rebuild_views
    (renderer=0x561885ea18f0) at ../src/backends/meta-renderer.c:168
#13 0x00007f3254dff4c8 in meta_renderer_native_rebuild_views
    (renderer=0x561885ea18f0)
    at ../src/backends/native/meta-renderer-native.c:1422
#14 0x00007f3254c9a78b in meta_renderer_rebuild_views (renderer=0x561885ea18f0)
    at ../src/backends/meta-renderer.c:120
#15 0x00007f3254e0ab20 in meta_stage_native_rebuild_views
    (stage_native=0x5618860ff500)
    at ../src/backends/native/meta-stage-native.c:66
#16 0x00007f3254dc7e1b in meta_backend_native_update_screen_size
    (backend=0x561885ded120, width=5043, height=3360)
    at ../src/backends/native/meta-backend-native.c:411
#17 0x00007f3254c6d7e7 in meta_backend_sync_screen_size
    (backend=0x561885ded120) at ../src/backends/meta-backend.c:285
#18 0x00007f3254c6da07 in meta_backend_monitors_changed (backend=0x561885ded120) at ../src/backends/meta-backend.c:356
#19 0x00007f3254c946a3 in meta_monitor_manager_notify_monitors_changed (manager=0x561885df0340) at ../src/backends/meta-monit...

Read more...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It appears my work in progress avoids the crash nicely:

https://gitlab.gnome.org/vanvugt/mutter/-/commits/fall-back-from-secondary-gpu

Although it's slow -- it works by avoiding Nvidia GBM when the driver refuses to work in a hybrid setup, and just uses Nvidia KMS to scan out dumb buffers rendered by the primary GPU instead... but it appears that's still faster than using Xorg!?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Long term we are hoping for an Nvidia driver that doesn't fail GBM in hybrid setups.

Changed in mutter (Ubuntu):
status: Triaged → In Progress
no longer affects: gnome-shell (Ubuntu)
summary: - gnome-shell crashes when attempting to enable second monitor on second
- GPU (Nvidia >= 495) in a Wayland session
+ gnome-shell crashes (fatal error logged in create_fallback_offscreen)
+ when attempting to enable second monitor on second GPU (Nvidia >= 495)
+ in a Wayland session
Revision history for this message
Mike Pontillo (mpontillo) wrote (last edit ):

Thanks for your attention to this bug, Daniel.

For the record, I don't think a set up like this is particularly weird; I'm seeing this issue on a laptop with embedded NVIDIA graphics. The "second video card", in my case, is the integrated Intel graphics card.

Also, I'm not sure if this is related, but yesterday I saw a regression that caused my second monitor to fail; the only workaround I found was to downgrade to nvidia-driver-470 from nvidia-driver-510. (That is, nvidia-driver-510 wasn't causing me too much trouble when I first installed Jammy from the March 21st image; it took a day or two of updating, then started causing me issues yesterday .)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Certainly using nvidia-driver-470 will avoid this crash. Although choosing 'Ubuntu on Xorg' at the login screen with nvidia-driver-510 should avoid it too.

P.S. GNOME Shell refers to the integrated GPU (Intel) as primary (because it's attached to the screen), and the more powerful GPU (usually not wired to the screen) is the secondary.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fixed in mutter 42.1 but we should probably patch it in sooner than that for jammy.

Changed in mutter (Ubuntu):
status: In Progress → Fix Committed
tags: added: fixed-in-42.1 fixed-upstream
jeremyszu (os369510)
Changed in oem-priority:
status: New → Confirmed
assignee: nobody → jeremyszu (os369510)
importance: Undecided → High
importance: High → Critical
tags: added: jiayi oem-priority
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Pierre Equoy (pieq) wrote :

Just for the record, I see the same issue with a Dell Precision 7760 (CID 202103-28858) when running 22.04 beta on Wayland. I was told the HDMI connector was wired directly to the Nvidia GPU, so gnome-shell crashes when I connect an external monitor there, but even after logging back in, the monitor cannot be used.

Plugging the same monitor to the USB-C connector (which is wired to Intel GPU apparently) works like a charm...

Changed in nvidia-graphics-drivers-510 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Changed in nvidia-graphics-drivers-495 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mutter - 42.0-3ubuntu1

---------------
mutter (42.0-3ubuntu1) jammy; urgency=medium

  [ Marco Trevisan (Treviño) ]
  * debian/patches: Cherry-pick various upstream commits for 42.1:
    + onscreen/native: Fall back if COPY_MODE_SECONDARY_GPU fails to init
      (LP: #1964037, #1959888)
  * debian/patches: Allow any drag timestamp as drag start serial (LP: #1964541)
  * debian/patches: Move x11-fractional scaling under ubuntu namespace
  * debian/patches: Account ClutterStage grabs on Wayland key focus sync
    (LP: #1964442)
  * debian/libmutter-10-0.symbols: Update including new internal symbols
  * debian/patches: Avoid memory errors when comparing gamma values
  * debian/patches: Fix privacy-screen and connectors updates with
    triple-buffering (LP: #1966178)
  * debian/patches: Ensure privacy screen settings are applied on startup
    (LP: #1966178)

  [ Jeremy Bicha ]
  * Merge from Debian unstable. Remaining changes:
    - debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch:
      + X11: Add support for fractional scaling using Randr
    - Add triple-buffering patch
    - debian/libmutter-10-0.symbols: Add symbols for triple buffering patch
    - ubuntu/wayland-data-device-Allow-any-drag-timestamp-as-drag-star.patch:
      + handle DnD for old (snapped) gtk apps that used wrong wayland serials

mutter (42.0-3) unstable; urgency=medium

  [ Marco Trevisan (Treviño) ]
  * debian/patches: Cherry-pick upstream fixes targeting 42.1
  * debian/patches: Ensure repick happens on actors visibility changed
    (LP: #1964545)

  [ Jeremy Bicha ]
  * Release to unstable

 -- Marco Trevisan (Treviño) <email address hidden> Wed, 13 Apr 2022 03:30:39 +0200

Changed in mutter (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
jeremyszu (os369510) wrote :

Confirmed the gnome will not crash but the system will back to gdm login screen in 1st hot-plugging.

Report the bug https://bugs.launchpad.net/oem-priority/+bug/1969121

Changed in oem-priority:
status: Confirmed → Fix Released
Changed in nvidia-graphics-drivers-495 (Ubuntu):
status: Confirmed → Won't Fix
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Won't Fix for the Nvidia drivers because the problem is properly fixed. The remaining issue is just a performance one: bug 1970291

Changed in nvidia-graphics-drivers-510 (Ubuntu):
status: Confirmed → Won't Fix
Changed in mutter:
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.