Detailed steps for installing graphics card driver in Ubuntu

Detailed steps for installing graphics card driver in Ubuntu

1. Nouveau disabled

1.1 Introduction to Nouveau Driver

​ Nouveau is a common project organized by enthusiasts to develop third-party open source 3D drivers for NVIDIA graphics cards, and Nouveau was developed without any support from NVIDIA. Nouveau is a project of the X.Org Foundation (Note: The X.Org Foundation is a community responsible for the development of the X Window System. It was established on January 22, 2004 on the basis of the X.org website of the Open Group. ). We are also very familiar with the development method, which is similar to the development method of the innovative sound card kX driver in the past. It decompiles NVIDIA's Linux graphics driver, and then conducts further development work for further processing.

​ Although Nouveau Gallium3D is far from comparable to NVIDIA's official private driver in terms of game speed, it makes it easier for Linux to cope with various complex NVIDIA graphics card environments, allowing users to enter the desktop after installing the system and have a good display effect. Therefore, many Linux distributions integrate the Nouveau driver by default, and it is installed by default when encountering NVIDIA graphics cards.

This is especially true for the enterprise version of Linux. Almost all enterprise Linux distributions that support graphical interfaces include Nouveau.

1.2 Whether the Nouveau driver is installed in the system

​ After the system is reinstalled, if only one resolution is available and the resolution becomes extremely small, it means that the system does not have any drivers installed.

​ Open a Linux terminaland enter the following command, if there is no content output, it means that there is no Nouveau driver, you can skip this chapter and go directly to the NVIDIA driver installation;

​ Conversely, if nouveau information is printed, you need to disable nouveau first ;

 $ lsmod | grep nouveau

1.3 Disable Nouveau driver

  • 为啥要禁用nouveau驱动?

​ From the driver introduction, we know that the default installation of the Nouveau driver allows users to enter the desktop after installing the system and has a good display effect. However, for personal desktop users, Nouveau in the growth stage is not perfect. , the error is usually as follows:

ERROR: The Nouveau kernel driver is currently in use by your system. This  driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.

Please consult the NVIDIA driver README and your Linux distribution's documentation

for details on how to correctly  disable the Nouveau kernel driver.
  • 禁用nouveau驱动步骤

    Open a Linux terminaland enter the following command

$ sudo gedit /etc/modprobe.d/blacklist.conf

​ Add the following at the end of the file

blacklist nouveau
options nouveau modeset=0

insert image description here

​ Update to make it effective

$ sudo update-initramfs -u

​ Restart the device

reboot

​ Check whether nouveau is disabled successfully

lspci | grep nouveau

​ If terminalthere is no content output, the disabling is successful.

2. Install gcc and cmake

​ Open a Linux terminaland enter the following commands to install gcc and cmake

$ sudo apt-get install build-essential 
$ sudo apt-get install cmake

​ Check whether the installation is successful:

$ gcc --version
$ cmake --version

​ Linux terminalhas a version number display indicating that the installation was successful.

3. Install NVIDIA driver

​ Open a Linux terminaland enter the following command to check the driver version recommended by the system

$ sudo ubuntu-drivers devices

​ The terminal prints information as follows:

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
vendor   : NVIDIA Corporation
modalias : pci:v000010DEd00001C60sv0000103Csd000084DBbc03sc00i00
driver   : nvidia-384 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin
driver   : nvidia-430 - third-party free recommended
driver   : nvidia-415 - third-party free
driver   : nvidia-418 - third-party free
driver   : nvidia-410 - third-party free

​ You can see that there are recommended driver version numbers in the driver line;

3.1 Method 1 - Install using apt install (not recommended)

​ By determining the driver version recommended by the system, select one of the versions for apt install

​ Open a Linux terminaland enter the following command, for example, install nvidia-415

$ sudo apt install nvidia-driver-415

​ This method takes a long time to install, and it is not recommended to use sudo apt install to install it here

After the installation is successful, enter lsmod | grep nvidiathe terminal to print the information as follows:

holden@holden:~$ lsmod | grep nvidia
nvidia_uvm            786432  0
nvidia_drm             45056  6
nvidia_modeset       1040384  13 nvidia_drm
nvidia              16588800  627 nvidia_uvm,nvidia_modeset
drm_kms_helper        172032  1 nvidia_drm
drm                   401408  9 drm_kms_helper,nvidia_drm
ipmi_msghandler        53248  2 ipmi_devintf,nvidia

3.2 Method 2 – Add source to install NVIDIA driver

​ Under normal circumstances, it is more reliable to install the Nvidia graphics card driver by adding the source, and it is also convenient for future updates.

​ Since the new version of Ubuntu (>=14.04) has a built-in driver management program, we strongly recommend installing the graphics card driver through the driver management program: System Settings -> Software and Updates -> Additional Drivers .

insert image description here

  • Please check the nvidia graphics driver whose version number is higher than 410 .

​ If there is no relevant option in the list, please add the source and try again:

​ Open a Linux terminaland enter the following command

$ sudo add-apt-repository ppa:graphics-drivers/ppa

$ sudo apt-get update

​ Installing the graphics card driver through the driver management program is safer than manual operation , because manual installation may encounter a black screen problem that requires reinstalling the operating system to solve it.

3.3 Method 3 – Download and install drivers from NVIDIA official website (commonly used)

3.3.1 Check the device graphics card model

​ When entering the NVIDIA official website to download the driver, you need to know the graphics card model of the device

​ Open a Linux terminaland enter the following command to check the graphics card model

$ lspci | grep -i vga

​The terminal will print information as follows:

  • The first one: directly output the model "GeForce GTX 1060 Mobile 6GB", indicating the discrete graphics card model of the device
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile 6GB] (rev a1)
  • The second type: the specific model is not directly printed out. At this time, we need to use the PCI index platform to obtain the graphics card model information: PCI ID Repository
00:02.0 VGA compatible controller: Intel Corporation Device 3e9b (rev 02)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2191 (rev a1)

insert image description here

3.3.2 NVIDIA official website download driver

​GeForce driver download address

​NVIDIA All Driver Downloads

​ Take GeForce series graphics cards as an example

​ After entering the official website, select the manual search driver as shown in the figure below, and click "Start Search" to download according to the driver corresponding to your system.

insert image description here

insert image description here

3.3.3 Turn off display mode

Press and hold at the same time Ctrl+Alt+F1to enter the tty1 terminal mode, and enter the following command to close the display management:

$ sudo service lightdm stop

3.3.4 Install the driver

Go to the driver directory and run the driver you just downloaded on the command line terminal:

sudo ./NVIDIA-Linux-x86_64-430.64.run --no-opengl-files

The installation process is selected according to the following steps:

insert image description here
insert image description here
insert image description here
insert image description here

3.3.5 Check the installation result

​ After the driver is installed , restart the device , input nvidia-smiand view the output similar to the following, indicating that the installation has been successful.

insert image description here

3.3.6 (error) Graphics card driver does not support running in X-Windows service

​The following error occurs during the installation

​ Tip: Since the graphics card driver does not support running the X-Windows service, it needs to enter runlevel 3.

ERROR: You appear to be running an X server; please exit X before installing.

​ The solution is as follows:

​[ 1] Press the Ctrl, Alt and F2 keys simultaneously

Localhostlogin: 

Password:

​[ 2] Switch to root privileges

$ sudo passwd 
$ su su-

​[ 3] Enter init3 to enter text mode

$ init 3

​[ 4] Find the folder where the driver is located to install the driver

$ sudo ./NVIDIA-Linux-x86_64-430.64.run --no-opengl-files

​ Remember to restart the device after the driver is installed

4. Summary

​ According to the above graphics card driver installation, 80% can be installed successfully

​ Don’t panic when you encounter problems, believe that the problems you encounter have been encountered by others, and Google more;

insert image description here

Guess you like

Origin blog.csdn.net/m0_54792870/article/details/112980817