# NVIDIA Driver Not Detected After Upgrade Kernel

{% hint style="warning" %}
This guide can be used if the NVIDIA driver is not detected after upgrading the kernel.
{% endhint %}

Before the kernel update, the Nvidia driver was successfully installed using the file `NVIDIA-Linux-x86_64-550.54.14-grid.run`. When running the `nvidia-smi` command, it can be seen that the driver is still detected on your computer system.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fh5gEw3Hpvlrqu9bQWHMv%2Fimage.png?alt=media&#x26;token=b30ed6a3-c8e0-4f52-8aad-b2893d2b76d8" alt=""><figcaption><p>nvida-smi</p></figcaption></figure>

However, after the kernel update, the attempt to reinstall using `NVIDIA-Linux-x86_64-550.54.14-grid.run` failed.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2F03kj41GxSD7lOV8ozsPt%2Fimage.png?alt=media&#x26;token=12bb6d65-9490-464a-a0f7-ad79a47ca358" alt=""><figcaption><p>Error</p></figcaption></figure>

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2FYdPvOHHyGfQUH9rEG8sE%2Fimage.png?alt=media&#x26;token=6e67a2d8-c5bf-41d2-9ce1-10c396b88c54" alt=""><figcaption><p>Error</p></figcaption></figure>

So in this case it can be seen that the NVIDIA driver is not detected. You need to do several steps to solve the NVIDIA Driver not detected problem.

## Uninstall Driver NVIDIA

In the first step, you can remove the previously installed NVIDIA packages by running the following commands. These commands are used to remove all packages related to NVIDIA from the system.

```bash
sudo apt-get remove nvidia*
```

These commands are used to remove all library packages related to Nvidia from the system.

```bash
sudo apt-get remove libnvidia*
```

These commands are used to clean the system of packages that are no longer needed after removing the Nvidia packages.

```bash
sudo apt-get autoremove
```

These commands are used to display a list of all Nvidia-related packages that are still installed on the system. This helps ensure that all Nvidia packages have been removed or to identify any packages that may still be remaining.

```bash
dpkg -l | grep nvidia
```

This command is used to remove the specific package "libnvidia-compute-550:amd64" from the system. It is used to ensure that a particular version of the Nvidia library is removed, typically to resolve conflicts or compatibility issues.

```bash
sudo apt-get remove libnvidia-compute-550:amd64
```

## Reinstall Driver NVIDIA

The second step is to reinstall the NVIDIA driver on your computer by running the following commands.

```bash
sudo ./NVIDIA-Linux-x86_64-550.54.14-grid.run
```

## Restart Service

The third step is to restart the services that are being used.

```bash
sudo systemctl restart nvidia-gridd.service
sudo systemctl status nvidia-gridd.service
nvidia-smi
```

## Prevention

To prevent this problem from occurring again in the future, the update kernel needs to be retained.

#### 1. **Check the Current Kernel Version**

Run the following command in the terminal to check the active kernel version.

```bash
uname -r
```

**Example output**

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdttirV9m4r5RlHxjmUNaU32CIRPGT_xeZ9ZBucvugPr7PayV-ZvJ0erdNBD92JwCqK0aqyqEYOoFwAQ80F1R_TUG_JrEBJPTbPdsfbZUXJ_zkBDWpHB-FeuTJyOVY5D0bWW_lVTlsvlGGtghkatkQ?key=k7F6zkDwbRDarUABscjeWnS8" alt=""><figcaption></figcaption></figure>

#### 2. **View Installed Kernels**

To see all the kernels installed on your system, use this command.

```bash
dpkg --list | grep linux-image
```

**Example Output**

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd2SRR6k4LSB4uotObzpm7GUuuDGzhe99bIHcFSG0sZWdem5YJ4wNSmZdo9CgcMKxZ9V0uVVWIiMWZKsU_Klzld-tXL-uZG_JEC3v9_RxYkCsjzxH1bVXGXJZc3G7AebbQALtXPuPFJsrvgk-eYln4?key=k7F6zkDwbRDarUABscjeWnS8" alt=""><figcaption></figcaption></figure>

#### 3. **Hold Kernel Updates**

Hold kernel upgrade using the following command, adjusting the version to the installed kernel, execute the following commands.

```bash
sudo apt-mark hold linux-image-5.15.0-56-generic
```

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdw5KIIdAMziZDnp73TBWNBR7HGf6XSQmuyE30ZcBa7CJMteiDQwAvbUNRElfvK4cmX4DHIwcHpk6DZ-bqEpYG6hBf2412p9pisat-2CFahbp-2A9u4_UjEnSlZW9f2rpUn-fDtEfmBNuObEjOpqB4?key=k7F6zkDwbRDarUABscjeWnS8" alt=""><figcaption><p>Hold Kernel Update</p></figcaption></figure>

```bash
sudo apt-mark hold linux-image-virtual
```

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcuuUjMrVpScz2Y4b6RHPyVKGJpq2Y0ZEU_UR7ll_ZtXR0SO2nTfgkphe52UWxN5hEZY3HsLTMjchGnaeuFGmuyJpby8_mP4th5ByzrpcZdGeo1iEFuN4-XmYpdFgKJlG-9R-ifXKVRhxMh15bVl7U?key=k7F6zkDwbRDarUABscjeWnS8" alt=""><figcaption><p>Hold Kernel Update</p></figcaption></figure>
