NavigationContentFooter
Jump toSuggest an edit

Installing NVIDIA drivers on Ubuntu 22.04

Reviewed on 30 September 2024Published on 27 March 2024

In this guide, we will walk you through the process of installing NVIDIA drivers for L4/L40S GPU Instances on a customized Ubuntu 22.04 image, adapted from the default OS image.

Important

This guide is for advanced users. Scaleway does not provide official support for custom OS images. This documentation aims to offer guidance to expert users interested in creating their own GPU image setups. We encourage users to use our GPU OS 12 images, which are ready to use and maintained by Scaleway.

Note

Before installation, it is important to identify the correct NVIDIA driver version for your system. You can check the recommended driver versions from the official NVIDIA drivers website.

Installing NVIDIA drivers

  1. Install the NVIDIA repository key. You can follow instructions from the NVIDIA website to install the latest version of the key.

  2. Update the command line defined in /etc/default/grub by adding the parameter pci=realloc. This parameter ensures proper GPU detection and allocation.

  3. Enable the scw-set-numa-node service. This service is installed from the Scaleway ecosystem package.

  4. Install the necessary NVIDIA drivers using the package manager (apt-get):

    sudo apt-get install nvidia-docker2 nvidia-headless-<version> nvidia-utils-<version>

    Replace <version> with the specific version number of the NVIDIA drivers compatible with your GPU model.

    Tip

    We recommend using Nvidia NGC Docker containers, such as CUDA or PyTorch. This eliminates the need to install CUDA and cuDNN separately. Only the NVIDIA driver and NVIDIA Docker are required. The NGC Docker images contain the correct versions of CUDA, cuDNN, etc. This approach offers several benefits:

    • Ability to choose your preferred framework and version.
    • Ready-to-use setup (CUDA, cuDNN, Python, etc.).
    • Building your custom Docker image on top of Nvidia images.
    • Portable code (Local, Instance, K8S/Slurm clusters).
    • Up-to-date with the latest Nvidia fixes and optimizations.
  5. After installation, confirm the drivers are working correctly by running:

    sudo nvidia-smi

    This command should display information about the installed NVIDIA GPU(s) and their status.

    Tip

    Depending on your specific requirements, you may need to perform additional configuration steps, such as setting environment variables or adjusting kernel parameters. Refer to the official NVIDIA documentation for guidance on these configurations.

Troubleshooting

If you encounter errors or issues during the installation process, consider the following troubleshooting steps:

  • Check system logs (dmesg, /var/log/syslog) for any error messages related to NVIDIA drivers.
  • Ensure the correct driver version is compatible with your GPU model.
  • Verify that the NVIDIA repository is correctly added to your package manager’s sources list.
  • Consult relevant documentation or forums for additional troubleshooting steps specific to your setup.
  • NVIDIA NGC Catalog
  • Frameworks Support Matrix - NVIDIA Docs
  • How to access the GPU using Docker
  • NVIDIA Container Toolkit documentation
Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway