Skip to content

Instantly share code, notes, and snippets.

@adujardin
Last active February 20, 2024 10:35
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save adujardin/c0ee25cfb343ea5b6d17ea88ec6634ac to your computer and use it in GitHub Desktop.
Save adujardin/c0ee25cfb343ea5b6d17ea88ec6634ac to your computer and use it in GitHub Desktop.
Script to remove unnecessary stuffs from the Jetson to save disk space (WIP)
# https://elinux.org/Jetson/FAQ/BSP/RootFS_Reduction#Remove_installed_deb_packages
## Step 1, safe
sudo apt update
sudo apt autoremove -y
sudo apt clean
sudo apt remove thunderbird libreoffice-* -y
## Step 2, still safe but not recommended for dev use
# samples
sudo rm -rf /usr/local/cuda/samples \
/usr/src/cudnn_samples_* \
/usr/src/tensorrt/data \
/usr/src/tensorrt/samples \
/usr/share/visionworks* ~/VisionWorks-SFM*Samples \
/opt/nvidia/deepstream/deepstream*/samples
# Remove local repos
sudo apt purge cuda-repo-l4t-*local* libvisionworks-*repo -y
sudo rm /etc/apt/sources.list.d/cuda*local* /etc/apt/sources.list.d/visionworks*repo*
sudo rm -rf /usr/src/linux-headers-*
## Step 3, WARNING! remove GUI:
sudo apt-get purge gnome-shell ubuntu-wallpapers-bionic light-themes chromium-browser* libvisionworks libvisionworks-sfm-dev -y
sudo apt-get autoremove -y
sudo apt clean -y
# remove static libs (maybe cleaner to remove the "dev" packages instead)
sudo rm -rf /usr/local/cuda/targets/aarch64-linux/lib/*.a \
/usr/lib/aarch64-linux-gnu/libcudnn*.a \
/usr/lib/aarch64-linux-gnu/libnvcaffe_parser*.a \
/usr/lib/aarch64-linux-gnu/libnvinfer*.a \
/usr/lib/aarch64-linux-gnu/libnvonnxparser*.a \
/usr/lib/aarch64-linux-gnu/libnvparsers*.a
@karanjakhar
Copy link

Thanks @adujardin

@eusoubrasileiro
Copy link

Thanks a lot @adujardin

@skip007
Copy link

skip007 commented Sep 23, 2022

Thanks @adujardin - now I have a much cleaner mini server!

@eusoubrasileiro
Copy link

eusoubrasileiro commented Sep 24, 2022

@karanjakhar @adujardin @skip007
Better than this is to have a custom image like this or this. If you need a server image, size will be reduced from 7GB+ to 2GB. All unnecessary NVIDIA junk removed, huge amounts of process time and memory saved.

@eusoubrasileiro
Copy link

@visheshv I don't know. Try check if the jetson linux supports the Tx2 model. My image was created simple following the BSP tools for a sample filesystem (scripts nv_build_samplefs.sh and nvubuntu_samplefs.sh). There should be somewhere another sample file system and jetson-linux bsp for jetson tx2 I suppose.

@eusoubrasileiro
Copy link

@visheshv from here it says it is supported. So I recommend you follow the instructions from the tutorials above except that you must ADAPT it. Try exploring the BSP folder of tool scripts for your tx2 to figure out which parameters to use to create the image for your tx2 model. Once the image is created flashing it to a sd card should be the same I suppose.

@razvanphp
Copy link

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