After a long research and trying dozens of solutions, seems like I need your help.
I got a problem running vkcube, vulkaninfo, vkgears and similar in incus unprivileged container.
Hardware
Laptop with hybrid GPU setup
iGPU: UHD Graphics 630
dGPU: GeForce GTX 1050 Mobile
System Information
OS: Linux Debian 13 trixie
Kernel: 6.12.95+deb13-amd64
Display: X11
Incus Version: 6.0.4 (installed via regular debian repository)
NVIDIA Driver Version: 550.163.01
I don’t have any problems on host, vulkan sample apps works fine there.
Config on host:
$ sudo cat /sys/module/nvidia_drm/parameters/modeset
Y
$ incus profile show debian_gui_x11
config:
nvidia.driver.capabilities: all
raw.idmap: both 1000 1000
raw.lxc: lxc.apparmor.profile=unconfined
security.nesting: "true"
description: Sets up GPU, Wayland, X11 and PulseAudio
devices:
gpu:
gid: "44"
type: gpu
pulse:
bind: instance
connect: unix:/run/user/1000/pulse/native
gid: "1000"
listen: unix:/mnt/pulse.sock
security.gid: "1000"
security.uid: "1000"
type: proxy
uid: "1000"
x11:
bind: instance
connect: unix:/tmp/.X11-unix/X0
gid: "1000"
listen: unix:/tmp/.X11-unix/X0
security.gid: "1000"
security.uid: "1000"
type: proxy
uid: "1000"
name: debian_gui_x11
used_by:
- /1.0/instances/dev
project: default
$ incus create images:debian/13/default -p default -p debian_gui_x11 dev
Creating dev
$ incus start dev
$ incus shell dev
root@dev:~# useradd -m debian -s /bin/bash
root@dev:~# usermod -aG sudo debian
root@dev:~# usermod -aG video,render debian
root@dev:~# passwd debian
New password:
Retype new password:
passwd: password updated successfully
root@dev:~# sudo reboot
...
$ incus console dev
In container:
debian@dev:~$ sudo apt update
debian@dev:~$ sudo apt install nano
debian@dev:~$ sudo nano /etc/apt/sources.list
# added non-free non-free-firmware
debian@dev:~$ sudo apt update
debian@dev:~$ sudo apt install nvidia-smi
# it installs nvidia drivers with dependencies including nvidia-vulkan-common, nvidia-vulkan-icd
debian@dev:~$ nvidia-smi
Fri Jul 10 19:13:12 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.163.01 Driver Version: 550.163.01 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce GTX 1050 Off | 00000000:01:00.0 Off | N/A |
| N/A 37C P8 N/A / ERR! | 5MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+
debian@dev:~$ sudo reboot
And now comes vulkan stuff:
debian@dev:~$ sudo apt install vulkan-tools
...
debian@dev:~$ vulkaninfo --summary
'DISPLAY' environment variable not set... skipping surface info
==========
VULKANINFO
==========
Vulkan Instance Version: 1.4.309
Instance Extensions: count = 23
-------------------------------
VK_EXT_acquire_drm_display : extension revision 1
VK_EXT_acquire_xlib_display : extension revision 1
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_direct_mode_display : extension revision 1
VK_EXT_display_surface_counter : extension revision 1
VK_EXT_surface_maintenance1 : extension revision 1
VK_EXT_swapchain_colorspace : extension revision 4
VK_KHR_device_group_creation : extension revision 1
VK_KHR_display : extension revision 23
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2 : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_portability_enumeration : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_surface_protected_capabilities : extension revision 1
VK_KHR_wayland_surface : extension revision 6
VK_KHR_xcb_surface : extension revision 6
VK_KHR_xlib_surface : extension revision 6
VK_LUNARG_direct_driver_loading : extension revision 1
Instance Layers: count = 1
--------------------------
VK_LAYER_NV_optimus NVIDIA Optimus layer 1.3.277 version 1
Devices:
========
GPU0:
apiVersion = 1.3.277
driverVersion = 550.163.1.0
vendorID = 0x10de
deviceID = 0x1c8d
deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
deviceName = NVIDIA GeForce GTX 1050
driverID = DRIVER_ID_NVIDIA_PROPRIETARY
driverName = NVIDIA
driverInfo = 550.163.01
conformanceVersion = 1.3.7.2
deviceUUID = e21dd3e0-f4d1-f74d-bf1c-3ab1d5c3dfb8
driverUUID = 2485a78d-e39e-5aba-a0e9-b1139a1e6395
As you can see when I don’t have DISPLAY environment setup - vulkaninfo works.
Let’s setup environment for x11 container-host forwarding like I do usually and check vulkan samples again:
debian@dev:~$ export DISPLAY=:0
export PULSE_SERVER=/mnt/pulse.sock
export XDG_SESSION_TYPE=x11
debian@dev:~$ vulkaninfo
(hangs)
debian@dev:~$ __NV_PRIME_RENDER_OFFLOAD=1 vulkaninfo
WARNING: [Loader Message] Code 0 : Layer VK_LAYER_NV_optimus uses API version 1.3 which is older than the application specified API version of 1.4. May cause issues.
(hangs)
debian@dev:~$ __NV_PRIME_RENDER_OFFLOAD=1 vkcube
Selected WSI platform: xcb
Selected GPU 0: NVIDIA GeForce GTX 1050, type: DiscreteGpu
(window appears with black screen / hangs)
However, when I test opengl sample apps with PRIME OFFLOAD variables it seems to work fine.
debian@dev:~$ sudo apt install mesa-utils
...
debian@dev:~$ glxinfo -B
name of display: :0
(hangs)
debian@dev:~$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 4096 MB
Total available memory: 4096 MB
Currently available dedicated video memory: 4026 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 550.163.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6.0 NVIDIA 550.163.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 550.163.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
debian@dev:~$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
315 frames in 5.0 seconds = 62.965 FPS
(window appears with rotating gears, everything works fine)
What is the problem here ? Have you got any ideas ?
Also on host dmesg shows this, when I tried running one of the vulkan samples:
[44252.932808] audit: type=1400 audit(1783715105.741:712): apparmor="DENIED" operation="file_receive" class="file" profile="incus_forkproxy-x11_dev_</var/lib/incus>" name="/dev/dri/card0" pid=91927 comm="incusd" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0
Could apparmor be the problem here? I already set lxc.apparmor.profile=unconfined in container config, but it still not working .
What I also tried
xhost +local:
VK_LOADER_DEBUG=allshows nothing wrong (the output is the same as in the host)
nvidia.runtime true with/without
VK_DRIVER_FILES=/usr/share/vulkan/icd.d/nvidia_icd.json __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only vulkaninfo
and tried any other VK* environments. it does not work.
export DISPLAY=10.31.43.1:0
10.31.43.1 is the host IP in the incusbr0. I set DISPLAY like this when I work in a VM, and it works. But when comes to the container, vulkaninfoworks but vkcube :
debian@dev:~$ __NV_PRIME_RENDER_OFFLOAD=1 vkcube
Selected WSI platform: xcb
vkcube: ./cube/cube.c:4228: demo_select_physical_device: Assertion `demo->gpu_number >= 0' failed.
Aborted
x11:
path: /tmp/.X11-unix/
source: /tmp/.X11-unix/
type: disk
it does not even allow me to save container config.