Sunday 10 January 2021

Installing JetPack on Jetson TX2 from NVIDIA SDK Manager Docker container

For a very long time, if you wanted to flash your Jetson TX and install JetPack SDK you had to download and install NVIDIA JetPack and later, NVIDIA SDK Manager, on the Linux host computer first. Every package installation pollutes your host machine and also takes some disk space. To avoid this, NVIDA created a Docker image with SDK Manager so once JetPack is installed on Jetson, this Docker image can be deleted and your Linux host remains in the same state as before. This has been available since NVIDIA SDK Manager 1.4 (December 2020).

I had some of the older versions of JetPack installed on my Jetson TX2 and I wanted to install the most recent one (4.4.1 at the moment; 4.5 is announced for January 2021). One of the benefits I wanted to get is the upgrading to the next JetPack release via apt package management tool (this has been available since JetPack 4.4).

I want to share here my experience with the process of running NVIDIA SDK Manager Docker container and flashing the Jetson TX2 with it. I followed the official documentation about this process: Docker Images :: NVIDIA SDK Manager Documentation.

I logged in to NVIDIA Developer center and downloaded this Docker image from this URL: https://developer.nvidia.com/nvidia-sdk-manager-docker-image. The image came as an 942MB archive named sdkmanager-1.4.0.7363_docker.tar.gz.

$ docker load -i ./sdkmanager-1.4.0.7363_docker.tar.gz 
805802706667: Loading layer  65.61MB/65.61MB
3fd9df553184: Loading layer  15.87kB/15.87kB
7a694df0ad6c: Loading layer  3.072kB/3.072kB
2f694c79b042: Loading layer  148.2MB/148.2MB
26765aed7e25: Loading layer  502.3kB/502.3kB
b398b8335e67: Loading layer  6.015MB/6.015MB
08b68150484c: Loading layer  1.135MB/1.135MB
31fbfacf550e: Loading layer  1.135MB/1.135MB
84979f95b15f: Loading layer  502.3kB/502.3kB
cd9205d2e1f9: Loading layer  2.075MB/2.075MB
414d8a00c66e: Loading layer  66.07MB/66.07MB
cc3271f36011: Loading layer  84.83MB/84.83MB
5072b3ebcb77: Loading layer  2.108MB/2.108MB
38be13d541b9: Loading layer  1.781MB/1.781MB
ff63398d24ea: Loading layer  99.17MB/99.17MB
7cb4d04a8659: Loading layer [==================================================>]  462.3MB/462.3MB
cd2c9f6e22b0: Loading layer [==================================================>]  2.048kB/2.048kB
65cd593db96f: Loading layer [==================================================>]  3.584kB/3.584kB
8900dbcf5626: Loading layer [==================================================>]  3.584kB/3.584kB
9ac46abadb31: Loading layer [==================================================>]  3.072kB/3.072kB
a20c9aaeb9c3: Loading layer [==================================================>]  417.3kB/417.3kB
cae1bf65143a: Loading layer [==================================================>]  3.584kB/3.584kB
Loaded image: sdkmanager:1.4.0.7363

As this is the latest version of this Docker image, I tagged it with the latest tag:

$ docker tag sdkmanager:1.4.0.7363 sdkmanager:latest

I made sure that the image is listed among other Docker images on my machine:

$ docker images  
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
sdkmanager              1.4.0.7363          0e9d62e318ad        2 weeks ago         913MB
sdkmanager              latest              0e9d62e318ad        2 weeks ago         913MB
...

SDK Manager executable (sdkmanager) is the entrypoint of this Docker image and I wanted to test the Docker image by running it with some simple CLI commands listed here.

$ docker run -it --rm sdkmanager --help

NVIDIA SDK MANAGER

  NVIDIA SDK Manager is an all-in-one tool that bundles developer software and
  provides an end-to-end development environment setup solution for NVIDIA
  SDKs.

General Options

  -h, --help                             Displays this usage guide.
  --ver                                  Output the version of the installed SDK Manager client
  --settings                             Optional. Configure SDK Manager settings in the terminal.
  --query interactive|noninteractive     Prints all options available for the user. Must be executed with the --use or --offline settings
  --showallversions                      Prints all available product versions for the user.
  --logs                                 Optional. Set this option to export the log files when the process is complete.
  --exitonfinish                         Optional. Automatically exit from SDK Manager when the install/uninstall session is finished (skip user input). Intended for scripts/automation usage.
  --user email_address                   Optional. Set the user email to login. Valid only for NVOnline login.
  --password string                      Optional. Set the user login password. Valid only for NVOnline login.
  --logintype devzone|nvonline           Optional. Login with developer.nvidia.com or partners.nvidia.com account. Default is devzone.
  --staylogin true|false                 Optional. Keep the user account logged-in for next running session.
  --logout                               Logout user account from SDK Manager.
  --offline                              Optional. Skip login to NVIDIA servers. Install SDK from pre downloaded location, used with --downloadfolder option.
  --downloadfolder string                Optional. Set the download folder for the SDK components. Used for downloading the files and for locating the SDK components when using --offline.
  --archivedversions                     Optional. Display only archived versions.
  --cli install|uninstall|downloadonly   Mandatory. Set the requested action.
  --sudopassword string                  Optional. Set the sudo password to skip the authentication prompt.
  --datacollection enable|disable        Optional. Set to enable or disalbe usage data collection.

Specific arguments for install/uninstall:

  --product product_name                 Mandatory. Set the product name.
  --version string                       Mandatory. Set the product version. Use --query to get available version values.
  --targetos target_os                   Mandatory. Set the target hardware operating system.
  --host                                 Optional. Set if host side components need to be installed.
  --target target_hardware               Optional. Set the target hardware in use. Use hardware code name.
  --flash all|a|b|ab|skip                Optional. Set the flash operation mode, which of the Tegras should be flashed.
  --additionalsdk additional_sdk_title   Optional. Specify any additional SDK to install. Multiple entries are allowed.
  --select section_or_group_title        Optional. Specify section or group to installation list. Multiple entries are allowed.
  --deselect section_or_group_title      Optional. Specify section or group to exclude from installation list. Multiple entries are allowed.
  --license accept                       Optional. Set this option to accept the terms and conditions of SDK license agreements.
  --targetimagefolder string             Optional. Set the host location of the target hardware image for flashing.
  --responsefile string                  Optional. Set the response file path. Response file samples can be found in the product folder /opt/nvidia/sdkmanager.

Example

  $ sdkmanager [--user user@user.com] [--query]
  $ sdkmanager [--cli install|uninstall|downloadonly] [cli options] ...
  $ sdkmanager [--settings]
  $ sdkmanager [--help]                                        

$ docker run -it --rm sdkmanager --ver
1.4.0.7363

I connected Jetson TX2 to my Ubuntu host via USB cable and put Jetson into forced recovery mode (as described here: Jetson_X2_Developer_Kit_User_Guide.pdf).

I checked that Jetson is listed among other USB devices:

$ lsusb
...
Bus 002 Device 004: ID 0955:7c18 NVIDIA Corp. APX
...

I then run a query command on SDK manager to get a list of available install options:

$ docker run -it --rm sdkmanager --query
To initiate login process open https://static-login.nvidia.com/service/default/pin?user_code=36223035 in a browser (can be done on a different machine) and login with your NVIDIA Developer account. SDK Manager will start once done.
Login user code: 36223035. (valid for: 10 minutes).
? SDK Manager is waiting for you to complete login. 
  1) Generate a new login user code
  2) Cancel login
  Answer: 
Waiting for user information from NVIDIA authentication server...
Retrieving user information...
Loading and processing available products...
Login succeeded.
Loading user information...
User information loaded successfully.
Loading server data...
Server data loaded successfully.
Available options are:

 Jetson 4.4
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P2888-0001 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P2888-0004 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P2888-0006 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P2888-0060 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3668-0000 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3668-0001 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3310-1000 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3489-0080 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3489-0888 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3489-0000 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P2180-1000 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3448-0000 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3448-0002 --flash all --additionalsdk DeepStream
sdkmanager --cli install --logintype devzone --product Jetson --version 4.4 --targetos Linux --host --target P3448-0020 --flash all --additionalsdk DeepStream


Query completed.

I was not sure which target I should choose so I used table from NVIDIA Jetson Linux Developer Guide : Introduction | NVIDIA Docs to check the P-number of my Jetson TX2 and it was P3310-1000.

It was now the time to do the main part of the job. As a guide, I looked at the docker run command example used for flashing Jetson Nano (listed here: Docker Images :: NVIDIA SDK Manager Documentation) and modified it for Jetson TX2:

$ docker run -it --rm --privileged -v /dev/bus/usb:/dev/bus/usb/ --name JetPack_TX2_Devkit sdkmanager --cli install --logintype devzone --product Jetson --target P3310-1000 --targetos Linux --version 4.4.1 --flash all --license accept --staylogin true --datacollection enable --exitonfinish
To initiate login process open https://static-login.nvidia.com/service/default/pin?user_code=64552553 in a browser (can be done on a different machine) and login with your NVIDIA Developer account. SDK Manager will start once done.
Login user code: 61234563. (valid for: 10 minutes).
? SDK Manager is waiting for you to complete login. 
  1) Generate a new login user code
  2) Cancel login
  Answer: 
Waiting for user information from NVIDIA authentication server...
Retrieving user information...
Loading and processing available products...
Login succeeded.
Loading user information...
User information loaded successfully.
Loading server data...
Server data loaded successfully.
Session initialized...

Installation of this software is under the terms and conditions of the license agreements located in /opt/nvidia/sdkmanager/Eula/
  ===== INSTALLATION COMPLETED SUCCESSFULLY. ===== 
      - Drivers for Jetson: Installed
      - File System and OS: Installed
      - Device Mode Host Setup in Flash: Installed
      - Flash Jetson TX2: Installed
      - Device Mode Host Setup in Target SDK: Installed
      - DateTime Target Setup: Installed
      - CUDA Toolkit for L4T: Installed
      - cuDNN on Target: Installed
      - TensorRT on Target: Installed
      - OpenCV on Target: Installed
      - VisionWorks on Target: Installed
      - VPI on Target: Installed
      - NVIDIA Container Runtime with Docker integration (Beta): Installed
      - Multimedia API: Installed

  ===== Installation completed successfully - Total 14 components =====
  ===== 14 succeeded, 0 failed, 0 up-to-date, 0 skipped =====



Here are some screenshots of the SDK manager running from within Docker container which show the process of downloading the packages, flashing the OS and installing JetPack on Jetson board:



















Upon flashing the Jetson, L4T (Linux 4 Tegra) Ubuntu flavor setup appears:




...and after some typical Ubuntu setup steps, we can see something like this:


...and the final look of the desktop:


No comments: