5

I had a hard time installing Nvidia drivers in a fresh install of Ubuntu 20.04. Installing via sudo apt install nvidia-driver-430 resulted in a list of 542 packages to install. I ended up spending a bit of manual effort to get the Nvidia-provided driver installed without nearly so many dependencies (only had to install gcc and make).

Is this massive number of dependencies normal for Ubuntu Server? I did a very vanilla install without the GUI. Reddit suggested I ask here, as their opinion is that I should just install from the default repos, but I felt that so many packages was absurd just to install a driver.

Edit for clarity: installing the nvidia-driver-430 package appears to install the entire Gnome shell, which I feel is unnecessary on a server.

2 Answers2

8

You can install headless version of an Nvidia driver with the following command:

apt install nvidia-headless-440-server nvidia-utils-440-server

dpint
  • 96
0

I personally recommend you follow this. This is absolutely a time saver for installing these graphics drivers.

Source of this info: here

Install NVIDIA Graphics Driver via runfile

Initially remove all the previous Nvidia drivers (Important)

sudo apt-get purge nvidia*

# Note this might remove your cuda installation as well
sudo apt-get autoremove 

Download the required driver from Nvidia website

Install dependenices

For Ubuntu, installing the following dependencies is enough.

1) build-essential -- For building the driver

2) (Optional) gcc-multilib -- For providing 32-bit support

3) dkms -- For providing dkms support

As a summary, All the above packages can be installed using this command sudo apt-get install build-essential gcc-multilib dkms

Create Backlist for Nouveau driver

Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

blacklist nouveau
options nouveau modeset=0

Then,

for Ubuntu 14.04 LTS, reboot the computer;

for Ubuntu 16.04 LTS, excute sudo update-initramfs -u and reboot the computer;

Stop lightdm/gdm/kdm

After the computer is rebooted. We need to stop the desktop manager before excuting the runfile to install the driver. lightdm is the default desktop manager in Ubuntu. If GNOME or KDE desktop environment is used, installed desktop manager will then be gdm or kdm.

For Ubuntu 14.04 / 16.04, excuting sudo service lightdm stop (or use gdm or kdm instead of lightdm)

For Ubuntu 16.04, excuting sudo systemctl stop lightdm (or use gdm or kdm instead of lightdm)

Excuting the Runfile

Enter the tty and enter these commands to execute the file

cd ~
chmod +x NVIDIA-Linux-x86_64-384.69.run
sudo ./NVIDIA-Linux-x86_64-384.69.run --dkms -s

These errors can be safe to ignore

WARNING: nvidia-installer was forced to guess the X library path '/usr/lib' and X module path '/usr/lib/xorg/modules'; these paths were not queryable from the system.  If X fails to find the NVIDIA X driver module, please install the `pkg-config` utility and the X.Org SDK/development package for your distribution and reinstall the driver.

Check the Installation

After a succesful installation, nvidia-smi command will report all your CUDA-capable devices in the system.

Hope this helps

  • This looks like a link only answer. Please expand it by including an explanation and essential steps. – mikewhatever Jun 05 '20 at 17:00
  • 1
    The first method, installing via apt-get, includes the gnome shell and all its dependencies. This is what resulted in about 550 packages to install. This being a server, I did not want to install all those packages or the shell in general. What did work was the .run installation method, but that results in a driver that has to be reinstalled occasionally due to kernel update packages, and isn't in a repo for regular updates. – Chad Quinlan Jun 05 '20 at 17:09
  • If you get an error, "ERROR: You appear to be running an X server; please exit X before installing.", check out https://askubuntu.com/questions/149206/how-to-install-nvidia-run – Jacob Stern Oct 23 '20 at 17:12