Skip to content

Instantly share code, notes, and snippets.

@r7vme
Last active July 24, 2023 23:54
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save r7vme/002b88bed939cd9601db948c70e00e05 to your computer and use it in GitHub Desktop.
Save r7vme/002b88bed939cd9601db948c70e00e05 to your computer and use it in GitHub Desktop.
Flash Jetson Xavier AGX from docker (sdkmanager)

TESTED for Jetpack 4.5.1

Official docker image had few utilities missed, which caused flashing to fail with Jetson AGX Xavier. To fix that I added them to docker image.

  1. Get NVIDIA official docker image.

  2. Rebuild docker image

mkdir sdkmanager; cd sdkmanager
# create dockefile from below gist
docker build -t sdkmanager-fixed -f .

# `/opt/sdmanager` will be used for all sdkmanager data.
sudo mkdir /opt/sdkmanager ; sudo chmod 777 /opt/sdkmanager
  1. Place sdkmanager (from below) to /usr/local/bin and make it executable with chmod +x /usr/local/bin/sdkmanager.

  2. Flash sdkmanager --cli install --logintype devzone --product Jetson --version 4.5.1 --targetos Linux --target P2888-0001 --flash all --datacollection disable --license accept --exitonfinish

FROM sdkmanager
RUN sudo apt update && sudo apt install -y binutils xxd
ENTRYPOINT [ "/usr/bin/sdkmanager" ]
#!/bin/bash
docker run -it --rm --privileged --net=host \
--volume /dev/bus/usb:/dev/bus/usb \
--volume /opt/sdkmanager:/home/nvidia \
--name sdkmanager sdkmanager-fixed $@
@AlexKaravaev
Copy link

Thank you very much for the gist! Been struggling for that for a while, because NVIDIA apparently does not care for users with OS other than ubuntu 16 and 18.

Just for the record script above works for flashing Xavier AGX with host system Ubuntu 20 04.

@beadon
Copy link

beadon commented Feb 4, 2023

Found that this built the image:

cat Dockerfile | docker build -t sdkmanager-fixed -

@beadon
Copy link

beadon commented Feb 4, 2023

And for others modifying sdkmanager:

sudo mv sdkmanager /usr/local/bin/
sudo chmod 775 /usr/local/bin/sdkmanager

@beadon
Copy link

beadon commented Feb 4, 2023

Since this issue was raised a long whil back, the version listed is no longer available. You can query the available packages using interactive mode:

sdkmanager --cli install --logintype devzone --product Jetson--targetos Linux --target P2888-0001 --flash all --datacollection disable --license accept --exitonfinish --query interactive

@VincentSC
Copy link

Thanks to the approach in this gist, I got it working with Jetpack 5.1.1, using the Ubuntu 20.04 docker, running from Ubuntu 22.04. I'm sharing my notes here:

/usr/bin/sdkmanager-docker:

#!/bin/bash

docker run -it --rm --privileged --net=host \
  --volume /dev/bus/usb:/dev/bus/usb \
  --volume /dev:/dev \
  --volume /home/vincent/sdkmanager:/home/nvidia \
  --name sdkmanager sdkmanager-fixed $@

To get losetup to work, the /dev:/dev was required. I choose another name, as I had also sdkmanager installed (using the "fake 20.04" trick).

./Dockerfile:

FROM sdkmanager
RUN sudo apt update
RUN sudo apt upgrade -y
RUN sudo apt install -y binutils xxd lz4 libxml2-utils
ENTRYPOINT [ "/usr/bin/sdkmanager" ]

Finally they include xxd, but now lz4 and libxml2-utils are missing. I added an upgrade, but that's optional.

./build.sh

#!/bin/bash

cat Dockerfile | sudo docker build -t sdkmanager-fixed -

./flash.sh

#!/bin/bash

sudo sdkmanager-docker --cli install --logintype devzone --product Jetson --version 5.1.1 --targetos Linux --target JETSON_AGX_XAVIER_TARGETS --flash all --datacollection disable --license accept @0

This covers P2888-0001. I have the P2888-0004 (32GB), but it works on all three version with this variable. I assume that

Steps:

  • choose the first option (no username or password) when flashing
  • wait till flashed.
  • the device should have finished the installation of Ubuntu and be in normal operation work - I foudn this not to be working.
  • the device /dev/ttyACM0 should exist. If this does not work (ttyACM0 not there), restart the device (turn off and turn on again).
  • assumption: device not reachable via nc -z -vv -w 5 192.168.55.1 22 yet. If it works, then Ubuntu-install was finished for you.
  • log in via minicom: sudo minicom -D /dev/ttyACM0 -8 -b 115200.
  • you should see Ubuntu setup. If not, exit sdkmanager and flash again
  • finish the Ubuntu setup.
    • Needs confirmation: I selected eth0 for DHCP, wait, and then choose not to setup right now. Not sure if this was useful, but I had DHCP on eth0 when finished.
  • check if the device is reachable via USB: nc -z -vv -w 5 192.168.55.1 22. If not, then something else is wrong for you.
  • go back to sdk-manager. Continue the installation. Use:
    • network 192.168.55.1
    • username nvidia (maybe your own user works also?)
    • password nvidia
  • it should now install all the packages. If not, silently weep

Assume that the package is not maintained well, and fixes are added at random. So if you are installing Jetpack other than 5.1.1, all of the above probably does not work. One approach might be to install 5.1.1 with the above instructions, and then upgrade.

When I did an "apt update && apt upgrade" I saw a quite a large list of packages that could be autoremoved, but these looked important (opencv-related) - probably another badly configured part, so best to just leave it.

@jbcpollak
Copy link

using sdkmanager version 1.9.2.10899-Ubuntu_22.04 as the basis for this, it still doesn't work for me using @VincentSC's process. Am I missing something?

❯ ./flash.sh 
No update is available.
Authenticating with NVIDIA server...
Login succeeded.
Loading user information...
User information loaded successfully.
Loading server data...
Server data loaded successfully.

 * Available on ubuntu18.04, ubuntu20.04. For available versions run sdkmanager --query.

@pockethook
Copy link

@jbcpollak you're using 1.9.2.*-Ubuntu_22.04, you have to use either 1.9.2.*-Ubuntu_18.04 or 1.9.2.*-Ubuntu_20.04 the target and version you've selected.

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