NvRmMemInitNvmap failed with Permission denied when pyds launched in docker without sudo

Setup info

• Hardware Platform (Jetson / GPU) Jetson AGX Orin
• DeepStream Version 6.2 (inside of docker)
• JetPack Version (valid for Jetson only) 5.1.1 (L4T 35.3.1)
• Issue Type( questions, new requirements, bugs) BUG

Problem

When I try to launch deepstream apps or try to import pyds in python I get NvRmMemInitNvmap failed with Permission denied

Reproduction

Build docker:

FROM nvcr.io/nvidia/deepstream-l4t:6.2-base

# Usefull tools, apps and libraries
RUN apt-get update && apt install -y \
    g++ gcc git automake \
    ffmpeg wget sudo htop x11-apps nano xonsh \
    libopenmpt-dev python3-pip python3-gi  

RUN useradd -ms /bin/bash -G sudo myuser && echo "myuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu
ENV TERM=xterm-256color
USER myuser
WORKDIR /home/myuser

RUN sudo apt install -y libcairo2-dev

RUN wget https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/releases/download/v1.1.6/pyds-1.1.6-py3-none-linux_aarch64.whl && \
    pip3 install ./pyds-1.1.6-py3-none-linux_aarch64.whl
# TAG v1.1.6 is meant for deepstream 6.2

docker build --tag pyds-jetson .

Run docker:

docker run -it --rm --net=host --runtime nvidia -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-6.3 -v /tmp/.X11-unix/:/tmp/.X11-unix pyds-jetson:latest

Open python and try to import pyds

myuser@ubuntu:~$ python3
Python 3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyds
NvRmMemInitNvmap failed with Permission denied
549: Memory Manager Not supported

****NvRmMemInit failed**** error type: 196626

*** NvRmMemInit failed NvRmMemConstructor
>>> 

The only way to avoid this problem is to install pyds and launch it with sudo.

I tried to run it wich changed -u flag like in NvRmMemInitNvmap failed with Permission denied - #7
But it did not help

Since my AGX Orin has been upgraded, I tried to reproduce the problem on the DS-6.3 and DS-6.4 versions.

If I use the DS-6.4 version and modify the dockerfile to have the following. It work fine.

FROM nvcr.io/nvidia/deepstream-l4t:6.4-triton-multiarch

# pyds to the 1.1.10 verion
pyds-1.1.10-py3-none-linux_aarch64.whl

If I use nvcr.io/nvidia/deepstream:6.3-triton-multiarch with pyds-1.1.8, I will be able to reproduce the problem.

So there are two ways to solve this problem
1.Upgrade to Jetpack 6.0 and DS-6.4

2.Change your dockerfile like below, I have tried this and it works perfectly

RUN useradd -ms /bin/bash -G sudo,audio,video,render myuser && echo "myuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu

By the way

You can use groups “your host user” to get the groups to which the host user belongs and add myuser to them

Thank you, this solves my issue.

That’s great you provided 2 solutions both of them will be useful for my team.