[SOLUTION]: add gid: “44” under mygpu section of x11 profile, thanks, Simos!
Dear community, please advise why I encounter following: I can’t get GPU HW acceleration within container for non-root user. If I use sudo - all works.
Host/guest: ubuntu 20.10 groovy arm64 on raspberry pi 4.
Lxd 4.11 from snap
Unprivileged container
card1 is listed in printouts as I’m using hdmi1 (2nd HDMI) on my RPi, 1st HDMI out is not in use (nothing attached to it)
Sudo: glxinfo -B
Vendor: Broadcom (0x14e4)
Device: V3D 4.2 (0xffffffff)
Accelerated: yes
OpenGL renderer string: V3D 4.2
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
Regular:
libGL error: failed to create dri screen
libGL error: failed to load driver: vc4
libGL error: failed to open /dev/dri/card1: Permission denied
libGL error: failed to open /dev/dri/card1: Permission denied
libGL error: failed to load driver: vc4
Vendor: Mesa/X.org (0xffffffff)
Device: llvmpipe (LLVM 11.0.0, 128 bits) (0xffffffff)
Accelerated: no
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 11.0.0, 128 bits)
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20'
Container’s “id”:
uid=1000(ubuntu) gid=1002(ubuntu) groups=1002(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),1000(lxd),1001(netdev)
x11 profile:
config:
environment.DISPLAY: :0
user.user-data: |
#cloud-config
packages:
- x11-apps
- mesa-utils
description: GUI LXD profile
devices:
X0:
bind: container
connect: unix:@/tmp/.X11-unix/X0
listen: unix:@/tmp/.X11-unix/X0
security.gid: "1000"
security.uid: "1000"
type: proxy
mygpu:
type: gpu
name: x11
used_by:
Container was launched via “lxc launch images:ubuntu/20.10/cloud --profile default --profile PulseAudio --profile x11 --profile network-ext game-container”
Container is executed via “lxc exec game-container – sudo --user ubuntu --login”
Container config
architecture: aarch64
config:
environment.DISPLAY: :0
image.architecture: arm64
image.description: Ubuntu groovy arm64 (20210208_07:42)
image.os: Ubuntu
image.release: groovy
image.serial: "20210208_07:42"
image.type: squashfs
image.variant: cloud
user.network-config: |
version: 1
config:
- type: physical
name: eth0-int
subnets:
- type: dhcp
ipv4: true
- type: physical
name: eth1-ext
subnets:
- type: dhcp
ipv4: true
user.user-data: |
#cloud-config
packages:
- x11-apps
- mesa-utils
volatile.base_image: f1dd4b5d02fc7598399716c6c668dab62995a64ac070d51ffade142b40d9c29c
volatile.eth0-ext.host_name: veth61205fxx
volatile.eth0-ext.hwaddr: 00:16:3e:xx:xx:xx
volatile.eth0.host_name: veth8105e5xx
volatile.eth0.hwaddr: 00:16:3e:xx:xx:xx
volatile.eth1-ext.host_name: mac9dc2d9xx
volatile.eth1-ext.hwaddr: 00:16:3e:xx:xx:xx
volatile.eth1-ext.last_state.created: "false"
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.power: RUNNING
volatile.uuid: 5373be6d-b834-4336-b577-3e3889xxxxd3
devices:
PASocket:
bind: container
connect: unix:/run/user/1000/pulse/native
gid: "1002"
listen: unix:/home/ubuntu/.pulse-native
mode: "0777"
security.gid: "1000"
security.uid: "1000"
type: proxy
uid: "1000"
X0:
bind: container
connect: unix:@/tmp/.X11-unix/X0
listen: unix:@/tmp/.X11-unix/X0
security.gid: "1000"
security.uid: "1000"
type: proxy
eth0:
name: eth0
network: lxdbr0
type: nic
eth0-ext:
name: eth0-int
nictype: bridged
parent: lxdbr0
type: nic
eth1-ext:
name: eth1-ext
nictype: macvlan
parent: eth0
type: nic
mygpu:
type: gpu
root:
path: /
pool: default
type: disk
ephemeral: false
profiles:
- default
- PulseAudio
- x11
- network-ext
stateful: false
description: ""