flashing latest jetpack (5.1.2 atm) for nvidia jetson xavier agx

My work pc is running the latest ubuntu jammy (22.04LTS) and NVidia has yet to release the promised Jetpack 6 and sdkmanager [supposedly] featuring ubuntu jammy for both the host and target board.

The latest jetpack currently available (5.1.2) features ubuntu focal (20.04LTS) target. They provided some docker images for the host, but the actual run-ability is questionable and we need some more workaround. Some ppl had it easy, most others struggled (here, here, and others).

Inside the docker container (host), we need to modify /etc/issue, /etc/lsb-release, /etc/os-release and /etc/apt/source.list to "pretend" as ubuntu jammy if your actual host is not actually one.

Here is my flashing/installation notes:

# on the host
- make sure you have working **docker**
- download the sdkmanager docker image for ubuntu 20.04 (focal), for some reason I could not flash my jetson xavier using due to some missing jetpack packages when using the 22.04 (jammy) docker image
$ sudo update-binfmts --enable
$ docker load -i sdkmanager*tar.gz
$ docker run -it --rm --name=sdkmanager --rm=true --net=host --ipc host --privileged --cap-add SYS_ADMIN --volume="/dev/bus/usb:/dev/bus/usb" --entrypoint bash sdkmanager
# inside the container
- edit /etc/os-release /etc/lsb-release /etc/issue to trick the sdkmanager that we are running ubuntu focal
- edit your /etc/apt/source.list to reflect ubuntu focal.
$ apt-get -f install
$ sudo apt install libxshmfence libnss3 libatk-bridge2.0-0 libdrm2 libgtk-3-0 libgbm-dev
Check available jetpack packages on pick the one suitable for your device.
$ sdkmanager --query
$ sdkmanager --cli install --logintype devzone --staylogin true --product Jetson --version 5.1.2 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all
If you have the space to spare, you can save the docker container into a neatly packed image
$ docker commit sdkmanager nvidiaiwishyouwerekindertous
Ubuntu 20.04.6 LTS \n \l
view raw issue hosted with ❤ by GitHub
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
view raw lsb-release hosted with ❤ by GitHub
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
view raw os-release hosted with ❤ by GitHub
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu focal partner
view raw source.list hosted with ❤ by GitHub