Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save f2janyway/b2a347791930e9300c65e6cfb6f87ab7 to your computer and use it in GitHub Desktop.

Select an option

Save f2janyway/b2a347791930e9300c65e6cfb6f87ab7 to your computer and use it in GitHub Desktop.
jetson orin nano memory error fix link (jetpack 6.2.1)

After this the error disappear!

origin version

nano@nano-desktop:~/code/sequor_vfm_deploy (dev)$ dpkg -l | grep nvidia-jetpack

ii  nvidia-jetpack                                           6.2.1+b38                                   arm64        NVIDIA Jetpack Meta Package

ii  nvidia-jetpack-dev                                       6.2.1+b38                                   arm64        NVIDIA Jetpack dev Meta Package

ii  nvidia-jetpack-runtime                                   6.2.1+b38                                   arm64        NVIDIA Jetpack runtime Meta Package


nano@nano-desktop:~$ head -n1 /etc/nv_tegra_release

# R36 (release), REVISION: 4.7, GCID: 42132812, BOARD: generic, EABI: aarch64, DATE: Thu Sep 18 22:54:44 UTC 2025

below source link

https://forums.developer.nvidia.com/t/unable-to-allocate-cuda0-buffer-after-updating-ubuntu-packages/347862/206?u=true


This guide provides step-by-step instructions to apply the kernel fix for addressing the CUDA buffer issue on a native Jetson Orin Nano setup.

Download source

public_sources.tbz2 https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.4/sources/public_sources.tbz2

toolchain https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64–glibc–stable-2022.08-1.tar.bz2

Changes: (please unzip the files to *.diff files) 7959247.diff.zip (1.7 KB) a94ca4c.diff.zip (1.2 KB) b27a1a7.diff.zip (1.5 KB) cfe6242.diff.zip (3.3 KB) e488812.diff.zip (2.0 KB)

Step 1: Verify Jetson Linux Version head -n1 /etc/nv_tegra_release

Must show:

R36 (release), REVISION: 4.x

This procedure is only for r36.4.x.

Step 2: Check Disk, RAM & Swap (IMPORTANT) Disk df -h /

Ensure ≥ 30 GB free

RAM & Swap free -h

If swap < 8 GB, create 16 GB swap:

sudo swapoff -a sudo rm -f /swapfile sudo fallocate -l 16G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo ‘/swapfile none swap sw 0 0’ | sudo tee -a /etc/fstab

Step 3: Install Required Build Dependencies sudo apt update sudo apt install -y build-essential bc flex bison libssl-dev libncurses-dev libelf-dev git rsync

Step 4: Download & Extract Kernel Sources

mkdir -p ~/jetson-kernel-fix cd ~/jetson-kernel-fix

Download public_sources.tbz2 matching your exact r36.4.x release.

Extract:

tar xf public_sources.tbz2 tar xf aarch64–glibc–stable-2022.08-1.tar.bz2 cd Linux_for_Tegra/source tar xf kernel_src.tbz2 tar xf kernel_oot_modules_src.tbz2 tar xf nvidia_kernel_display_driver_source.tbz2

Apply patches Kernel patch:

cd ~/jetson-kernel-fix/Linux_for_Tegra/source/kernel/kernel-jammy-src patch -p1 < ~/jetson-kernel-fix/a94ca4c.diff

NVIDIA OOT module patches (order matters):

cd ~/jetson-kernel-fix/Linux_for_Tegra/source/nvidia-oot

patch -p1 < ~/jetson-kernel-fix/cfe6242.diff patch -p1 < ~/jetson-kernel-fix/e488812.diff patch -p1 < ~/jetson-kernel-fix/b27a1a7.diff patch -p1 < ~/jetson-kernel-fix/7959247.diff

Before you run: make sure the .diff files exist

If you only have *.diff.zip, unzip them like this:

cd ~/jetson-kernel-fix for f in *.diff.zip; do unzip -o “$f”; done

Then run:

ls -lh ~/jetson-kernel-fix/*.diff

if you re run accidentally you can see below msg:

Reversed (or previously applied) patch detected! Assume -R? [n]

This means the changes from a94ca4c.diff are ALREADY PRESENT in your kernel source.

Correct response

When prompted:

Assume -R? [n]

Press Enter (keep n)

This safely skips it.

4.1 Build kernel

cd ~/jetson-kernel-fix/Linux_for_Tegra/source make -C kernel -j$(nproc)

4.2 Install modules + kernel image (keep a backup) Backup your current kernel image first:

sudo cp /boot/Image /boot/Image.backup.$(date +%F)

Install modules + copy Image:

sudo make install -C kernel sudo cp kernel/kernel-jammy-src/arch/arm64/boot/Image /boot/Image

Step 5: Build & install NVIDIA OOT modules

cd ~/jetson-kernel-fix/Linux_for_Tegra/source export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src

make modules -j$(nproc) sudo make modules_install

Step 6: Update initramfs + reboot

sudo update-initramfs -u sudo reboot

Step 7: After reboot: verify CUDA stability uname -r

verify: ashwin-saravanan@ashwin-saravanan:~$ uname -r 5.15.148-tegra

now run ollama without any error: ollama run phi3:mini

Step 8: Finally hold the update untill official release comes:

sudo apt-mark hold nvidia-l4t-display-kernel nvidia-l4t-kernel nvidia-l4t-kernel-dtbs nvidia-l4t-kernel-headers nvidia-l4t-kernel-oot-headers nvidia-l4t-kernel-oot-modules

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