Hello,
We have tried to follow that guide and updated the Dockerfile.user
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# Setup non-root admin user
ARG USERNAME=admin
ARG USER_UID=1000
ARG USER_GID=1000
ARG GPIO_GID=999
# Install prerequisites
RUN apt-get update && apt-get install -y \
sudo \
udev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Create GPIO group
RUN groupadd --gid ${GPIO_GID} gpio
# Reuse triton-server user as 'admin' user if exists
RUN if [ $(getent group triton-server) ]; then \
groupmod -o --gid ${USER_GID} -n ${USERNAME} triton-server ; \
usermod -l ${USERNAME} -u ${USER_UID} -m -d /home/${USERNAME} triton-server ; \
mkdir -p /home/${USERNAME} ; \
sudo chown ${USERNAME}:${USERNAME} /home/${USERNAME} ; \
fi
# Create the 'admin' user if not already exists
RUN if [ ! $(getent passwd ${USERNAME}) ]; then \
groupadd --gid ${USER_GID} ${USERNAME} ; \
useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} ; \
fi
# Update 'admin' user
RUN usermod -aG gpio,video,plugdev,sudo ${USERNAME} \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
# Copy scripts
RUN mkdir -p /usr/local/bin/scripts
COPY scripts/*entrypoint.sh /usr/local/bin/scripts/
RUN chmod +x /usr/local/bin/scripts/*.sh
# Copy middleware profiles
RUN mkdir -p /usr/local/share/middleware_profiles
COPY middleware_profiles/*profile.xml /usr/local/share/middleware_profiles/
# Install stuff
RUN python3 -m pip install -U \
pyserial \
Jetson.GPIO
ENV USERNAME=${USERNAME}
ENV USER_GID=${USER_GID}
ENV USER_UID=${USER_UID}
We’ve added the following:
ARG GPIO_GID=999
# Create GPIO group
RUN groupadd --gid ${GPIO_GID} gpio
# Update 'admin' user
RUN usermod -aG gpio,video,plugdev,sudo ${USERNAME} \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
Running the ID commands yields the following:
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/src$ id
uid=1000(admin) gid=1000(admin) groups=1000(admin),27(sudo),44(video),46(plugdev),999(gpio)
We’ve also tried running the setup.py install from Jetson.GPIO library within the contaienr but we still get permission errors.
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/jetson-gpio$ python3 setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/lib/python3.8/site-packages'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib/python3.8/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/jetson-gpio$ sudo python3 setup.py install
running install
/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/local/lib/python3.8/dist-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 2.20.2ubuntu2 is an invalid version and will not be supported in a future release
warnings.warn(
running bdist_egg
running egg_info
writing lib/python/Jetson.GPIO.egg-info/PKG-INFO
writing dependency_links to lib/python/Jetson.GPIO.egg-info/dependency_links.txt
writing top-level names to lib/python/Jetson.GPIO.egg-info/top_level.txt
reading manifest file 'lib/python/Jetson.GPIO.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'LICENCE.txt'
adding license file 'LICENSE.txt'
writing manifest file 'lib/python/Jetson.GPIO.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/Jetson
copying build/lib/Jetson/__init__.py -> build/bdist.linux-aarch64/egg/Jetson
creating build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio_cdev.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/__init__.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/99-gpio.rules -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio_event.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
copying build/lib/Jetson/GPIO/gpio_pin_data.py -> build/bdist.linux-aarch64/egg/Jetson/GPIO
creating build/bdist.linux-aarch64/egg/RPi
copying build/lib/RPi/__init__.py -> build/bdist.linux-aarch64/egg/RPi
creating build/bdist.linux-aarch64/egg/RPi/GPIO
copying build/lib/RPi/GPIO/__init__.py -> build/bdist.linux-aarch64/egg/RPi/GPIO
byte-compiling build/bdist.linux-aarch64/egg/Jetson/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_cdev.py to gpio_cdev.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_event.py to gpio_event.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio.py to gpio.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/Jetson/GPIO/gpio_pin_data.py to gpio_pin_data.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/RPi/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-aarch64/egg/RPi/GPIO/__init__.py to __init__.cpython-38.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying lib/python/Jetson.GPIO.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/Jetson.GPIO-2.1.4-py3.8.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing Jetson.GPIO-2.1.4-py3.8.egg
Copying Jetson.GPIO-2.1.4-py3.8.egg to /usr/lib/python3.8/site-packages
Adding Jetson.GPIO 2.1.4 to easy-install.pth file
Installed /usr/lib/python3.8/site-packages/Jetson.GPIO-2.1.4-py3.8.egg
Processing dependencies for Jetson.GPIO==2.1.4
Finished processing dependencies for Jetson.GPIO==2.1.4
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/jetson-gpio$ cd ..
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff$ cd src/
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/src$ ls
allocate_thrust.py frskytest.py thruster_test.py trhuster.py
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/src$ python3 thruster_test.py
/usr/local/lib/python3.8/dist-packages/Jetson/GPIO/gpio_event.py:182: RuntimeWarning: Event not found
warnings.warn("Event not found", RuntimeWarning)
Initializing thruster...
^CTraceback (most recent call last):
File "thruster_test.py", line 19, in <module>
time.sleep(2) # Allow 2 seconds for initialization
KeyboardInterrupt
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/src$ sudo python3 thruster_test.py
/usr/local/lib/python3.8/dist-packages/Jetson/GPIO/gpio_event.py:182: RuntimeWarning: Event not found
warnings.warn("Event not found", RuntimeWarning)
Initializing thruster...
Press Enter to proceed with thrust control...^CTraceback (most recent call last):
File "thruster_test.py", line 22, in <module>
input("Press Enter to proceed with thrust control...")
KeyboardInterrupt
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/src$ sudo udevadm control --reload-rules && sudo udevadm trigger
Running in chroot, ignoring request.
Running in chroot, ignoring request.
admin@ubuntu:/workspaces/isaac_ros-dev/src/custom_stuff/src$ python3 thruster_test.py
/usr/local/lib/python3.8/dist-packages/Jetson/GPIO/gpio_event.py:182: RuntimeWarning: Event not found
warnings.warn("Event not found", RuntimeWarning)
Initializing thruster...
Press Enter to proceed with thrust control...^CTraceback (most recent call last):
File "thruster_test.py", line 22, in <module>
input("Press Enter to proceed with thrust control...")
KeyboardInterrupt