LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
20.14k stars 967 forks source link

Error: Couldn't initialize cuda: CUDA_ERROR_UNKNOWN:unknown error #3081

Open tomowang opened 3 months ago

tomowang commented 3 months ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

When start sunshine, the logs report errors and moonlight streaming with black screen (audio works).

Expected Behavior

The sunshine with moonlight can stream with normal video.

Additional Context

No response

Host Operating System

Linux

Operating System Version

Ubuntu 24.04 LTS

Architecture

64 bit

Sunshine commit or version

v0.23.1

Package

Linux - deb

GPU Type

Nvidia

GPU Model

NVIDIA GeForce RTX 4070 Ti SUPER

GPU Driver/Mesa Version

Driver Version: 560.28.03 CUDA Version: 12.6

Capture Method

None

Config

empty

Apps

"env": {
    "PATH": "$(PATH):$(HOME)/.local/bin"
  },
  "apps": [
    {
      "name": "Desktop",
      "image-path": "desktop.png"
    },
    {
      "name": "Low Res Desktop",
      "image-path": "desktop.png",
      "prep-cmd": [
        {
          "do": "xrandr --output HDMI-1 --mode 1920x1080",
          "undo": "xrandr --output HDMI-1 --mode 1920x1200"
        }
      ]
    },
    {
      "name": "Steam Big Picture",
      "detached": [
        "setsid steam steam://open/bigpicture"
      ],
      "image-path": "steam.png"
    }
  ]
}

Relevant log output

[2024-08-24 22:07:10.498]: Info: Sunshine version: v2024.823.131748
[2024-08-24 22:07:10.501]: Error: Couldn't initialize cuda: CUDA_ERROR_UNKNOWN:unknown error
[2024-08-24 22:07:10.501]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:10.501]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:10.514]: Info: /dev/dri/card1 -> nvidia-drm
[2024-08-24 22:07:10.542]: Info: System tray created
[2024-08-24 22:07:10.702]: Error: Environment variable WAYLAND_DISPLAY has not been defined
[2024-08-24 22:07:10.702]: Info: Detecting displays
[2024-08-24 22:07:10.757]: Info: Detected display: HDMI-0 (id: 0)HDMI-0 connected: true
[2024-08-24 22:07:10.757]: Info: Detected display: DP-0 (id: 1)DP-0 connected: false
[2024-08-24 22:07:10.757]: Info: Detected display: DP-1 (id: 2)DP-1 connected: false
[2024-08-24 22:07:10.757]: Info: Detected display: DP-2 (id: 3)DP-2 connected: false
[2024-08-24 22:07:10.757]: Info: Detected display: DP-3 (id: 4)DP-3 connected: false
[2024-08-24 22:07:10.757]: Info: Detected display: DP-4 (id: 5)DP-4 connected: false
[2024-08-24 22:07:10.757]: Info: Detected display: DP-5 (id: 6)DP-5 connected: false
[2024-08-24 22:07:10.764]: Warning: Gamepad ds5 is disabled due to Permission denied
[2024-08-24 22:07:10.764]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024-08-24 22:07:10.764]: Info: Trying encoder [nvenc]
[2024-08-24 22:07:10.764]: Info: Screencasting with KMS
[2024-08-24 22:07:10.764]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:10.764]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:10.767]: Info: /dev/dri/card1 -> nvidia-drm
[2024-08-24 22:07:10.767]: Error: Couldn't find monitor [0]
[2024-08-24 22:07:10.767]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:10.767]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:10.771]: Info: /dev/dri/card1 -> nvidia-drm
[2024-08-24 22:07:10.771]: Error: Couldn't find monitor [0]
[2024-08-24 22:07:10.971]: Info: Screencasting with KMS
[2024-08-24 22:07:10.971]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:10.972]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:10.977]: Info: /dev/dri/card1 -> nvidia-drm
[2024-08-24 22:07:10.977]: Error: Couldn't find monitor [0]
[2024-08-24 22:07:10.977]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:10.977]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:10.981]: Info: /dev/dri/card1 -> nvidia-drm
[2024-08-24 22:07:10.981]: Error: Couldn't find monitor [0]
[2024-08-24 22:07:11.181]: Info: Encoder [nvenc] failed
[2024-08-24 22:07:11.181]: Info: Trying encoder [vaapi]
[2024-08-24 22:07:11.181]: Info: Screencasting with KMS
[2024-08-24 22:07:11.181]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:11.181]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:11.181]: Info: Found monitor for DRM screencasting
[2024-08-24 22:07:11.181]: Error: Failed to determine panel orientation, defaulting to landscape.
[2024-08-24 22:07:11.181]: Info: Found connector ID [35]
[2024-08-24 22:07:11.181]: Warning: No KMS cursor plane found. Cursor may not be displayed while streaming!
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/simpledrm_drv_video.so
libva info: va_openDriver() returns -1
[2024-08-24 22:07:11.182]: Error: Couldn't initialize va display: unknown libva error
[2024-08-24 22:07:11.182]: Warning: Monitor  doesn't support hardware encoding. Reverting back to GPU -> RAM -> GPU
[2024-08-24 22:07:11.185]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:11.185]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:11.185]: Info: Found monitor for DRM screencasting
[2024-08-24 22:07:11.185]: Error: Failed to determine panel orientation, defaulting to landscape.
[2024-08-24 22:07:11.185]: Info: Found connector ID [35]
[2024-08-24 22:07:11.185]: Warning: No KMS cursor plane found. Cursor may not be displayed while streaming!
MESA-LOADER: failed to open simpledrm: /usr/lib/dri/simpledrm_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
[2024-08-24 22:07:11.205]: Info: Creating encoder [h264_vaapi]
[2024-08-24 22:07:11.205]: Info: Color coding: SDR (Rec. 601)
[2024-08-24 22:07:11.205]: Info: Color depth: 8-bit
[2024-08-24 22:07:11.205]: Info: Color range: JPEG
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[2024-08-24 22:07:11.251]: Error: Couldn't initialize va display: unknown libva error
[2024-08-24 22:07:11.251]: Info: Creating encoder [h264_vaapi]
[2024-08-24 22:07:11.251]: Info: Color coding: SDR (Rec. 601)
[2024-08-24 22:07:11.251]: Info: Color depth: 8-bit
[2024-08-24 22:07:11.251]: Info: Color range: JPEG
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[2024-08-24 22:07:11.253]: Error: Couldn't initialize va display: unknown libva error
[2024-08-24 22:07:11.254]: Info: Creating encoder [h264_vaapi]
[2024-08-24 22:07:11.254]: Info: Color coding: SDR (Rec. 601)
[2024-08-24 22:07:11.254]: Info: Color depth: 8-bit
[2024-08-24 22:07:11.254]: Info: Color range: JPEG
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[2024-08-24 22:07:11.255]: Error: Couldn't initialize va display: unknown libva error
[2024-08-24 22:07:11.255]: Info: Creating encoder [h264_vaapi]
[2024-08-24 22:07:11.256]: Info: Color coding: SDR (Rec. 601)
[2024-08-24 22:07:11.256]: Info: Color depth: 8-bit
[2024-08-24 22:07:11.256]: Info: Color range: JPEG
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[2024-08-24 22:07:11.257]: Error: Couldn't initialize va display: unknown libva error
[2024-08-24 22:07:11.257]: Info: Encoder [vaapi] failed
[2024-08-24 22:07:11.261]: Info: Trying encoder [software]
[2024-08-24 22:07:11.261]: Info: Screencasting with KMS
[2024-08-24 22:07:11.261]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:11.261]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:11.261]: Info: Found monitor for DRM screencasting
[2024-08-24 22:07:11.261]: Error: Failed to determine panel orientation, defaulting to landscape.
[2024-08-24 22:07:11.261]: Info: Found connector ID [35]
[2024-08-24 22:07:11.261]: Warning: No KMS cursor plane found. Cursor may not be displayed while streaming!
MESA-LOADER: failed to open simpledrm: /usr/lib/dri/simpledrm_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
[2024-08-24 22:07:11.269]: Info: Creating encoder [libx264]
[2024-08-24 22:07:11.269]: Info: Color coding: SDR (Rec. 601)
[2024-08-24 22:07:11.269]: Info: Color depth: 8-bit
[2024-08-24 22:07:11.269]: Info: Color range: JPEG
[2024-08-24 22:07:11.270]: Info: [libx264 @ 0x6076a4dd8840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2024-08-24 22:07:11.270]: Info: [libx264 @ 0x6076a4dd8840] profile High, level 4.2, 4:2:0, 8-bit
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] frame I:1     Avg QP:31.00  size:  1203
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] mb I  I16..4: 99.9%  0.0%  0.0%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] 8x8 transform intra:0.0%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] i16 v,h,dc,p: 97%  0%  3%  0%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 75% 12%  0%  0%  0%  0% 12%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%  0%  0%  0%  0%  0%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] i8c dc,h,v,p: 100%  0%  0%  0%
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] kb/s:577.44
[2024-08-24 22:07:11.303]: Info: Creating encoder [libx264]
[2024-08-24 22:07:11.303]: Info: Color coding: SDR (Rec. 601)
[2024-08-24 22:07:11.303]: Info: Color depth: 8-bit
[2024-08-24 22:07:11.303]: Info: Color range: JPEG
[2024-08-24 22:07:11.303]: Info: [libx264 @ 0x6076a4dd8840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2024-08-24 22:07:11.304]: Info: [libx264 @ 0x6076a4dd8840] profile High 4:4:4 Predictive, level 4.2, 4:4:4, 8-bit
[2024-08-24 22:07:11.346]: Info: [libx264 @ 0x6076a4dd8840] frame I:1     Avg QP:31.00  size:  1306
[2024-08-24 22:07:11.346]: Info: [libx264 @ 0x6076a4dd8840] mb I  I16..4: 100.0%  0.0%  0.0%
[2024-08-24 22:07:11.346]: Info: [libx264 @ 0x6076a4dd8840] 8x8 transform intra:0.0%
[2024-08-24 22:07:11.346]: Info: [libx264 @ 0x6076a4dd8840] coded y,u,v intra: 0.0% 0.0% 0.0%
[2024-08-24 22:07:11.347]: Info: [libx264 @ 0x6076a4dd8840] i16 v,h,dc,p: 97%  0%  3%  0%
[2024-08-24 22:07:11.347]: Info: [libx264 @ 0x6076a4dd8840] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 75% 12%  0%  0%  0%  0% 12%
[2024-08-24 22:07:11.347]: Info: [libx264 @ 0x6076a4dd8840] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%  0%  0%  0%  0%  0%
[2024-08-24 22:07:11.347]: Info: [libx264 @ 0x6076a4dd8840] kb/s:626.88
[2024-08-24 22:07:11.353]: Info: Screencasting with KMS
[2024-08-24 22:07:11.353]: Info: /dev/dri/card0 -> simpledrm
[2024-08-24 22:07:11.353]: Warning: No render device name for: /dev/dri/card0
[2024-08-24 22:07:11.353]: Info: Found monitor for DRM screencasting
[2024-08-24 22:07:11.353]: Error: Failed to determine panel orientation, defaulting to landscape.
[2024-08-24 22:07:11.353]: Info: Found connector ID [35]
[2024-08-24 22:07:11.353]: Warning: No KMS cursor plane found. Cursor may not be displayed while streaming!
MESA-LOADER: failed to open simpledrm: /usr/lib/dri/simpledrm_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
[2024-08-24 22:07:11.366]: Info: 
[2024-08-24 22:07:11.366]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024-08-24 22:07:11.366]: Info: 
[2024-08-24 22:07:11.366]: Info: Found H.264 encoder: libx264 [software]
[2024-08-24 22:07:11.367]: Info: Adding avahi service Sunshine
[2024-08-24 22:07:11.368]: Info: Configuration UI available at [https://localhost:47990]
[2024-08-24 22:07:12.256]: Info: Avahi service Sunshine successfully established.
SjoerdV commented 2 months ago

same issue, reverting back to nVidia driver 555-58 with CUDA 12.5 (doing clean uninstalls first) fixes it.

I just checked the syslog and the driver init lines for both drivers (560 and 555) are exactly the same (so no errors), so it has to do with Sunshine freaking out over something.

Relevant log (when connecting to sunshine from moonlight client):

Sep 20 22:27:03 MYPC01 bash[1400]: [2024:09:20:22:27:03]: Error: Couldn't initialize cuda: CUDA_ERROR_OPERATING_SYSTEM:OS call failed or operation not supported on this OS
Sep 20 22:27:03 MYPC01 bash[1400]: [2024:09:20:22:27:03]: Error: Couldn't initialize cuda: CUDA_ERROR_OPERATING_SYSTEM:OS call failed or operation not supported on this OS
Sep 20 22:27:03 MYPC01 bash[1400]: [2024:09:20:22:27:03]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:03 MYPC01 bash[1400]: [2024:09:20:22:27:03]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:03 MYPC01 bash[1400]: [2024:09:20:22:27:03]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:03 MYPC01 bash[1400]: [2024:09:20:22:27:03]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:03 MYPC01 bash[1400]: libEGL warning: egl: failed to create dri2 screen
Sep 20 22:27:04 MYPC01 bash[1400]: [2024:09:20:22:27:04]: Error: Missing extension: [EGL_EXT_image_dma_buf_import]
Sep 20 22:27:04 MYPC01 systemd-logind[962]: Watching system buttons on /dev/input/event11 (Keyboard passthrough)
Sep 20 22:27:04 MYPC01 bash[1400]: libEGL warning: egl: failed to create dri2 screen
Sep 20 22:27:04 MYPC01 bash[1400]: [2024:09:20:22:27:04]: Error: Missing extension: [EGL_EXT_image_dma_buf_import]
Sep 20 22:27:04 MYPC01 bash[1400]: [2024:09:20:22:27:04]: Fatal: Unable to find display or encoder during startup.
Sep 20 22:27:04 MYPC01 bash[1400]: [2024:09:20:22:27:04]: Fatal: Please check that a display is connected and powered on.
Sep 20 22:27:04 MYPC01 bash[1400]: [2024:09:20:22:27:04]: Error: Video failed to find working encoder
Sep 20 22:27:04 MYPC01 systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Couldn't initialize cuda: CUDA_ERROR_OPERATING_SYSTEM:OS call failed or operation not supported on this OS
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Couldn't initialize cuda: CUDA_ERROR_OPERATING_SYSTEM:OS call failed or operation not supported on this OS
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Couldn't initialize EGL display: [00003001]
Sep 20 22:27:05 MYPC01 bash[1400]: libEGL warning: egl: failed to create dri2 screen
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Missing extension: [EGL_EXT_image_dma_buf_import]
Sep 20 22:27:05 MYPC01 bash[1400]: libEGL warning: egl: failed to create dri2 screen
Sep 20 22:27:05 MYPC01 bash[1400]: [2024:09:20:22:27:05]: Error: Missing extension: [EGL_EXT_image_dma_buf_import]
Sep 20 22:27:06 MYPC01 bash[1400]: [2024:09:20:22:27:06]: Fatal: Unable to find display or encoder during startup.
Sep 20 22:27:06 MYPC01 bash[1400]: [2024:09:20:22:27:06]: Fatal: Please check that a display is connected and powered on.