JetPack 4.2.1 - Removal of unwanted Packages


I want to remove every unwanted package/ software for that matter even GUI interface on jetson TX2 so that resulting image can be put into production.

Also how to flash whole SBC which above generated image(cloned one) on several jetson TX2?

FYI, if you flash on command line with, then the “-r” says to reuse the root filesystem. For example:

sudo ./ -r jetson-tx2 mmcblk0p1

Without “-r” a new image is generated which produces:


This then gets converted to a “sparse” image (sort of poor man’s compression), and becomes:


The file “bootloader/system.img” can be either the raw or the sparse form, flash will work the same with either. The sparse form is smaller and will flash faster. Only the raw form can be loopback mounted, examined, and edited. The “mksparse” application can create a sparse file from a raw file using the “NULL” byte as fill pattern.

If you clone you will actually get two images. One is larger, and has a “.img.raw” suffix, and this is usually the one you want to keep. I throw away the “.img” sparse file.

If you copy any clone to the “bootloader/system.img” location, and then flash with “-r”, your clone becomes the new system’s rootfs (be sure to not mismatch the version of L4T the clone comes from with another L4T version…the non-rootfs content needs to be a version match).

Considerations are that passwords and accounts and temp files with logs will also be cloned. Any hardware-specific edits you may have made will also be cloned (an example is that if you wrote a udev rule to change the name of an ethernet port by means of a MAC address, then udev would fail since that MAC address is different on the next Jetson).

Now if I have fresh factory device with Jetpack 3.3/4.2.0 then can I not flash the cloned image(jetpack 4.2.1) on to that TX2 ?

And how do i remove all unwanted documentation files/ softwares/ packages and GUI desktop? Is there any script for the same.?

You can flash with any image you want to use. The flash program does not see the image as anything but binary data. The image could be the design files for a kitchen sink, and although it wouldn’t boot, the partition could become that data. Any clone of a rootfs from the same release of JetPack which is doing the flash of a clone will work. The clone can already have any package updates or customizations and those will also be propagated to the new Jetson.

It is best to just use apt or dpkg to make changes on the running Jetson prior to the clone. There is no support for changing packages on a raw image (myself and many others would very much like this, but “apt” has a lot of baggage built in to it and it is very difficult to make a version which will operate chroot…I investigated doing this at one time, but determined there was so much to change it wasn’t worthwhile).

On the other hand, a running Jetson is no different at removing those packages than is any other Ubuntu. You do need an X server with this same ABI, but the server can be virtual (it doesn’t need an X server with a real display, but the GPU driver loads in to the X server for most operations). More recent releases do not install man pages by default, so in that part you’re probably already covered.

FYI, if you go to an Ubuntu system, then you can query for the package owning a file (and use that for removal). Example:

# dpkg -S /usr/share/doc/gnome-shell/README
gnome-shell: /usr/share/doc/gnome-shell/README

…then you could use apt to remove gnome-shell and the doc would be removed (the whole package would be removed, and the README is included since it is one file from the package).