How to properly configure NVIDIA driver in Ubuntu 18?

Hi all,
I am struggling with setting up my new laptop. I’ve spent several days figuring out what and how to do in order to get all from my computer. Installing and configuring NVIDIA driver is seemingly the worst part, yet.

I got a new laptop, Acer Nitro 5 with NVIDIA RTX 3050 and Intel card, and fresh Ubuntu 18.06. Since graphics didn’t start using the system provided driver installation, I used ‘’ script downloaded from Official Drivers | NVIDIA?
I have UEFI with secure boot disabled.

When I am done with configuring the driver, I am going to install CUDA and cuDNN.

Following is my installation steps:

sudo gedit /etc/default/grub # I put ’ nomodeset’ before the last quotation mark in the line: GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”
sudo update-grub

sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove

sudo dpkg --add-architecture i386
sudo apt update
sudo apt -y install build-essential libc6:i386 libglvnd-dev pkg-config
sudo bash -c “echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf”
sudo bash -c “echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf”
sudo update-initramfs -u
sudo reboot

sudo bash --no-x-check # I selected installing 32 compatibility and skipped automatic X configuration (otherwise it didn’t start after reboot)

My attempts to configure the resulting installation didn’t work well. Every time something was wrong, and I couldn’t fix it using google only. So now I am asking for human help.

Following is some symptoms I’ve seen in others’ issues, so they could be relevant:

File /etc/X11/xorg.conf doesn’t exist

$ lspci -v | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Device 9a68 (rev 01) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller: NVIDIA Corporation Device 25a2 (rev a1) (prog-if 00 [VGA controller])

$ nvidia-smi
Sun Jan 2 18:36:01 2022
| NVIDIA-SMI 470.94 Driver Version: 470.94 CUDA Version: 11.4 |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
| 0 NVIDIA GeForce … Off | 00000000:01:00.0 Off | N/A |
| N/A 35C P0 9W / N/A | 5MiB / 3910MiB | 0% Default |
| | | N/A |

| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
| 0 N/A N/A 885 G /usr/lib/xorg/Xorg 4MiB |

$ xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 0mm x 0mm

$ nvidia-settings

(nvidia-settings:3976): GLib-GObject-CRITICAL **: 18:39:33.772: g_object_unref: assertion ‘G_IS_OBJECT (object)’ failed

ERROR: nvidia-settings could not find the registry key file or the X server is not accessible. This file
should have been installed along with this driver at
/usr/share/nvidia/nvidia-application-profiles-key-documentation. The application profiles will
continue to work, but values cannot be prepopulated or validated, and will not be listed in the
help text. Please see the README for possible values and descriptions.

nvidia-bug-report.log.gz (317.8 KB)

This is a hybrid graphics notebook, primary gpu is the intel igpu. First of all, please remove the “nomodeset” kernel parameter. This won’t make it work since the kernel that comes witth 18.04 is too old to drive your intel gpu. Please either upgrade to 20.04 or install a current kernel:

The nvidia gpu and driver is working fine, it’s just only secondary, without the igpu, not much will work.

I’ve removed “nomodeset” fro /etc/default/grub, and upgraded to 20.04 with ‘sudo do-release-upgrade’.

How can I make everything working with igpu now? All the symptoms from the above post look pretty much the same. And I forgot to mention, I could not change screen brightness neithe with Fn+(->) nor with ‘System settings’. Xbrightness and brightness-controller do not work for me. And putting acpi_backlight=vendor/video in /etc/default/grub didn’t work. I guess now I need to configure the driver to adjust brightness too

Thanks in advance

Ubuntu 20.04 has two kernel versions available, the GA kernel 5.4 and the HWE kernel 5.11. You need the HWE kernel. Please check your current kernel version
cat /proc/version
and change to the HWE kernel, if necessary
If that doesn’t help, please create a new nvidia-bug-report.log.

1 Like

Thank you,

I have updated kernel to HWE with ‘sudo apt install --install-recommends linux-generic-hwe-20.04’ and rebooted

Brightness control works both from systems settings and with Fn+arrows. Shall I install the driver the same way as in the first post, or with ‘Software & updates’? I replicated my diagnostic just for case.

File /etc/X11/xorg.conf doesn’t exist

$ lspci -v | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Device 9a68 (rev 01) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller: NVIDIA Corporation Device 25a2 (rev a1) (prog-if 00 [VGA controller])

$ nvidia-smi
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm
1920x1080 144.00*+ 60.01 59.97 59.96 60.00 59.93
. . .
. . .
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)

$ nvidia-settings
ERROR: NVIDIA driver is not loaded
ERROR: Unable to load info from any available system

nvidia-bug-report.log.gz (107.7 KB)

$ cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0

Base system looks good, you can now reinstall the nvidia driver. Please uninstall the runfile driver first by running the installer again with --uninstall option.
This install is not recommended and didn’t survive the system upgrade. After uninstall and reboot, please use Software & Updates to install the driver, this will allow for the driver to be updated alongside your system.

Just did it. Everything looks fine. I am attaching new bug-report, since there are some "unable to … " there. I am marking the kernel thing as a solution.

Do I need any sort of special measures for CUDA and cuDNN installing?

nvidia-bug-report.log.gz (332.6 KB)

Logs looks fine.
Regarding cuda, don’t install the full “cuda” package, this will overwrite and possibly break the driver again. Install just “cuda-toolkit” if you’re using the .deb packages. If installing from runfile, skip driver install when asked.

1 Like

I installed cuda-toolkit and cudnn. Everything works.

Thanks a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.