Installing ros2 humble on Jetson Xavier

I am trying to install ROS2 Humble on a Jetson Xavier with ultralytics support. My Dockerfile is essentially

FROM ultralytics/ultralytics:latest-jetson

and then copy-paste of the Dockerfile provided on the NVIDIA-ISAAC-ROS GitHub page and suggested in a different discussion ROS2 on AGX Xavier using Jetpack 5.0 (without container).
Unfortunately it returns an error that I am unable to solve, first there is a warning

debconf: delaying package configuration, since apt-utils is not installed

then it unpacks and installs multiple packages and prints the following warning

Preparing to unpack .../281-libopencv-dev_4.5.4-8-g3e4c170df4_arm64.deb ...
Unpacking libopencv-dev (4.5.4-8-g3e4c170df4) ...
dpkg: error processing archive /tmp/apt-dpkg-install-jbfxvr/281-libopencv-dev_4.5.4-8-g3e4c170df4_arm64.deb (--unpack):
 trying to overwrite '/usr/bin/opencv_annotation', which is also in package opencv-dev 4.5.0
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

and finally it breaks with the following message

Errors were encountered while processing:
 /tmp/apt-dpkg-install-jbfxvr/259-libopencv_4.5.4-8-g3e4c170df4_arm64.deb
 /tmp/apt-dpkg-install-jbfxvr/281-libopencv-dev_4.5.4-8-g3e4c170df4_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Does anyone know how to fix this problem?

Hi,

Could you add the below to the Dockerfile to see if it helps?

RUN apt-get update && apt-get install -y apt-utils

Thanks

I tried to add both the line you suggested and also the following due to the error message referring to the package opencv-dev.

RUN dpkg -P opencv-dev
RUN apt install -f

Having done so made the libopencv-dev.deb error disappear but I’m still encountering the other error

Errors were encountered while processing:
 /tmp/apt-dpkg-install-geQ8Xr/259-libopencv_4.5.4-8-g3e4c170df4_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hi,

Would you mind sharing your complete Dockerfile so we can take a look?
Thanks.

Yes of course, here is the complete Dockerfile I am using

FROM ultralytics/ultralytics:latest-jetson

# Network Configuration
RUN echo 'Acquire::http::Proxy "http://10.72.72.1:3128";' >> /etc/apt/apt.conf
RUN echo 'Acquire::https::Proxy "http://10.72.72.1:3128";' >> /etc/apt/apt.conf

ENV HTTP_PROXY=10.72.72.1:3128
ENV HTTPS_PROXY=10.72.72.1:3128
ENV http_proxy=10.72.72.1:3128
ENV https_proxy=10.72.72.1:3128
ENV NO_PROXY=localhost,192.168.0.0/16,172.17.0.0/16


RUN apt-get update && apt-get install -y apt-utils

# disable terminal interaction for apt
ENV DEBIAN_FRONTEND=noninteractive
ENV SHELL /bin/bash
SHELL ["/bin/bash", "-c"]

# Env setup
RUN locale-gen en_US en_US.UTF-8
RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV ROS_PYTHON_VERSION=3
ENV ROS_DISTRO=humble
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp

# Avoid setup.py and easy_install deprecation warnings caused by colcon and setuptools
# https://github.com/colcon/colcon-core/issues/454
ENV PYTHONWARNINGS=ignore:::setuptools.command.install,ignore:::setuptools.command.easy_install,ignore:::pkg_resources
RUN echo "Warning: Using the PYTHONWARNINGS environment variable to silence setup.py and easy_install deprecation warnings caused by colcon"

# Add ROS 2 apt repository
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2-testing/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null

# Add Isaac apt repository
RUN wget -qO - https://isaac.download.nvidia.com/isaac-ros/repos.key | apt-key add - && \
    grep -qxF 'deb https://isaac.download.nvidia.com/isaac-ros/ubuntu/main focal main' /etc/apt/sources.list || \
    echo 'deb https://isaac.download.nvidia.com/isaac-ros/ubuntu/main focal main' | tee -a /etc/apt/sources.list
   
# Basics
RUN apt-get update && apt-get install -y \
        curl \
        gnupg \
        lsb-release \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# ROS fundamentals
RUN apt-get update && apt-get install -y \
        build-essential \
        git \
        libyaml-cpp-dev=0.7.0+dfsg-8backport \
        python3-colcon-common-extensions \
        python3-pip \
        python3-pybind11 \
        python3-pytest-cov \
        python3-rosdep \
        python3-rosinstall-generator \
        python3-vcstool \
        wget \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# ROS Python fundamentals
RUN python3 -m pip install -U \
        flake8-blind-except \
        flake8-builtins \
        flake8-class-newline \
        flake8-comprehensions \
        flake8-deprecated \
        flake8-docstrings \
        flake8-import-order \
        flake8-quotes \
        pytest-repeat \
        pytest-rerunfailures \
        pytest \
        setuptools==65.7.0

# Basics
RUN apt-get update && apt-get install -y \
        curl \
        gnupg \
        locales \
        lsb-release \
        python3-bloom \
        libxtensor-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean


RUN dpkg -P opencv-dev
RUN apt install -f

# Install ROS 2 Humble
RUN apt-get update && apt-get install -y ros-humble-ros-base \
    ros-humble-angles \
    ros-humble-apriltag \
    ros-humble-behaviortree-cpp-v3 \
    ros-humble-bondcpp \
    ros-humble-camera-calibration-parsers \
    ros-humble-camera-info-manager \
    ros-humble-compressed-image-transport \
    ros-humble-compressed-depth-image-transport \
    ros-humble-cv-bridge \
    ros-humble-demo-nodes-cpp \
    ros-humble-demo-nodes-py \
    ros-humble-diagnostic-updater \
    ros-humble-example-interfaces \
    ros-humble-foxglove-bridge \
    ros-humble-image-geometry \
    ros-humble-image-pipeline \
    ros-humble-image-transport \
    ros-humble-image-transport-plugins \
    ros-humble-launch-xml \
    ros-humble-launch-yaml \
    ros-humble-launch-testing \
    ros-humble-launch-testing-ament-cmake \
    ros-humble-nav2-bringup \
    ros-humble-nav2-msgs \
    ros-humble-nav2-mppi-controller \
    ros-humble-navigation2 \
    ros-humble-ompl \
    ros-humble-resource-retriever \
    ros-humble-rqt-graph \
    ros-humble-rqt-reconfigure \
    ros-humble-rqt-image-view \
    ros-humble-rviz2 \
    ros-humble-rviz-common \
    ros-humble-rviz-default-plugins \
    ros-humble-sensor-msgs \
    ros-humble-slam-toolbox \
    ros-humble-v4l2-camera \
    ros-humble-vision-opencv \
    ros-humble-vision-msgs \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Build Essentials
RUN apt-get update && apt-get install -y \
    build-essential \
    devscripts \
    dh-make \
    quilt \
    fakeroot \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Setup rosdep
RUN rosdep init \
    && mkdir -p /etc/ros/rosdep/sources.list.d/ \
    && curl -o /etc/ros/rosdep/sources.list.d/nvidia-isaac.yaml https://isaac.download.nvidia.com/isaac-ros/extra_rosdeps.yaml \
    && echo "yaml file:///etc/ros/rosdep/sources.list.d/nvidia-isaac.yaml" | tee /etc/ros/rosdep/sources.list.d/00-nvidia-isaac.list \
    && rosdep update

####### -- Install updated packages over installed debians

# Install negotiated from source
RUN apt-get update && mkdir -p ${ROS_ROOT}/src && cd ${ROS_ROOT}/src \
    && git clone https://github.com/osrf/negotiated && cd negotiated && git checkout master \
    && source ${ROS_ROOT}/setup.bash \
    && cd negotiated_interfaces && bloom-generate rosdebian && fakeroot debian/rules binary \
    && cd ../ && apt-get install -y ./*.deb && rm ./*.deb \
    && cd negotiated && bloom-generate rosdebian && fakeroot debian/rules binary \
    && cd ../ && apt-get install -y ./*.deb && rm ./*.deb \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Install vda5050_msgs from source
RUN apt-get update && mkdir -p ${ROS_ROOT}/src && cd ${ROS_ROOT}/src \
    && git clone https://github.com/ipa320/vda5050_msgs.git vda5050_root \
    && cd vda5050_root && git checkout ros2 && cd .. \
    && mv vda5050_root/vda5050_msgs/ vda5050_msgs \
    && rm -rf vda5050_root \
    && source ${ROS_ROOT}/setup.bash \
    && cd vda5050_msgs && bloom-generate rosdebian && fakeroot debian/rules binary \
    && cd ../ && apt-get install -y ./*.deb \
    && cd ../ && rm -Rf src build log \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Install image_proc from 55bf2a38 with backported resize node fix
# https://github.com/ros-perception/image_pipeline/pull/786/commits/969d6c763df99b42844742946f7a70c605a72a15
# Revert breaking QoS changes in https://github.com/ros-perception/image_pipeline/pull/814
RUN apt-get update && mkdir -p ${ROS_ROOT}/src && cd ${ROS_ROOT}/src \
    && git clone https://github.com/ros-perception/image_pipeline.git && cd image_pipeline && git checkout 55bf2a38c327b829c3da444f963a6c66bfe0598f \
    && git config user.email "builder@nvidia.com" && git config user.name "NVIDIA Builder" \
    && git remote add fork https://github.com/schornakj/image_pipeline.git && git fetch fork && git cherry-pick 969d6c763df99b42844742946f7a70c605a72a15 \
    && source ${ROS_ROOT}/setup.bash \
    && cd image_proc && bloom-generate rosdebian && fakeroot debian/rules binary \
    && cd ../ && apt-get install -y --allow-downgrades ./*.deb \
    && echo "image_pipeline (image_proc) https://github.com/ros-perception/image_pipeline/pull/786/commits/969d6c763df99b42844742946f7a70c605a72a15 on 55bf2a38" >> ${ROS_ROOT}/VERSION \
    && cd ../ && rm -Rf src build log \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Install patched rclcpp package with backported multithreadedexecutor fix
# https://github.com/ros2/rclcpp/commit/232262c02a1265830c7785b7547bd51e1124fcd8
COPY patches/rclcpp-disable-tests.patch /tmp/
RUN apt-get update && mkdir -p ${ROS_ROOT}/src && cd ${ROS_ROOT}/src \
    && export RCLCPP_VERSION="release/humble/rclcpp/$(apt-cache madison ros-humble-rclcpp | grep -m1 -oP 'ros-humble-rclcpp \| \K[^f]+(?=focal)')" \
    && echo ${RCLCPP_VERSION} \
    && git clone https://github.com/ros2-gbp/rclcpp-release.git && cd rclcpp-release && git checkout ${RCLCPP_VERSION} \
    && patch -i /tmp/rclcpp-disable-tests.patch \
    && unset RCLCPP_VERSION \
    && git config user.email "builder@nvidia.com" && git config user.name "NVIDIA Builder" \
    && git remote add rclcpp https://github.com/ros2/rclcpp.git && git fetch rclcpp \
    && git cherry-pick 232262c02a1265830c7785b7547bd51e1124fcd8 \
    && source ${ROS_ROOT}/setup.bash \
    && cd ../ && rosdep install -i -r --from-paths rclcpp-release/ --rosdistro humble -y \
    && cd rclcpp-release && bloom-generate rosdebian && fakeroot debian/rules binary \
    && cd ../ && apt-get install -y --allow-downgrades ./*.deb \
    && echo "rclcpp https://github.com/ros2/rclcpp/commit/232262c02a1265830c7785b7547bd51e1124fcd8" >> ${ROS_ROOT}/VERSION \
    && cd ../ && rm -Rf src build log \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Install additional ROS packages
RUN apt-get update && apt-get install -y \
    ros-humble-camera-info-manager \
    ros-humble-rosbag2 \
    ros-humble-rosbag2-compression-zstd \
    ros-humble-rosbag2-cpp \
    ros-humble-rosbag2-py \
    ros-humble-rosbridge-suite \
    ros-humble-rqt-graph \
    ros-humble-rqt-reconfigure \
    ros-humble-rviz-common \
    ros-humble-rviz-default-plugins \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

Hi,

Could you try to use the ros base below to see if the same issue?

For example: dustynv/ros:humble-ros-base-l4t-r35.2.1

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.