igo95862 / bubblejail

Bubblewrap based sandboxing for desktop applications
258 stars 17 forks source link

nvidia-vaapi-driver: findGPUIndexFromFd CUDA initialization error #126

Open hotcapy opened 2 months ago

hotcapy commented 2 months ago

Output of bubblejail --version

0.9.1

Your distro name and version

ArchLinux

Description

Some kind of permission error with CUDA libraries.

Using nvidia-vaapi-driver. LibreWolf hardware acceleration does work in Firejail, but not in Bubblejail.

vainfo /w NVD_LOG=1

Trying display: wayland
Trying display: x11
libva error: vaGetDriverNames() failed with unknown libva error
      4858.918727563 [16-16] ../src/vabackend.c: 168                     init CUDA ERROR 'unknown error' (999)

      4858.918757763 [16-16] ../src/vabackend.c:2187       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 10
      4858.918761163 [16-16] ../src/vabackend.c:2196       __vaDriverInit_1_0 Now have 0 (0 max) instances
      4858.918763323 [16-16] ../src/vabackend.c:2222       __vaDriverInit_1_0 Selecting Direct backend
      4858.938257592 [16-16] ../src/direct/direct-export-buf.c:  68      direct_initExporter Searching for GPU: 0 0 128
      4858.938283092 [16-16] ../src/direct/direct-export-buf.c:  90      direct_initExporter Found NVIDIA GPU 0 at /dev/dri/renderD128
      4858.938286102 [16-16] ../src/direct/nv-driver.c: 267            init_nvdriver Initing nvdriver...
      4858.938305262 [16-16] ../src/direct/nv-driver.c: 285            init_nvdriver NVIDIA kernel driver version: 560.35.03, major version: 560, minor version: 35
      4858.938309802 [16-16] ../src/direct/nv-driver.c: 292            init_nvdriver Got dev info: 2900 1 2 6
      4858.941241629 [16-16] ../src/direct/direct-export-buf.c:  27       findGPUIndexFromFd CUDA ERROR 'initialization error' (3)

      4858.941247119 [16-16] ../src/vabackend.c:2252       __vaDriverInit_1_0 CUDA ERROR 'initialization error' (3)

libva error: /usr/lib/dri/nvidia_drv_video.so init failed
vaInitialize failed with error code 1 (operation failed),exit

gst-inspect-1.0 nvcodec, as example of CUDA unavailability

Plugin Details:
  Name                     nvcodec
  Description              GStreamer NVCODEC plugin
  Filename                 /usr/lib/gstreamer-1.0/libgstnvcodec.so
  Version                  1.24.7
  License                  LGPL
  Source module            gst-plugins-bad
  Documentation            https://gstreamer.freedesktop.org/documentation/nvcodec/
  Source release date      2024-08-21
  Binary package           Arch Linux GStreamer 1.24.7-1
  Origin URL               https://www.archlinux.org/

  Error: Unable to initialize CUDA library.

Instance services

[common]
executable_name = "/usr/lib/librewolf/librewolf"
filter_disk_sync = false
dbus_name = "io.gitlab.librewolf.*"

[x11]

[network]

[pulse_audio]

[home_share]
home_paths = [
    ".config/fontconfig",
    ".config/gtk-2.0",
    ".config/gtk-3.0",
    ".config/Kvantum",
    ".config/lxqt",
    ".icons",
]

[direct_rendering]

[root_share]
read_only_paths = [
    "/sys/devices/system/cpu",
    "/sys/module/nvidia",
    "/usr/lib/librewolf",
]

[pipewire]

[debug]
raw_bwrap_args = [
    "--setenv",
    "NVD_LOG",
    "1",
    "--setenv",
    "NVD_BACKEND",
    "direct",
    "--setenv",
    "MOZ_DISABLE_RDD_SANDBOX",
    "1",
    "--setenv",
    "LIBVA_DRIVER_NAME",
    "nvidia",
    "--setenv",
    "VK_ICD_FILENAMES",
    "/usr/share/vulkan/icd.d/nvidia_icd.json",
]
igo95862 commented 2 months ago

Hello @hotcapy

Could you do an strace of vainfo? There probably is some kind of file that it tries to access.

hotcapy commented 2 months ago

Hi @igo95862

Sure:

$ strace --failed-only vainfo

connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/wayland-0"}, 27) = -1 ENOENT (No such file or directory)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
openat(AT_FDCWD, "/dev/shm/cuda_injection_path_shm", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profile-globals-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc.d", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc.d/", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
connect(9, {sa_family=AF_UNIX, sun_path="/tmp/nvidia-mps/control"}, 26) = -1 ENOENT (No such file or directory)
readlink("/proc", 0x7fffde09fac0, 1023) = -1 EINVAL (Invalid argument)
readlink("/proc/28", 0x7fffde09fac0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr", 0x7fffde09fac0, 1023)  = -1 EINVAL (Invalid argument)
readlink("/usr/bin", 0x7fffde09fac0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/bin/vainfo", 0x7fffde09fac0, 1023) = -1 EINVAL (Invalid argument)
chmod("/dev/nvidiactl", 0666)           = -1 EPERM (Operation not permitted)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
chmod("/dev/nvidiactl", 0666)           = -1 EPERM (Operation not permitted)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=31, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
chmod("/dev/nvidiactl", 0666)           = -1 EPERM (Operation not permitted)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=32, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
chmod("/dev/nvidiactl", 0666)           = -1 EPERM (Operation not permitted)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=33, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
chmod("/dev/nvidiactl", 0666)           = -1 EPERM (Operation not permitted)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=34, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
chmod("/dev/nvidiactl", 0666)           = -1 EPERM (Operation not permitted)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=35, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE, 0x46, 0x2a, 0x20), 0x7fffde09f790) = -1 EBADF (Bad file descriptor)
openat(AT_FDCWD, "/etc/glvnd/egl_vendor.d", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
futex(0x7fffde0a0584, FUTEX_UNLOCK_PI_PRIVATE) = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/etc/egl/egl_external_platform.d", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profile-globals-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc.d", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc.d/", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
lseek(2, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR|O_CLOEXEC) = -1 EACCES (Permission denied)
ioctl(0, _IOC(_IOC_READ|_IOC_WRITE, 0x46, 0x2a, 0x20), 0x7fffde0a0d50) = -1 ENOTTY (Inappropriate ioctl for device)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
+++ exited with 3 +++

$ strace vainfo

strace-vainfo_full.txt

igo95862 commented 2 months ago

Hmmm... The only thing that I see off is openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR|O_CLOEXEC) = -1 EACCES (Permission denied). Not sure if it the real cause of the issue or not.

igo95862 commented 2 months ago

Also I think vainfo does some forking so child processes are not tracked. You should add --follow-forks to capture all processes syscalls.

hotcapy commented 2 months ago

I also noted only this nvidiactl file..

--follow-forks:

48    connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/wayland-0"}, 27) = -1 ENOENT (No such file or directory)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    openat(AT_FDCWD, "/dev/shm/cuda_injection_path_shm", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profile-globals-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc.d", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc.d/", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/usr/share/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    connect(9, {sa_family=AF_UNIX, sun_path="/tmp/nvidia-mps/control"}, 26) = -1 ENOENT (No such file or directory)
48    readlink("/proc", 0x7ffc9f08a900, 1023) = -1 EINVAL (Invalid argument)
48    readlink("/proc/48", 0x7ffc9f08a900, 1023) = -1 EINVAL (Invalid argument)
48    readlink("/usr", 0x7ffc9f08a900, 1023) = -1 EINVAL (Invalid argument)
48    readlink("/usr/bin", 0x7ffc9f08a900, 1023) = -1 EINVAL (Invalid argument)
48    readlink("/usr/bin/vainfo", 0x7ffc9f08a900, 1023) = -1 EINVAL (Invalid argument)
48    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
50    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
50    +++ exited with 1 +++
48    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=50, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
48    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
51    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
51    +++ exited with 1 +++
48    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=51, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
48    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
52    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
52    +++ exited with 1 +++
48    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=52, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
48    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
53    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
53    +++ exited with 1 +++
48    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=53, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
48    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
54    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
54    +++ exited with 1 +++
48    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=54, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
48    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
55    chmod("/dev/nvidiactl", 0666)     = -1 EPERM (Operation not permitted)
55    +++ exited with 1 +++
48    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=55, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR) = -1 EACCES (Permission denied)
48    ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE, 0x46, 0x2a, 0x20), 0x7ffc9f08a5d0) = -1 EBADF (Bad file descriptor)
48    openat(AT_FDCWD, "/etc/glvnd/egl_vendor.d", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
48    futex(0x7ffc9f08b3c4, FUTEX_UNLOCK_PI_PRIVATE) = -1 EPERM (Operation not permitted)
48    openat(AT_FDCWD, "/etc/egl/egl_external_platform.d", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profile-globals-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/home/user/.nv/nvidia-application-profiles-rc.d", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/etc/nvidia/nvidia-application-profiles-rc.d/", O_RDONLY) = -1 ENOENT (No such file or directory)
48    openat(AT_FDCWD, "/usr/share/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
48    lseek(2, 0, SEEK_CUR)             = -1 ESPIPE (Illegal seek)
48    openat(AT_FDCWD, "/dev/nvidiactl", O_RDWR|O_CLOEXEC) = -1 EACCES (Permission denied)
48    ioctl(0, _IOC(_IOC_READ|_IOC_WRITE, 0x46, 0x2a, 0x20), 0x7ffc9f08bb90) = -1 ENOTTY (Inappropriate ioctl for device)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
48    recvmsg(3, {msg_namelen=0}, 0)    = -1 EAGAIN (Resource temporarily unavailable)
49    +++ exited with 3 +++
48    +++ exited with 3 +++

strace-vainfo_full.txt