How to Install CUDA 12.4 on Ubuntu 24.04 with a GTX 1060

How to Get CUDA 12.4 Running on Ubuntu 24.04 with a GTX 1060

The Situation

My machine with a GTX 1060 reports support for up to CUDA 12.4 when checking with nvidia-smi. However, NVIDIA’s official support matrix for Linux only lists up to Ubuntu 22.04. The problem is, this machine is running Ubuntu 24.04.

You might think this setup wouldn’t work, but you can actually get it running on Ubuntu 24.04 without any major issues.

Currently, I’m using CUDA 12.0, which was installed via the standard Ubuntu repository method.

table of contents

Background and Rationale

  • NVIDIA’s official list of supported operating systems only includes those that have been officially tested and verified.
  • The GTX 1060 (Pascal architecture) supports CUDA up to version 12.4.
  • As long as the kernel and X.Org ABI are compatible, it can run on Ubuntu 24.04.

Setup Guide (Ubuntu 24.04 + GTX 1060 + CUDA 12.4)

1. Uninstall Existing Drivers (If Necessary)

If you have previously installed drivers manually using a .run file, it’s best to perform a clean uninstall.

sudo apt purge 'nvidia-*' 'cuda*'
sudo apt autoremove --purge
sudo reboot

2. Install NVIDIA Drivers (From Ubuntu’s Official Repository)

The 550 series drivers available in the official Ubuntu repositories work with the GTX 1060 and support up to CUDA 12.4.

sudo apt update
sudo apt install nvidia-driver-550
sudo reboot

However, I encountered the following dependency error:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nvidia-driver-550 : Depends: libnvidia-compute-550 (= 550.163.01-0ubuntu0.24.04.1) but 550.163.01-0ubuntu1 is to be installed
                     Depends: libnvidia-decode-550 (= 550.163.01-0ubuntu0.24.04.1) but it is not going to be installed
                     Depends: libnvidia-encode-550 (= 550.163.01-0ubuntu0.24.04.1) but it is not going to be installed
                     Recommends: nvidia-settings but it is not going to be installed
                     Recommends: nvidia-prime (>= 0.8) but it is not going to be installed
                     Recommends: libnvidia-compute-550:i386 (= 550.163.01-0ubuntu0.24.04.1) but it is not installable
                     Recommends: libnvidia-decode-550:i386 (= 550.163.01-0ubuntu0.24.04.1) but it is not installable
                     Recommends: libnvidia-encode-550:i386 (= 550.163.01-0ubuntu0.24.04.1) but it is not installable
                     Recommends: libnvidia-fbc1-550:i386 (= 550.163.01-0ubuntu0.24.04.1) but it is not installable
                     Recommends: libnvidia-gl-550:i386 (= 550.163.01-0ubuntu0.24.04.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

Cause of the Error

The dependency conflict arises because some libnvidia-* packages are from the base Noble release (...0ubuntu1), while others are being pulled from Noble-updates (...0ubuntu0.24.04.1), causing a version mismatch.

Solution (The Steps That Worked for Me)

1) Fix Broken Packages and Release Holds

sudo apt -f install
apt-mark showhold
# If any nvidia packages are listed, unhold them
sudo apt-mark unhold libnvidia-compute-550 libnvidia-decode-550 libnvidia-encode-550 nvidia-driver-550 nvidia-utils-550

2) Add the Graphics Drivers PPA

sudo add-apt-repository -y ppa:graphics-drivers/ppa
sudo apt update

3) Install All Packages with a Specific Version

# First, remove the conflicting package version
sudo apt remove libnvidia-compute-550

# Then, install everything with the correct, matching version
sudo apt install \
  libnvidia-compute-550=550.163.01-0ubuntu0.24.04.1 \
  libnvidia-decode-550=550.163.01-0ubuntu0.24.04.1 \
  libnvidia-encode-550=550.163.01-0ubuntu0.24.04.1 \
  nvidia-utils-550=550.163.01-0ubuntu0.24.04.1 \
  nvidia-kernel-common-550=550.163.01-0ubuntu0.24.04.1 \
  nvidia-dkms-550=550.163.01-0ubuntu0.24.04.1 \
  nvidia-driver-550=550.163.01-0ubuntu0.24.04.1

Key Point:

  • Explicitly specify the same build number, 550.163.01-0ubuntu0.24.04.1, for all packages.
  • If apt requests other dependencies (e.g., libnvidia-gl-550), add them to the command with the same version number.

4) Reboot and Verify

sudo reboot
# After rebooting
nvidia-smi

If you see CUDA Version: 12.4, you’re good to go.

3. Install the CUDA Toolkit 12.4 (Using the Ubuntu 22.04 Package)

3-1. Add the CUDA Repository

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update

If you run into errors, there are two ways to proceed.

The cuda-toolkit-12-4 is a metapackage that pulls in many components, including Nsight tools, which can cause dependency issues on Ubuntu 24.04. You can avoid this by installing only the essential compiler and library packages. This will still give you nvcc.

# Add the repository if you haven't already
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update

# Install only the core toolkit components
sudo apt install --no-install-recommends \
  cuda-compiler-12-4 \
  cuda-nvcc-12-4 \
  cuda-cudart-12-4 \
  cuda-driver-dev-12-4 \
  cuda-libraries-12-4 \
  cuda-libraries-dev-12-4 \
  cuda-cupti-12-4

Set environment variables (if not already configured):

echo 'export PATH=/usr/local/cuda-12.4/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

Verify the installation:

nvcc --version

If it shows release 12.4, you are all set. You can skip installing the samples; if you need them, it’s better to get them from GitHub.

Get and Build Samples from GitHub

# Clone the samples for the v12.4 tag
git clone --branch v12.4 https://github.com/NVIDIA/cuda-samples.git
cd cuda-samples/Samples/1_Utilities/deviceQuery

# Install build dependencies if you don't have them
sudo apt install -y build-essential cmake

# Build with CMake
cmake -S . -B build
cmake --build build -j

# Run the sample
./build/bin/linux/release/deviceQuery

Result = PASS indicates success. (Note: GitHub is now the official source for CUDA samples; they are no longer included in the apt package.)

Method 2) The “Forced” Approach: Install libtinfo5 to Satisfy the Metapackage

If you absolutely want to install the cuda-toolkit-12-4 metapackage, you can temporarily pull in libtinfo5 from the Ubuntu 22.04 (Jammy) repositories. Use this at your own risk, as it involves mixing releases. It’s highly recommended to remove the Jammy repository entry after you’re done.

# Create a pin to only allow libtinfo5 from jammy
cat <<'EOF' | sudo tee /etc/apt/preferences.d/libtinfo5-from-jammy
Package: libtinfo5
Pin: release n=jammy
Pin-Priority: 700
EOF

# Temporarily add the jammy repository
echo "deb http://archive.ubuntu.com/ubuntu jammy main universe" | sudo tee /etc/apt/sources.list.d/jammy-temp.list
sudo apt update

# Install the legacy library
sudo apt install libtinfo5

# Remove the temporary repository file
sudo rm /etc/apt/sources.list.d/jammy-temp.list
sudo apt update

Now, you should be able to install the metapackage:

sudo apt install --no-install-recommends cuda-toolkit-12-4

If this works, great. For simpler long-term maintenance, you might still consider switching to Method 1 and avoiding the Nsight tools.

Which Method is Better?

  • Method 1 is safer and simpler. It’s perfectly sufficient for deep learning and custom CUDA development.
  • Method 2 is for those who are particular about installing the official metapackage. However, you may run into dependency issues again with future updates.

Summary

  • The GTX 1060 supports CUDA up to 12.4 and can run on Ubuntu 24.04.
  • Using the official 550 series drivers from Ubuntu’s repository is the most stable approach.
  • The CUDA Toolkit can be installed successfully using the packages built for Ubuntu 22.04.
  • This configuration is robust and should remain compatible with future kernel updates.

If you like this article, please
Follow !

Please share if you like it!
table of contents