Skip to content

Instantly share code, notes, and snippets.

@gpshead
Last active November 30, 2023 04:22
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpshead/0c3a9e0a7b3e180d108b6f4aef59bc19 to your computer and use it in GitHub Desktop.
Save gpshead/0c3a9e0a7b3e180d108b6f4aef59bc19 to your computer and use it in GitHub Desktop.
Build a Linux 4 Tegra with CUDA Ubuntu 22.04 docker image for the nVidia Jetson Nano using its final JetPak 4.6.3
# Make an Ubuntu 22.04 Docker image supporting CUDA and Linux 4 Tegra stuff on
# the nVidia Jetson Nano. I ran this from the final nano Linux 4 Tegra JetPak
# image aka jetson-nano-jp461-sd-card-image.zip which I updated to 4.6.3
# using apt. -- @gpshead
#
# Is there any real point to doing this? I have no idea. :P
# If you don't care about toying with the GPU stuff, just go install Armbian.
#
# This is based off of the instructions on
# https://github.com/NVIDIA/nvidia-docker/wiki/NVIDIA-Container-Runtime-on-Jetson
# and the final Jetpak 32.x container that represents the final Jetson Nano
# platform from https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base
# before nvidia went ass-hole and abandoned three generations of hardware that
# they still ship.
FROM nvcr.io/nvidia/l4t-base:r32.7.1
RUN apt-get update && apt-get upgrade -y
RUN apt-get install ubuntu-release-upgrader-core -y --no-install-recommends
# 18.04 -> 20.04
RUN do-release-upgrade -f DistUpgradeViewNonInteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get clean
RUN apt-get install -y --no-install-recommends vim
# 20.04 -> 22.04 and IGNORE the error (which should be from usrmerge.postinstall)
RUN do-release-upgrade -f DistUpgradeViewNonInteractive ; exit 0
# Patch the failed convert-usrmerge to work around https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008202
RUN sed -i -e 's/no autodie;/rm(\"-rf\", \"$dir\");/g' -e 's/not rename/0 \&\& not rename/g' /usr/lib/usrmerge/convert-usrmerge
# Continue the last bit do-release-upgrade failed to do? (is this really enough?)
RUN dpkg --configure -a
RUN apt-get remove python2 -y
RUN apt-get autoremove -y
RUN apt-get clean
# All done here, the rest just proves that this 22.04 container supports CUDA.
# You MUST pass the `--runtime nvidia` flag to `docker run` for CUDA to work.
RUN apt-get install -y --no-install-recommends make g++
COPY ./samples /tmp/samples
WORKDIR /tmp/samples/1_Utilities/deviceQuery
RUN make clean && make
CMD ["./deviceQuery"]
@gpshead
Copy link
Author

gpshead commented Apr 9, 2023

Realistically this image is huge and contains all of the jetpak gui desktop software mega-bloat that nobody ever wants. If you have a specific use for this, at least make some of the first steps minimize the image before any upgrades.

@brianlmerritt
Copy link

Starting to run through this - if anyone else is following this, on installed clean image of jetpack 4.6.3, after running sudo apt update && sudo apt upgrade -y, the command sudo apt install nvidia-jetpack is likely to fail. The fix for that is:

sudo apt dist-upgrade
sudo apt update
sudo apt-get install nvidia-container
sudo apt-get install nvidia-jetpack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment