Vulkan error when using NVIDIA-Prime

Bug #1800465 reported by Luca Osvaldo Mastromatteo on 2018-10-29
62
This bug affects 13 people
Affects Status Importance Assigned to Milestone
NVIDIA Drivers Ubuntu
Undecided
Unassigned
nvidia-graphics-drivers-390 (Ubuntu)
Undecided
Unassigned
nvidia-prime (Ubuntu)
Undecided
Unassigned

Bug Description

After installing Ubuntu 18.10 and the Nvidia driver + Vulkan-Utils, switching to NVIDIA and then running vulkaninfo or vulkan-cube works perfectly.

But when you reboot and update, then switch to Intel, then back to Nvidia, all Vulkan programs give an
"Assertion `!err' failed."

Vulkaninfo:

=======
Presentable Surfaces:
=====================
GPU id : 0 (GeForce GTX 960M)
Surface type : VK_KHR_xcb_surface
vulkaninfo: /build/vulkan-tools-ZnxIl9/vulkan-tools-1.1.82.0+dfsg1/vulkaninfo/vulkaninfo.c:1253: AppDumpSurfaceFormats: Assertion `!err' failed.
Annullato (core dump creato)

Vulkancube:
vulkan-cube: /build/vulkan-tools-ZnxIl9/vulkan-tools-1.1.82.0+dfsg1/cube/cube.c:3416: demo_init_vk_swapchain: Assertion `!err' failed.
Annullato (core dump creato)

I still have not found a workaround for that, the only way to get it working again is to reinstall everything.

- Install Ubuntu 18.10
- Install proprietary 390 NVIDIA drivers
- Switch NVIDIA-Prime to NVIDIA
- Testing the vulkan capabilities works
- Updating the system then switching to intel
- Reboot
- Switch to nvida
- Now all Vulkan programs when using NVIDIA give that error

Those were the update packages...

Commandline: apt-get dist-upgrade
Requested-By: luky (1000)
Upgrade: xserver-common:amd64 (2:1.20.1-3ubuntu2, 2:1.20.1-3ubuntu2.1), xserver-xorg-core:amd64 (2:1.20.1-3ubuntu2, 2:1.20.1-3ubuntu2.1), libssh-4:amd64 (0.8.1-1, 0.8.1-1ubuntu0.1), gnome-software-plugin-snap:amd64 (3.30.2-0ubuntu5, 3.30.2-0ubuntu7), libsnmp-base:amd64 (5.7.3+dfsg-1.8ubuntu3, 5.7.3+dfsg-1.8ubuntu3.18.10.1), gnome-software:amd64 (3.30.2-0ubuntu5, 3.30.2-0ubuntu7), xserver-xorg-legacy:amd64 (2:1.20.1-3ubuntu2, 2:1.20.1-3ubuntu2.1), python3-requests:amd64 (2.18.4-2, 2.18.4-2ubuntu0.18.10.1), xserver-xephyr:amd64 (2:1.20.1-3ubuntu2, 2:1.20.1-3ubuntu2.1), libsnmp30:amd64 (5.7.3+dfsg-1.8ubuntu3, 5.7.3+dfsg-1.8ubuntu3.18.10.1), ubuntu-software:amd64 (3.30.2-0ubuntu5, 3.30.2-0ubuntu7), firefox-locale-en:amd64 (63.0+build1-0ubuntu1, 63.0+build2-0ubuntu0.18.10.2), firefox-locale-it:amd64 (63.0+build1-0ubuntu1, 63.0+build2-0ubuntu0.18.10.2), xwayland:amd64 (2:1.20.1-3ubuntu2, 2:1.20.1-3ubuntu2.1), libsynctex2:amd64 (2018.20180824.48463-1, 2018.20180824.48463-1ubuntu0.1), firefox:amd64 (63.0+build1-0ubuntu1, 63.0+build2-0ubuntu0.18.10.2), gnome-software-common:amd64 (3.30.2-0ubuntu5, 3.30.2-0ubuntu7), tzdata:amd64 (2018e-1, 2018g-0ubuntu0.18.10), libkpathsea6:amd64 (2018.20180824.48463-1, 2018.20180824.48463-1ubuntu0.1)
End-Date: 2018-10-29 13:12:50

no longer affects: xserver-xorg-video-intel (Ubuntu)

I was wrong, you don't need to update.

Basically just works once when you first install on a fresh system the nvidia proprietary drivers and reboot, in the first reboot it is already using NVIDIA instead of Intel, and when this happens, all Vulkan programs are running just fine. The problem comes when you switch to Intel and back to Nvidia once then.

Changed in nvidia-prime (Ubuntu):
status: New → Opinion
status: Opinion → New

This ONLY happens on Ubuntu 18.10, no issue in 18.04

Oh so it seems that Ubuntu 18.10 gdm and desktop defaults to Wayland, that has probably something to do with GDM and the wayland session...

I defaulted GDM and Gnome to X...

Oh actually no I don't know...It's really strange and frustrating when this happens, because I was able to reproduce the problem on an Ubuntu 18.04 based distro using GDM as display manager... A way to make it working is to run "vulkaninfo" as sudo once, it works, then also without sudo is back to work again once you reboot...

So, happens in Ubuntu 18.04 when you update the graphics drivers through PPA, and ONLY when using GDM.
Happens in Ubuntu 18.10 without even upgrading graphics drivers. ALWAYS and ONLY when GDM is used. Opengl works fine, vulkan doesn't.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-graphics-drivers-390 (Ubuntu):
status: New → Confirmed
Changed in nvidia-prime (Ubuntu):
status: New → Confirmed
asmealt (asmeralt) wrote :

This bug affects me too.
Ubuntu 18.10.
GeForce GTX 960M
Driver Version: 410.73

A temporary workaround is to switch gdm to another display manager

Well there is another problem when you update the drivers on Intel you can't open the nvidia settings, just save the old nvidia-settings and libs from /use/lib

On Ubuntu 18.04 is present only if you update the drivers from the repo, the only way to use gdm is that.

So I think there is an issue regarding GDM and updated Nvidia drivers...?

Well the issue with Nvidia settings is certainly releated to updated Nvidia drivers

asmealt (asmeralt) wrote :

I solved this just putting nvidia-drm.modeset=0 option into my grub config.

Alberto Milone (albertomilone) wrote :

yes, Gdm has issues with nvidia and KMS. Switching to Lightdm should help.

Jaap Buurman (mushoz) wrote :

I have the exact same bug. This one seems to be related: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-390/+bug/1769857

Jaap Buurman (mushoz) wrote :

"I solved this just putting nvidia-drm.modeset=0 option into my grub config."

I can confirm that this also solves the issue for me. Are there any drawbacks to use this kernel parameter? I have tried googling around, but I am still not sure what is actually does. And I am even more curious how this solves the issue at hand.

nvidia-drm.modeset=0 disables the vsync between the Intel and Nvidia card, called Prime SYNC.

In windows is another thing and the tearing isn't noticeable at all

Chase (buffalobuffalobuffalo) wrote :

I also had this same bug. Adding nvidia-drm.modeset workaround helped.

Mariusz Domański (mario.7) wrote :

In general nvidia-drm.modeset=1 is required to have Nvidia PRIME enabled, which reduces (or even removes) tearing of moving images on Optimus setups.

KMS - kernel mode settings, allows kernel to control video card and in Optimus setups, among other features, this allows to synchronize graphics buffers by both graphics cards - so there are no artifacts/tearing/etc, because before displaying anything on monitor buffers are fully copied from one card to another.
When modeset is disabled for Nvidia driver - buffers of both graphics cards cannot be synchronized properly so sometimes images that are displayed are only partially updated and this is visible as taring or other similar artifacts (part of the screen is filled with current frame and part of the screen is filled with previous frame).

The problem is that for some reason when KMS is enabled for Nvidia driver - vulkan requires root privileges to be initialized properly. After initialization for the first time (as root), it can be used with normal user privileges.

The bug is still there on Ubuntu 18.04 with newer drivers and kernel:
nvidia-driver-418
linux-image-4.18.0-16-generic

HENRY Florian (bientotlaferme) wrote :

Same bug here on two different laptop.

Fresh install Ubuntu 18.04.2
nvidia-driver-418
4.18.0-18-generic

First $vulkaninfo => OK
Switch on Intel with NVIDIA X Server settings
reboot
Switch to NVIDIA with NVIDIA X Server settings
reboot
$vulkaninfo => VK_ERROR_INITIALIZATION_FAILED
$sudo vulkaninfo => OK
then
vulkaninfo => OK

So now before launch Steam to play games that use vulkan I always do sudo vulkaninfo

Daniel van Vugt (vanvugt) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 1769857, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers