Software⏱️ 3 min readπŸ“… 2026-06-19

How to Fix: gcc --version error prevent installation of Nvidia proprietary driver via DKMS on ubuntu 20.04

Fix gcc --version error for Nvidia proprietary driver installation on Ubuntu 20.04

Quick Answer: Update the system to use the latest GCC version by running "sudo apt-get update && sudo apt-get install gcc" or "sudo apt-get install build-essential".

The error 'gcc --version' reports an incompatible version of GCC, which is causing issues with installing the Nvidia proprietary driver via DKMS on Ubuntu 20.04. This affects users who have upgraded to the latest kernel version and are trying to install the driver using the DKMS method.

This issue can be frustrating for users as it prevents them from installing the necessary drivers for their graphics card, leading to hardware compatibility problems.

⚠️ Common Causes

  • The primary reason for this error is that the GCC package version reported by apt (9.3.0) does not match the version used by the kernel (9.4.0). This mismatch can occur when the system is updated, and the package manager fails to update the GCC package correctly.
  • Another possible cause could be a corrupted or incomplete installation of the GCC package, which may result in an incorrect version being reported.

πŸš€ How to Resolve This Issue

Update the GCC package to match the kernel version

  1. Step 1: Open a terminal and run the command 'sudo apt-get update' to ensure that the package index is up-to-date.
  2. Step 2: Run the command 'sudo apt install gcc-9' to upgrade the GCC package to version 9.4.0, which matches the kernel version.

Manually download and install a compatible GCC package

  1. Step 1: Download the GCC package for Ubuntu 20.04 from the official Ubuntu website or a trusted repository.
  2. Step 2: Run the command 'sudo dpkg -i gcc-9*.deb' to install the downloaded package, which should match the kernel version.

🎯 Final Words

After following these steps, the issue with the incompatible GCC version should be resolved, allowing users to successfully install the Nvidia proprietary driver via DKMS on Ubuntu 20.04.

Did this fix your problem?

If not, try searching for specific error codes.

πŸ” Search Error Database

❓ Frequently Asked Questions