Wayland sessions can't use external monitors that are connected to an Nvidia GPU with the proprietary driver

Bug #1959888 reported by Ilia Kichev
56
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Mutter
Fix Released
Unknown
OEM Priority Project
Fix Released
High
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

When an external display is connected to my laptop, running Ubuntu 22.04, the display is detected and I am sent to the login screen. After logging in again, the display is not running, although the primary laptop display works fine. The external monitor is looking for connection in that moment, which it never founds.

The bug is tested on two Samsung monitors: S24R350FHUXEN and S22F350FHU.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: xorg 1:7.7+23ubuntu1
ProcVersionSignature: Ubuntu 5.15.0-18.18-generic 5.15.12
Uname: Linux 5.15.0-18-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
.proc.driver.nvidia.capabilities.gpu0: Error: path was not a regular file.
.proc.driver.nvidia.capabilities.mig: Error: path was not a regular file.
.proc.driver.nvidia.gpus.0000.01.00.0: Error: path was not a regular file.
.proc.driver.nvidia.registry: Binary: ""
.proc.driver.nvidia.suspend: suspend hibernate resume
.proc.driver.nvidia.suspend_depth: default modeset uvm
.proc.driver.nvidia.version:
 NVRM version: NVIDIA UNIX x86_64 Kernel Module 495.46 Wed Oct 27 16:31:33 UTC 2021
 GCC version: gcc version 11.2.0 (Ubuntu 11.2.0-14ubuntu1)
ApportVersion: 2.20.11-0ubuntu76
Architecture: amd64
BootLog: Error: [Errno 13] Permission denied: '/var/log/boot.log'
CasperMD5CheckResult: unknown
CompositorRunning: None
CurrentDesktop: ubuntu:GNOME
Date: Thu Feb 3 13:25:04 2022
DistUpgraded: 2022-01-13 15:37:13,056 DEBUG Running PostInstallScript: '/usr/lib/ubuntu-advantage/upgrade_lts_contract.py'
DistroCodename: jammy
DistroVariant: ubuntu
DkmsStatus:
 nvidia/495.46, 5.15.0-17-generic, x86_64: installed
 nvidia/495.46, 5.15.0-18-generic, x86_64: installed
ExtraDebuggingInterest: Yes
GraphicsCard:
 Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630] [8086:3e9b] (prog-if 00 [VGA controller])
   Subsystem: Dell CoffeeLake-H GT2 [UHD Graphics 630] [1028:086f]
   Subsystem: Dell GP107M [GeForce GTX 1050 Ti Mobile] [1028:086f]
InstallationDate: Installed on 2021-09-09 (146 days ago)
InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210)
MachineType: Dell Inc. G3 3579
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.15.0-18-generic root=UUID=fd3be223-e609-4a8d-97fb-31ee2f754766 ro quiet splash vt.handoff=7
SourcePackage: xorg
Symptom: display
UpgradeStatus: Upgraded to jammy on 2022-01-13 (20 days ago)
dmi.bios.date: 04/20/2021
dmi.bios.release: 1.15
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 1.15.0
dmi.board.name: 0M5H57
dmi.board.vendor: Dell Inc.
dmi.board.version: A05
dmi.chassis.type: 10
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr1.15.0:bd04/20/2021:br1.15:svnDellInc.:pnG33579:pvr:rvnDellInc.:rn0M5H57:rvrA05:cvnDellInc.:ct10:cvr:sku086F:
dmi.product.family: GSeries
dmi.product.name: G3 3579
dmi.product.sku: 086F
dmi.sys.vendor: Dell Inc.
nvidia-settings:
 ERROR: Unable to find display on any available system

 ERROR: Unable to find display on any available system
version.compiz: compiz N/A
version.libdrm2: libdrm2 2.4.109-2ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 21.2.2-1ubuntu1
version.libgl1-mesa-glx: libgl1-mesa-glx 21.2.2-1ubuntu1
version.nvidia-graphics-drivers: nvidia-graphics-drivers-* N/A
version.xserver-xorg-core: xserver-xorg-core 2:1.20.14-1ubuntu1
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev N/A
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:19.1.0-2build1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20200714-1ubuntu2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.17-1build1

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

Thanks for the bug report.

I believe this is a known problem with the mutter Wayland backend. It was mentioned by the developer just this week: https://gitlab.gnome.org/GNOME/mutter/-/issues/2127#note_1373187 Although that bug was closed when the user's main problem was found to be an unrelated crash.

affects: xorg (Ubuntu) → mutter (Ubuntu)
summary: - The connection with HDMI to an external monitor fails after the login
- screen.
+ Wayland sessions can't use external monitors that are connected to an
+ Nvidia GPU with the proprietary driver
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

As a workaround, on the login screen try changing the session type before you enter your password. It's the icon in the bottom right corner of the screen.

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

If anyone wants to look into this bug, the issue is with META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU. It only supports open source (Mesa) drivers at the moment.

tags: added: hybrid multigpu
Revision history for this message
Ilia Kichev (ziliyadarvar) wrote :

I'm happy to say that in the current version of the nvidia driver (nvidia-driver-510) the problem seems to be fixed. I can connect external monitor and it works flawlessly. Thank you for the help!

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

That's great, but can you verify it's a Wayland session you're still using? Or has it switched to Xorg?

Changed in mutter (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

While everything is working with the external monitor please run:

  xrandr > xrandr.txt

and attach the resulting text file here.

tags: added: nvidia-wayland wayland
Changed in mutter (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
importance: Undecided → High
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Bug confirmed with Nvidia-510. External monitors connected to the secondary (Nvidia) GPU never light up in Wayland sessions. Also my log is full of:

  clutter_frame_clock_notify_presented: code should not be reached

Changed in mutter (Ubuntu):
status: Incomplete → Confirmed
status: Confirmed → Triaged
Changed in mutter (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Proof of concept workaround/fix:

https://gitlab.gnome.org/vanvugt/mutter/-/commit/8c57fd13766c74007c696a0fbb74f1b2a89ff099

But even when finished it will be a little slow. We're waiting for Nvidia to update their driver such that the GBM API doesn't fail when it's the secondary GPU. Until then we should probably default to Xorg so that all monitors work with reasonable performance.

Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

I tried it on my DELL XPS 9510 which is I+N platform but I didn't meet this issue on Jammy daily build (with dist-upgrade).
Did you change anything? e.g. upgrade gnome-shell or mutter to 42 beta?

Changed in oem-priority:
assignee: nobody → jeremyszu (os369510)
importance: Undecided → High
tags: added: oem-priority
Revision history for this message
Daniel van Vugt (vanvugt) wrote (last edit ):

I've just tested with jammy again and it definitely fails with Nvidia-510. The external monitor plugged into the secondary (Nvidia) GPU doesn't light up for Wayland sessions, while the primary monitor (Intel) works fine.

Although you need to have the monitor plugged in before logging in to even get that far. If you try hotplugging a monitor on the secondary GPU in a Wayland session then you get bug 1964037 instead.

Revision history for this message
jeremyszu (os369510) wrote (last edit ):

ok, I arranged one machine to give it a try.
I will share the result here later.

BTW, I'm not able to check bug 1965246

Changed in mutter (Ubuntu):
status: In Progress → Fix Committed
tags: added: fixed-in-42.1 fixed-upstream
Revision history for this message
jeremyszu (os369510) wrote :
Download full text (3.8 KiB)

Follow-up from comment#12, I can reproduce this issue on I+N (external hdmi port wires to dGPU) on DELL-Precision-7760.

---
 三 31 10:57:35 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x7faffc27c980 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:35 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x55ce0075bc40 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:35 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x55ce0075bc40 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:35 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x55ce0075bf50 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:41 ubuntu-Precision-7760 gnome-shell[2492]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed
 三 31 10:57:41 ubuntu-Precision-7760 gnome-shell[2492]: setup_framebuffers: assertion 'width > 0' failed
 三 31 10:57:42 ubuntu-Precision-7760 gnome-shell[2492]: setup_framebuffers: assertion 'width > 0' failed
 三 31 10:57:42 ubuntu-Precision-7760 gnome-shell[2492]: setup_framebuffers: assertion 'width > 0' failed
 三 31 10:57:42 ubuntu-Precision-7760 gnome-shell[2492]: setup_framebuffers: assertion 'width > 0' failed
 三 31 10:57:45 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x7faf74004130 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:45 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x55ce03b87330 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:45 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x55cdffba6760 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:45 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x7faffc2f7df0 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:45 ubuntu-Precision-7760 gnome-shell[2492]: Object 0x7faffc23df40 of type IBusText has been finalized while it was still owned by gjs, this is due to invalid memory management.
 三 31 10:57:49 ubuntu-Precision-7760 gnome-shell[2492]: Created gbm renderer for '/dev/dri/card1'
 三 31 10:57:49 ubuntu-Precision-7760 gnome-shell[2492]: Failed to allocate onscreen framebuffer for /dev/dri/card1: Failed to create gbm_surface: Operation not permitted
 三 31 10:57:49 ubuntu-Precision-7760 gnome-shell[2492]: GNOME Shell crashed with signal 5
 三 31 10:57:49 ubuntu-Precision-7760 gnome-shell[2492]: == Stack trace for context 0x55cdfef5c180 ==
 三 31 10:57:49 ubuntu-Precision-7760 gnome-shell[2492]: Failed to create fallback offscreen framebuffer: Failed to create texture 2d due to size/format constraint
...
 三 31 10:57:56 ubuntu-Precision-7760 gnome-shell[5958]: Running GNOME Shell (using mutter 42.beta) as a Wayland display server
---

Which also break the auto-login f...

Read more...

Changed in oem-priority:
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote (last edit ):

The crash is bug 1964037 but it's the same fix for this bug. I'll propose a distro patch to mutter soon because it seems fairly common that people plug a monitor into their hybrid laptop.

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

BTW the fix is two commits. It won't work if you only use the one mentioned in comment #13.

Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

Thanks for sharing!
If there is a patch either from salsa or PPA then I can help to verify it in my case.

tags: added: jiayi
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
jeremyszu (os369510) wrote :

Hi Daniel,

In this case, do we have any ticket for nvidia to fix the GBM issue?
We would like to highlight this to nVidia.

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

I haven't got to that yet. It will require a different kind of bug report to the Nvidia forums detailing which GBM function is failing, without mentioning these mutter symptoms.

Changed in nvidia-graphics-drivers-510 (Ubuntu):
status: New → Confirmed
importance: Undecided → High
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

jeremyszu (os369510)
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
gutopardini (gutopardini) wrote :

Is there any way to charge NVIDIA for a solution?

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

Ubuntu has already released a solution, it's only a more performant solution that requires changes from NVIDIA. They are aware of the issue as I've seen it on their list of missing features in Wayland sessions.

Revision history for this message
gutopardini (gutopardini) wrote :

in fact it has been fixed, but the lag persists which makes it impossible to continue with wayland when using a secondary monitor.
I really appreciate all the support you have provided.

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 → New
Revision history for this message
Aleksandr Panzin (jalexoid) wrote (last edit ):

I have the same problem...

And mine is worse - picking Ubuntu on XOrg has no effect.

ThinkPad P1 Gen3 has all HDMI/USBC monitors connected to NVidia only.

So I cannot use external monitor in any way shape or form. This is new, btw.

XDG_SESSION_DESKTOP=ubuntu-xorg
XDG_SESSION_TYPE=x11

$ prime-select query
nvidia

EDIT: Scratch that... Forced an update and moved to proposed and it started to work.

Revision history for this message
jeremyszu (os369510) wrote :

Hi Aleksandr,

sound more likely the other issue.
Since this issue is fixed, could you please report the other with attaching logs?

Changed in mutter:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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