nvidia gstreamer jetson

hello,
I am attempting to get my gstreamer application working on the jetson nano with Jetpack 4.4, but i run into a segmentation fault when inspecting the nvvidconv plugin.
any ideas on the cause?

Dockerfile:

FROM  balenalib/jetson-nano-ubuntu:bionic  

RUN  echo 'install jetpack4.4' &&\
    sed -i 's/r32 main/r32.4 main/g' /etc/apt/sources.list.d/nvidia.list &&\ 
    apt-get update &&\ 
    apt-get install -y nvidia-l4t-core &&\ 
    echo "/usr/lib/aarch64-linux-gnu/tegra" >> /etc/ld.so.conf.d/nvidia-tegra.conf &&\ 
    echo "/usr/lib/aarch64-linux-gnu/tegra-egl" >> /etc/ld.so.conf.d/nvidia-tegra.conf &&\ 
    apt-get install -y cuda-toolkit-10-2 &&\ 
    apt-get install -y nvidia-l4t-gstreamer &&\ 
    ldconfig

RUN echo 'install gstreamer tools' \ 
    apt-get -y install --reinstall libgstreamer1.0-0 gstreamer1.0-plugins-base \ 
    gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ 
    gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc \ 
    gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl \ 
    gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio \ 
    gobject-introspection gir1.2-gst-rtsp-server-1.0 && \ 
    ldconfig

ENTRYPOINT ["/bin/bash"]

the following results in segmentation fault:

gst-inspect-1.0 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so

Looks like that gstreamer plugin depends on the libraries in the BSP archive as well as on an active X display connection. So you’ll need those two:

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y wget tar lbzip2 python3 libegl1 && \
wget https://developer.nvidia.com/embedded/L4T/r32_Release_v4.2/t210ref_release_aarch64/Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
tar xf Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
cd Linux_for_Tegra && \
sed -i ‘s/config.tbz2"/config.tbz2" --exclude=etc/hosts --exclude=etc/hostname/g’ apply_binaries.sh && \
sed -i ‘s/install --owner=root --group=root "${QEMU_BIN}" "${L4T_ROOTFS_DIR}/usr/bin/"/#install --owner=root --group=root "${QEMU_BIN}" "${L4T_ROOTFS_DIR}/usr/bin/"/g’ nv_tegra/nv-apply-debs.sh && \
sed -i ‘s/LC_ALL=C chroot . mount -t proc none /proc/ /g’ nv_tegra/nv-apply-debs.sh && \
sed -i ‘s/umount ${L4T_ROOTFS_DIR}/proc/ /g’ nv_tegra/nv-apply-debs.sh && \
sed -i ‘s/chroot . // /g’ nv_tegra/nv-apply-debs.sh && \
./apply_binaries.sh -r / --target-overlay && cd - \
rm -rf Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
rm -rf Linux_for_Tegra && \
echo “/usr/lib/aarch64-linux-gnu/tegra” > /etc/ld.so.conf.d/nvidia-tegra.conf && ldconfig

RUN
apt-get install -y --no-install-recommends \
xserver-xorg-input-evdev \
xinit \
xfce4 \
xfce4-terminal \
x11-xserver-utils \
dbus-x11 \
xterm

ENV LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/tegra
ENV UDEV=1

// Prevent screen from turning off
RUN echo “#!/bin/bash” > /etc/X11/xinit/xserverrc
&& echo “” >> /etc/X11/xinit/xserverrc
&& echo ‘exec /usr/bin/X -s 0 dpms’ >> /etc/X11/xinit/xserverrc

You can then start X:

X &
export DISPLAY=:0
gst-inspect-1.0 nvvidconv

This is based on the X11 example for Jetson Nano.

the ‘sed’ commands give some issues because it recognizes ‘–exclude=etc/hosts’ as a flag, not a string.
i am currently attempting to fix it

Hi

Can you also share the logs? The dockerfile that this is based on has the same line and I believe it works fine

Step 3/5 : RUN     sed -i ‘s/config.tbz2\"/config.tbz2\" --exclude=etc/hosts --exclude=etc/hostname/g’ apply_binaries.sh &&     sed -i ‘s/install --owner=root --group=root “{QEMU_BIN}\" \"{L4T_ROOTFS_DIR}/usr/bin/”/#install --owner=root --group=root “{QEMU_BIN}\" \"{L4T_ROOTFS_DIR}/usr/bin/”/g’ nv_tegra/nv-apply-debs.sh &&     sed -i ‘s/LC_ALL=C chroot . mount -t proc none /proc/ /g’ nv_tegra/nv-apply-debs.sh &&     sed -i ‘s/umount ${L4T_ROOTFS_DIR}/proc/ /g’ nv_tegra/nv-apply-debs.sh &&     sed -i ‘s/chroot . // /g’ nv_tegra/nv-apply-debs.sh &&     ./apply_binaries.sh -r / --target-overlay && cd -     rm -rf Tegra210_Linux_R32.4.2_aarch64.tbz2 &&     rm -rf Linux_for_Tegra &&     echo “/usr/lib/aarch64-linux-gnu/tegra” > /etc/ld.so.conf.d/nvidia-tegra.conf && ldconfig
 ---> Running in fcc9e7dde430
sed: unrecognized option '--exclude=etc/hosts'
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
  --follow-symlinks
                 follow symlinks when processing in place
  -i[SUFFIX], --in-place[=SUFFIX]
                 edit files in place (makes backup if SUFFIX supplied)
  -l N, --line-length=N
                 specify the desired line-wrap length for the `l' command
  --posix
                 disable all GNU extensions.
  -E, -r, --regexp-extended
                 use extended regular expressions in the script
                 (for portability use POSIX -E).
  -s, --separate
                 consider files as separate rather than as a single,
                 continuous long stream.
      --sandbox
                 operate in sandbox mode.
  -u, --unbuffered
                 load minimal amounts of data from the input files and flush
                 the output buffers more often
  -z, --null-data
                 separate lines by NUL characters
      --help     display this help and exit
      --version  output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret.  All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
The command '/bin/sh -c sed -i ‘s/config.tbz2\"/config.tbz2\" --exclude=etc/hosts --exclude=etc/hostname/g’ apply_binaries.sh &&     sed -i ‘s/install --owner=root --group=root “{QEMU_BIN}\" \"{L4T_ROOTFS_DIR}/usr/bin/”/#install --owner=root --group=root “{QEMU_BIN}\" \"{L4T_ROOTFS_DIR}/usr/bin/”/g’ nv_tegra/nv-apply-debs.sh &&     sed -i ‘s/LC_ALL=C chroot . mount -t proc none /proc/ /g’ nv_tegra/nv-apply-debs.sh &&     sed -i ‘s/umount ${L4T_ROOTFS_DIR}/proc/ /g’ nv_tegra/nv-apply-debs.sh &&     sed -i ‘s/chroot . // /g’ nv_tegra/nv-apply-debs.sh &&     ./apply_binaries.sh -r / --target-overlay && cd -     rm -rf Tegra210_Linux_R32.4.2_aarch64.tbz2 &&     rm -rf Linux_for_Tegra &&     echo “/usr/lib/aarch64-linux-gnu/tegra” > /etc/ld.so.conf.d/nvidia-tegra.conf && ldconfig' returned a non-zero code: 1

i edited the sed commands based on the X11 example and this appears to be working

RUN apt-get update && apt-get install -y wget tar lbzip2 python3 libegl1 && \
    wget https://developer.nvidia.com/embedded/L4T/r32_Release_v4.2/t210ref_release_aarch64/Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
    tar xf Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
    cd Linux_for_Tegra &&\
    sed -i 's/config.tbz2\"/config.tbz2\" --exclude=etc\/hosts --exclude=etc\/hostname/g' apply_binaries.sh && \
    sed -i 's/install --owner=root --group=root \"${QEMU_BIN}\" \"${L4T_ROOTFS_DIR}\/usr\/bin\/\"/#install --owner=root --group=root \"${QEMU_BIN}\" \"${L4T_ROOTFS_DIR}\/usr\/bin\/\"/g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/LC_ALL=C chroot . mount -t proc none \/proc/ /g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/umount ${L4T_ROOTFS_DIR}\/proc/ /g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/chroot . \//  /g' nv_tegra/nv-apply-debs.sh && \
    ./apply_binaries.sh -r / --target-overlay && cd .. && \
    rm -rf Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
    rm -rf Linux_for_Tegra && \
    echo “/usr/lib/aarch64-linux-gnu/tegra” > /etc/ld.so.conf.d/nvidia-tegra.conf && ldconfig

Hi Jasper,

Good to hear it’s working for you too. Indeed, some of the backslashes got escaped automatically when I pasted the example.

quick note these lines seem to serve no purpose.

sed -i 's/LC_ALL=C chroot . mount -t proc none \/proc/ /g' nv_tegra/nv-apply-debs.sh && \
sed -i 's/umount ${L4T_ROOTFS_DIR}\/proc/ /g' nv_tegra/nv-apply-debs.sh && \

perhaps this is because of the version difference with the X11 example, but i am going to continue building with this assuming everything is correct.

Thanks for letting me know, will check and remove them if necessary, it’s possible that they slipped in from the previous BSP version. Or the BSP archive contents were updated in upstream, which has happened before.

i fixed a quick libcuda.so symlink error, but running the docker results in shared object errors.

output:

root@6e55ff8c0631:/# X & 
[1] 528
root@6e55ff8c0631:/# 
X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.15.0-124-generic aarch64 Ubuntu
Current Operating System: Linux 6e55ff8c0631 4.9.140-tegra #1 SMP PREEMPT Fri Oct 16 12:32:46 PDT 2020 aarch64
Kernel command line: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,2 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000  earlycon=uart8250,mmio32,0x70006000  root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 
Build Date: 30 November 2020  08:05:15PM
xorg-server 2:1.19.6-1ubuntu4.8 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.34.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Jan 13 12:56:05 2021
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"




root@2fe2055a9ef8:/# export DISPLAY=:0 
root@2fe2055a9ef8:/# gst-inspect-1.0 nvvidconv
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

nvbuf_utils: Could not get EGL display connection

(gst-plugin-scanner:20): GStreamer-WARNING **: 12:41:49.464: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so': libnvidia-fatbinaryloader.so.440.18: cannot open shared object file: No such file or directory

(gst-plugin-scanner:20): GStreamer-WARNING **: 12:41:49.468: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideocuda.so': libnvidia-fatbinaryloader.so.440.18: cannot open shared object file: No such file or directory
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

nvbuf_utils: Could not get EGL display connection
Factory Details:
  Rank                     primary (256)
  Long-name                NvVidConv Plugin
  Klass                    Filter/Converter/Video/Scaler
  Description              Converts video from one colorspace to another & Resizes
  Author                   amit pandya <apandya@nvidia.com>

Plugin Details:
  Name                     nvvidconv
  Description              video Colorspace conversion & scaler
  Filename                 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so
  Version                  1.2.3
  License                  Proprietary
  Source module            gstreamer-nvvconv-plugin
  Binary package           GStreamer nvvconv Plugin
  Origin URL               http://nvidia.com/

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseTransform
                         +----Gstnvvconv

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)I420, (string)I420_10LE, (string)P010_10LE, (string)I420_12LE, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)GRAY8, (string)BGRx, (string)RGBA }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)P010_10LE, (string)GRAY8, (string)BGRx, (string)RGBA }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
  
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)I420, (string)I420_10LE, (string)P010_10LE, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)GRAY8, (string)BGRx, (string)RGBA }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)UYVY, (string)YUY2, (string)YVYU, (string)NV12, (string)NV16, (string)NV24, (string)GRAY8, (string)BGRx, (string)RGBA }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "nvvconv0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  qos                 : Handle Quality-of-Service events
                        flags: readable, writable
                        Boolean. Default: false
  silent              : Produce verbose output ?
                        flags: readable, writable
                        Boolean. Default: false
  flip-method         : video flip methods
                        flags: readable, writable, controllable
                        Enum "GstNvVideoFlipMethod" Default: 0, "none"
                           (0): none             - Identity (no rotation)
                           (1): counterclockwise - Rotate counter-clockwise 90 degrees
                           (2): rotate-180       - Rotate 180 degrees
                           (3): clockwise        - Rotate clockwise 90 degrees
                           (4): horizontal-flip  - Flip horizontally
                           (5): upper-right-diagonal - Flip across upper right/lower left diagonal
                           (6): vertical-flip    - Flip vertically
                           (7): upper-left-diagonal - Flip across upper left/lower right diagonal
  output-buffers      : number of output buffers
                        flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
                        Unsigned Integer. Range: 1 - 4294967295 Default: 4 
  interpolation-method: Set interpolation methods
                        flags: readable, writable, controllable
                        Enum "GstInterpolationMethod" Default: 0, "Nearest"
                           (0): Nearest          - Nearest
                           (1): Bilinear         - Bilinear
                           (2): 5-Tap            - 5-Tap
                           (3): 10-Tap           - 10-Tap
                           (4): Smart            - Smart, this is default
                           (5): Nicest           - Nicest
  left                : Pixels to crop at left
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  right               : Pixels to crop at right
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  top                 : Pixels to crop at top
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  bottom              : Pixels to crop at bottom
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 

dockerfile:

FROM  balenalib/jetson-nano-ubuntu:bionic  
ENV DEBIAN_FRONTEND noninteractive

RUN echo 'install L4T BPS binaries' &&\
    apt-get update && apt-get install -y wget tar lbzip2 python3 libegl1 && \
    wget https://developer.nvidia.com/embedded/L4T/r32_Release_v4.2/t210ref_release_aarch64/Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
    tar xf Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
    cd Linux_for_Tegra &&\
    sed -i 's/config.tbz2\"/config.tbz2\" --exclude=etc\/hosts --exclude=etc\/hostname/g' apply_binaries.sh && \
    sed -i 's/install --owner=root --group=root \"${QEMU_BIN}\" \"${L4T_ROOTFS_DIR}\/usr\/bin\/\"/#install --owner=root --group=root \"${QEMU_BIN}\" \"${L4T_ROOTFS_DIR}\/usr\/bin\/\"/g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/LC_ALL=C chroot . mount -t proc none \/proc/ /g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/umount ${L4T_ROOTFS_DIR}\/proc/ /g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/chroot . \//  /g' nv_tegra/nv-apply-debs.sh && \
    ./apply_binaries.sh -r / --target-overlay && cd .. && \
    rm -rf Tegra210_Linux_R32.4.2_aarch64.tbz2 && \
    rm -rf Linux_for_Tegra && \
    echo “/usr/lib/aarch64-linux-gnu/tegra” > /etc/ld.so.conf.d/nvidia-tegra.conf && ldconfig

RUN echo 'install X11 display' &&\
    apt-get install -y --no-install-recommends \
    xserver-xorg-input-evdev \
    xinit \
    xfce4 \
    xfce4-terminal \
    x11-xserver-utils \
    dbus-x11 \
    xterm

ENV LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/tegra
ENV UDEV=1

RUN echo 'prevent display turning off' &&\
    echo “#!/bin/bash” > /etc/X11/xinit/xserverrc &&\
    echo “” >> /etc/X11/xinit/xserverrc &&\
    echo ‘exec /usr/bin/X -s 0 dpms’ >> /etc/X11/xinit/xserverrc

RUN echo 'fix symlink' &&\
    ln -s /usr/lib/aarch64-linux-gnu/libcuda.so /usr/lib/aarch64-linux-gnu/libcuda.so.1 &&\
    ldconfig

RUN echo 'install gstreamer tools' &&\ 
    apt-get -y install --reinstall libgstreamer1.0-0 gstreamer1.0-plugins-base \
    gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
    gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc \
    gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl \
    gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio \
    gobject-introspection gir1.2-gst-rtsp-server-1.0 && \
    ldconfig

ENTRYPOINT ["/bin/bash"]

perhaps a little more context would help. for my application im trying to open an rtsp stream with opencv (which already works in containers with --runtime nvidia ).
furthermore, deepstream elements are extremely usefull, but i could find a workaround if required.

import cv2
cap = cv2.VideoCapture("rtspsrc location=rtsp://192.168.178.22/test latency=10 ! queue ! decodebin ! nvvidconv ! video/x-raw, width=1280 , height=720 ,format=(string)BGRx   ! appsink")
cap.read()

About the missing libraries, first step would be to check if the packages that bring them are installed in your Dockerfile. For instance the package nvidia-l4t-gstreamer which brings libgstnvarguscamerasrc.so is present in your first Dockerfile, but not in the last one.

Haven’t used deepstream so far but let us know if you get it working.

changing /etc/apt/sources.list.d/nvidia.list to R32.4 updates all packages(including L4T-core) to 32.4.4
since the X11 example is based on 32.4.2, would you assume installing nvidia-l4t-gstreamer 32.4.4 could work or do i need do up/downgrade one of them

Hey there, that’s a good question. I expect 32.4.4 apt binaries would be somewhat compatible with the 32.4.2 BSP files, but in case they aren’t you could try pointing to a newer BSP package like this one:
https://developer.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T210/Tegra210_Linux_R32.4.4_aarch64.tbz2

That way your apt packages would match your BSP packages and offer the best chance of compatibility.

i upgraded everything to 32.4.4 but ‘gst-inspect-1.0 nvvidconv’ still results in a segmentation error

.......lots of plugin properties
  bl-output           : Blocklinear output, applicable only for memory:NVMM NV12 format output buffer
                        flags: readable, writable
                        Boolean. Default: true
Segmentation fault (core dumped)

  bottom              : Pixels to crop at bottom
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  bl-output           : Blocklinear output, applicable only for memory:NVMM NV12 format output buffer
                        flags: readable, writable
                        Boolean. Default: true
Segmentation fault (core dumped)

i did notice that the error is only related to nvvidconv. the hardware accelerated decoder for example seems to work fine ‘gst-inspect-1.0 nvv4l2decoder’

am i wrong to assume that the docker would be able to run on a regular jetson nano(no balena OS)?

latest dockerfile:

FROM  balenalib/jetson-nano-ubuntu:bionic  

ENV BSP Jetson-210_Linux_R32.4.4_aarch64.tbz2
# ENV BSP Tegra210_Linux_R32.4.4_aarch64.tbz2
COPY ./${BSP} .

RUN echo 'install L4T BPS binaries' &&\
    apt-get update && \
    apt-get install -y wget tar lbzip2 python3 libegl1 && \
    tar xf ${BSP} && \
    cd Linux_for_Tegra &&\
    sed -i 's/config.tbz2\"/config.tbz2\" --exclude=etc\/hosts --exclude=etc\/hostname/g' apply_binaries.sh && \
    sed -i 's/install --owner=root --group=root \"${QEMU_BIN}\" \"${L4T_ROOTFS_DIR}\/usr\/bin\/\"/#install --owner=root --group=root \"${QEMU_BIN}\" \"${L4T_ROOTFS_DIR}\/usr\/bin\/\"/g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/LC_ALL=C chroot . mount -t proc none \/proc/ /g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/umount ${L4T_ROOTFS_DIR}\/proc/ /g' nv_tegra/nv-apply-debs.sh && \
    sed -i 's/chroot . \//  /g' nv_tegra/nv-apply-debs.sh && \
    ./apply_binaries.sh -r / --target-overlay && cd .. && \
    rm -rf ${BSP} && \
    rm -rf Linux_for_Tegra && \
    echo "/usr/lib/aarch64-linux-gnu/tegra" > /etc/ld.so.conf.d/nvidia-tegra.conf && \
    echo "/usr/lib/aarch64-linux-gnu/tegra-egl" > /etc/ld.so.conf.d/nvidia-tegra-egl.conf && \
    echo "${CUDA_HOME}/targets/aarch64-linux/lib" > /etc/ld.so.conf.d/cuda-10-2.conf && \
    ldconfig

RUN echo 'upgrading apt-sources' &&\ 
    sed -i 's/r32 main/r32.4 main/g' /etc/apt/sources.list.d/nvidia.list &&\
    apt-get update &&\
    apt-get install -y nvidia-l4t-core \
    nvidia-l4t-cuda \
    nvidia-l4t-gstreamer \
    nvidia-l4t-firmware \
    nvidia-l4t-multimedia-utils \
    nvidia-l4t-multimedia \
    nvidia-l4t-gstreamer \
    ldconfig

Hi Jasper,

With the previous Dockerfile you mentioned gst-inspect was no longer crashing. You also mentioned that you were seeing some errors or warnings. Were those warnings or errors affecting your application? If yes, which exact errors were affecting it?

I suggest we stick to the 32.4.2 Dockerfile from above with which the gst-inspect doesn’t crash, isolate error or warning that has an impact on the app and then find the library that causes the issue.

i will stick to 32.4.2 i mentioned having the errors in the Dockerfile fixed but the application itself is not yet working.

segmentation error is gone (for now) by first building BSP, then building CUDA-10.2
and the previous error is fixed with a simple symlink

    ln -s /usr/lib/aarch64-linux-gnu/tegra/libnvidia-fatbinaryloader.so.32.4.2  /usr/lib/aarch64-linux-gnu/tegra/libnvidia-fatbinaryloader.so.440.18 &&\

‘gst-inspect-1.0 nvvidconv’ still has the following warning but that is most likely related to the X-server (on my to-do list)

nvbuf_utils: Could not get EGL display connection
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

i am currently building entire application (opencv and deepstream) to see if everything works, but worth noting is that ‘apt show nvidia-l4t-gstreamer’ returns Version: 32.3.1. could it cause issues to remain at the current version?

If you do apt-show nvidia-l4t-gstreamer -a you’ll see all the available versions for the repositories that you set. I have 32.4 set in my sources.list and these are the available versions I see, installable with apt-get install package=version.

Version: 32.4.4-20201016124427
Version: 32.4.3-20200728230650
Version: 32.4.3-20200625213809
Version: 32.4.2-20200423124921
Version: 32.4.2-20200408182156

So if you are using the 32.4.2 BSP you should install 32.4.2 packages. If you see 32.3.1 it’s likely because your sources.list has r32 and not r32.4.

thanks, this makes some installations a lot easier.

#the rest is basically a copy of the X11 example
ARG version=32.4.2-20200423124921
ARG config=--force-confdef # keep old config files
RUN echo 'upgrading apt-sources' &&\
    sed -i 's/r32 main/r32.4 main/g' /etc/apt/sources.list.d/nvidia.list &&\
    apt-get update &&\
    apt-get install -y -o Dpkg::Options::=$config nvidia-l4t-gstreamer=$version

segmentation fault is no issue anymore, but i still get the same warnings though. im currently building opencv with gstreamer to see if this becomes a relevant problem

root@devkit:/# echo $DISPLAY
:0
root@devkit:/# gst-inspect-1.0 nvvidconv
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

nvbuf_utils: Could not get EGL display connection
libEGL warning: DRI2: failed to authenticate
libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

libEGL warning: MESA-LOADER: failed to open swrast (search paths /usr/lib/aarch64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)

nvbuf_utils: Could not get EGL display connection
Factory Details:
#### some nvvidconv properties
#
#

Hi, it looks like the warnings appear to happen with nvidia ubuntu too and have various solutions in the nvidia forums. I would encourage you to try to find and install the right packages in the container that would solve the issue for you.
Thanks,
Zahari