Accessing nvarguscamera within docker as non root user [resolve file permissions]

Note: My jetpack version = 4.4 | platform AGX Xavier

Hi,
I’m trying to do the things below in a docker container (all works fine without/outside docker)

  • Build the jetson multimedia api within docker [working]
  • Install [working]
  • run argus_camera [not working as non root user]

observations

non root user can’t run argus_camera

nvidia@jetson:~$ argus_camera
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession

root user can! (and it works fine)

root@jetson:/home/nvidia# argus_camera
Executing Argus Sample Application (argus_camera)
Argus Version: 0.97.3 (multi-process)
^Croot@jetson:/home/nvidia# 

also if i do a gst-inspect -b as root I get better results

root@jetson:/home/nvidia# gst-inspect-1.0 -b
Blacklisted files:
  libnvdsgst_infer.so
  libnvdsgst_inferserver.so
  libnvdsgst_osd.so

if I do the same as non root:

nvidia@jetson:~$ gst-inspect-1.0 -b
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
2021-12-21 12:43:40.746802: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
nvbufsurftransform:cuInit failed : 100 
2021-12-21 12:43:41.158661: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
nvbufsurftransform:cuInit failed : 100 
Blacklisted files:
  libnvdsgst_infer.so
  libgstnvvideoconvert.so
  libnvdsgst_multistream.so
  libnvdsgst_tracker.so
  libnvdsgst_dsexample.so
  libnvdsgst_dewarper.so
  libnvdsgst_inferserver.so
  libnvdsgst_multistreamtiler.so
  libnvdsgst_osd.so
  libgstnvjpeg.so
  libgstnvarguscamerasrc.so
  libgstnvvideosinks.so
  libgstnvdrmvideosink.so
  libgstnvv4l2camerasrc.so
  libgstnvvideo4linux2.so
  libgstomx.so
  libgstnvcompositor.so
  libgstnvvidconv.so
  libgstnvivafilter.so

Total count: 19 blacklisted files
nvidia@jetson:~$ 

I think the workaround is to give the same (uid:gid) rwx privilages to a phantom user in the host (jetson) as (same uid:gid) my non root user (in docker) but I don’t exactly know what files (this is just my suspicion) please help.

Cheers,
Ganindu.

@D3_growe (I’ve tagged you just in case)

P.S cache clearing or ldd/ldconfig tricks don’t work (because it’s likely a filesystem/permissions error) also please note that my jetson username:uid:gid(nvidia:1000:1000) is replicated inside the docker container.