Welcome to my GitHub

https://github.com/zq2599/blog_demos

Content: All original articles are categorized and summarized and supporting source code, involving Java, Docker, Kubernetes, DevOPS, etc.;

Overview of this article

  • The desktop computer is the 3rd generation of HP Hidden Genie purchased in 2018, and the graphics card is GTX1060. This article records the process of installing Ubuntu 16.04.7 LTS on this machine, and then installing the Nvidia driver;
  • In addition, there are some summaries for avoiding pits, which can be used for reference if you encounter similar problems;

Pure Ubuntu system

  • Install Ubuntu16 LTS desktop first
  • U disk installation, here is the HP desktop computer, when the HP LOGO appears at startup, click F10 several times, enter the bios, select the U disk to start the boot sequence, and then successfully install the Ubuntu system under the guidance of the page

Points to pay attention to

  • Many installation documents on the Internet mentioned that it is necessary to turn off secure boot in the BIOS settings. I did not find this option here, so I skipped it and did not do it. The installation can still be successful, but a few steps after installing the driver are essential. You need to follow the operations in the article;

enable remote ssh

  • Log in to the Ubuntu desktop, open the console, and execute the following command to install the ssh service:
sudo apt-get install openssh-server
  • start ssh service
sudo service ssh start
  • For the next operations, I am all remotely connected to this Ubuntu16 computer via ssh from another computer.

change source

  • Backup:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk
  • Modify /etc/apt/sources.list to the following:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

Ready to work

  • delete old driver
sudo apt-get remove --purge nvidia*
  • To shield the open source driver nouveau, first create a new file:
sudo vi /etc/modprobe.d/blacklist-nouveau.conf
  • Added the following:
blacklist nouveau
options nouveau modeset=0
  • Update the above configuration:
sudo update-initramfs -u
  • At this point, execute the command <font color="blue">lsmod | grep nouveau</font> and you can also see the following content, which proves that the configuration just now has not taken effect:
will@ubuntu-hp:~$ lsmod | grep nouveau
nouveau              1712128  4
mxm_wmi                16384  1 nouveau
i2c_algo_bit           16384  1 nouveau
ttm                   106496  1 nouveau
drm_kms_helper        172032  1 nouveau
drm                   401408  7 drm_kms_helper,ttm,nouveau
wmi                    24576  4 hp_wmi,wmi_bmof,mxm_wmi,nouveau
video                  45056  1 nouveau
  • In order for the previous configuration to take effect, please restart the computer immediately <font color="blue">sudo reboot</font>
  • After restarting, log in with ssh again, and execute the command <font color="blue">lsmod | grep nouveau</font>. The content is no longer visible, which proves that the previous configuration has taken effect;

install driver

  • Add official ppa source
sudo add-apt-repository ppa:graphics-drivers/ppa
  • renew
sudo apt-get update
  • Check out recommended drivers:
ubuntu-drivers devices
  • Select the driver with the word (recommended) behind it, as shown in the red box below, my side is <font color="blue">nvidia-430</font>:

在这里插入图片描述

  • Start installing the driver, taking care to use the recommended driver you see for yourself:
sudo apt-get install nvidia-430 nvidia-settings nvidia-prime
  • When you encounter the following image, enter Enter:

在这里插入图片描述

  • When you encounter the following image, enter the eight-digit password, and then a page to confirm the password will pop up, continue to enter the same password:

在这里插入图片描述

  • After the installation is complete, restart the computer, and then there will be <font color="red"> crucial step </font>, please be sure to do

Settings at restart

  • Select <font color="blue">Enroll MOK</font> when prompted:

在这里插入图片描述

  • Select <font color="red">Continue</font>:

在这里插入图片描述

  • From the pop-up menu, select <font color="blue">Yes</font>:

在这里插入图片描述

  • Enter the password you just set:

在这里插入图片描述

  • Select <font color="blue">reboot</font>:

在这里插入图片描述

  • After the restart is complete, ssh login, execute the command <font color="blue">nvidia-smi</font>, as shown below, finally installed:

在这里插入图片描述

Install NCVV

  • nvcc is the CUDA compiler, the installation command is as follows:
sudo apt install nvidia-cuda-toolkit
  • verify:
will@ubuntu-hp:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

Appendix 1: Repeated reboots

  • In the beginning, I used a dual-head hdmi cable, which was connected to the graphics card and the monitor respectively, and the result would keep restarting. After switching to a dual-head DP cable, the problem did not recur.

Appendix 2: nvidia-smi command failed

  • Enter <font color="blue">nvidia-smi</font> to check the driver, but encounter the following problems:
will@ubuntu-hp:~$ 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.
  • Execute <font color="blue">ls /usr/src/</font>, you will see a folder named nvidia-xxx, as shown in the red box below, here is <font color="red">nvidia- 430.64</font>:

在这里插入图片描述

  • Excuting an order:
sudo dkms install -m nvidia -v 430.64

Appendix 3: Repeated Password Requests

  • At this point, after entering the password on the Ubuntu computer, after waiting a few seconds, it will return to the page for entering the password, and I still cannot log in.
  • This is because the integrated graphics card is set in GRUP, and at this time we have installed the Nvidia driver, so we can no longer log in with the integrated graphics driver, and we need to modify the settings
  • At this time, the ssh remote connection is normal. Connect first, open the file <font color="blue">/etc/default/grub</font>, and find the line <font color="red">GRUP_CMDLINE_LINUX_DEFAULT</font> , and modify the value to the content of the red box in the following figure:

在这里插入图片描述

  • Restart, log in smoothly

Appendix 4: Obtaining the Kernel source

  • Install linux-source:
sudo apt-get install linux-source
  • When executing the above command, pay attention to the content in the red box below:

在这里插入图片描述

  • The above red box is <font color="red">4.4.0-210.242</font>, so the next command to be executed is (do not pay attention to the content after the third decimal point):
sudo apt-get install linux-headers-4.4.0-210-generic

You are not alone, Xinchen Original is with you all the way

  1. Java series
  2. Spring series
  3. Docker series
  4. kubernetes series
  5. database + middleware series
  6. DevOps Series

Welcome to the public number: Programmer Xin Chen

Search "Programmer Xinchen" on WeChat, I am Xinchen, I look forward to traveling the Java world with you...
https://github.com/zq2599/blog_demos

程序员欣宸
147 声望24 粉丝

热爱Java和Docker