给笔记本电脑安装nvidia驱动的辛路历程

给笔记本电脑安装nvidia驱动的辛路历程

      • 问题一: apt-get update失败,错误表现 12:13 ~ 12:40
      • 问题二: 判断ubuntu下独立显卡是否生效 14:32~15:51
      • 问题三:安装nvidia驱动 ~16:44
      • 问题四 安装 nvidia-docker
      • 问题五:加载tensorflow-gpu的docker镜像 20:25

现在是2019年10月27日 12:13分已经捣鼓了快一个多小时了,今天的目标是给自己刚买的笔记本安装双系统并给ubuntu系统上安装好tensorflow并利用起笔记本上的独立显卡。

问题一: apt-get update失败,错误表现 12:13 ~ 12:40

忽略:1 http://extras.ubuntu.com/ubuntu precise InRelease
获取:2 http://extras.ubuntu.com/ubuntu precise Release [11.9 kB]
忽略:3 http://mirrors.163.com/ubuntu precise InRelease                                                                                                                                                     
获取:4 http://mirrors.163.com/ubuntu precise-updates InRelease [55.7 kB]                                                                                                                                   
获取:5 http://mirrors.163.com/ubuntu precise-backports InRelease [55.7 kB]                                                                                                                                 
获取:6 http://mirrors.163.com/ubuntu precise-security InRelease [55.7 kB]                                                                                                                                  
获取:7 http://mirrors.163.com/ubuntu precise Release [49.6 kB]                                                                                                                                             
错误:4 http://mirrors.163.com/ubuntu precise-updates InRelease                                                                                                                                             
  下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
获取:8 http://mirrors.163.com/ubuntu precise Release.gpg [198 B]                                                                                                                                           
错误:5 http://mirrors.163.com/ubuntu precise-backports InRelease                                                                                                                                           
  下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
错误:6 http://mirrors.163.com/ubuntu precise-security InRelease                                                                                                                                            
  下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
忽略:8 http://mirrors.163.com/ubuntu precise Release.gpg                                                                                                                                                   
获取:2 http://extras.ubuntu.com/ubuntu precise Release [11.9 kB]                                                                                                                                           
获取:9 http://extras.ubuntu.com/ubuntu precise Release.gpg [72 B]
忽略:9 http://extras.ubuntu.com/ubuntu precise Release.gpg
正在读取软件包列表... 完成     
W: GPG 错误:http://mirrors.163.com/ubuntu precise-updates InRelease: 下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
E: 仓库 “http://mirrors.163.com/ubuntu precise-updates InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
W: GPG 错误:http://mirrors.163.com/ubuntu precise-backports InRelease: 下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
E: 仓库 “http://mirrors.163.com/ubuntu precise-backports InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
W: GPG 错误:http://mirrors.163.com/ubuntu precise-security InRelease: 下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
E: 仓库 “http://mirrors.163.com/ubuntu precise-security InRelease” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
W: GPG 错误:http://mirrors.163.com/ubuntu precise Release: 下列签名无效: 630239CC130E1A7FD81A27B140976EAF437D05B5
E: 仓库 “http://mirrors.163.com/ubuntu precise Release” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
W: GPG 错误:http://extras.ubuntu.com/ubuntu precise Release: 由于没有公钥,无法验证下列签名: NO_PUBKEY 16126D3A3E5C1192
E: 仓库 “http://extras.ubuntu.com/ubuntu precise Release” 没有数字签名。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

由于我将 /etc/apt/sources.list更换成了网易的库,在允许apt-get update报了以上错误。
解决办法:忽略这个错误,直接更换成其他可用的源。具体可以参考:
update apt-get各大国内镜像源替换
可以根据自己的网段选择合适的镜像源头。

问题二: 判断ubuntu下独立显卡是否生效 14:32~15:51

lshw -c video

WARNING: you should run this program as super-user.
  *-display UNCLAIMED       
       description: VGA compatible controller
       product: NVIDIA Corporation
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list
       configuration: latency=0
       resources: memory:d3000000-d3ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:4000(size=128) memory:d2000000-d207ffff
  *-display
       description: VGA compatible controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 02
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:131 memory:d5000000-d5ffffff memory:80000000-bfffffff ioport:5000(size=64) memory:c0000-dffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

可以看到我的笔记本上有两个显卡, interl带的显卡 和 nvidia的独立显卡

也可以通过:

lspci|grep -i VGA

00:02.0 VGA compatible controller: Intel Corporation Device 3e98 (rev 02)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2191 (rev a1)

若要查看GPU的详细信息

lspci -v -s 01:00.0

01:00.0 VGA compatible controller: NVIDIA Corporation Device 2191 (rev a1) (prog-if 00 [VGA controller])
	Subsystem: CLEVO/KAPOK Computer Device 951d
	Flags: bus master, fast devsel, latency 0, IRQ 16
	Memory at d3000000 (32-bit, non-prefetchable) [size=16M]
	Memory at c0000000 (64-bit, prefetchable) [size=256M]
	Memory at d0000000 (64-bit, prefetchable) [size=32M]
	I/O ports at 4000 [size=128]
	Expansion ROM at d2000000 [disabled] [size=512K]
	Capabilities: 
	Kernel modules: nvidiafb, nouveau

GPU的显卡内存是256M
结论:笔记本的显卡是连接了的

问题三:安装nvidia驱动 ~16:44

在 NVIDIA驱动 上选择合适的驱动
给笔记本电脑安装nvidia驱动的辛路历程_第1张图片
参照Ubuntu如何查看显卡信息及安装显卡驱动
但在允许驱动时出现 md5不对应的情况。

./NVIDIA-Linux-x86_64-430.09.run

Verifying archive integrity... Error in check sums 4292664292 3989973899

网上查到的说法是下载的驱动版本不对,但我是按照我的显卡对应的版本来下载的,找不到问题出在哪放弃这条路。我换一个思路来做。直接使用apt工具查找驱动

apt-cache search nvidia-* |grep 430

 libnvidia-cfg1-418 - Transitional package for libnvidia-cfg1-430
libnvidia-cfg1-430 - NVIDIA binary OpenGL/GLX configuration library
libnvidia-common-418 - Transitional package for libnvidia-common-430
libnvidia-common-430 - Shared files used by the NVIDIA libraries
libnvidia-compute-418 - Transitional package for libnvidia-compute-430
libnvidia-compute-430 - NVIDIA libcompute package
libnvidia-decode-418 - Transitional package for libnvidia-decode-430
libnvidia-decode-430 - NVIDIA Video Decoding runtime libraries
libnvidia-encode-418 - Transitional package for libnvidia-encode-430
libnvidia-encode-430 - NVENC Video Encoding runtime library
libnvidia-fbc1-418 - Transitional package for libnvidia-fbc1-430
libnvidia-fbc1-430 - NVIDIA OpenGL-based Framebuffer Capture runtime library
libnvidia-gl-418 - Transitional package for libnvidia-gl-430
libnvidia-gl-430 - NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
libnvidia-ifr1-418 - Transitional package for libnvidia-ifr1-430
libnvidia-ifr1-430 - NVIDIA OpenGL-based Inband Frame Readback runtime library
nvidia-compute-utils-418 - Transitional package for nvidia-compute-utils-430
nvidia-compute-utils-430 - NVIDIA compute utilities
nvidia-dkms-418 - Transitional package for nvidia-dkms-430
nvidia-dkms-430 - NVIDIA DKMS package
nvidia-driver-418 - Transitional package for nvidia-driver-430
nvidia-driver-430 - NVIDIA driver metapackage
nvidia-headless-418 - Transitional package for nvidia-headless-430
nvidia-headless-430 - NVIDIA headless metapackage
nvidia-headless-no-dkms-418 - Transitional package for nvidia-headless-no-dkms-430
nvidia-headless-no-dkms-430 - NVIDIA headless metapackage - no DKMS
nvidia-kernel-common-418 - Transitional package for nvidia-kernel-common-430
nvidia-kernel-common-430 - Shared files used with the kernel module
nvidia-kernel-source-418 - Transitional package for nvidia-kernel-source-430
nvidia-kernel-source-430 - NVIDIA kernel source package
nvidia-utils-418 - Transitional package for nvidia-utils-430
nvidia-utils-430 - NVIDIA driver support binaries
xserver-xorg-video-nvidia-418 - Transitional package for xserver-xorg-video-nvidia-430
xserver-xorg-video-nvidia-430 - NVIDIA binary Xorg driver

安装其中:
nvidia-driver-430, nvidia-utils-430

测试是否安装成功

nvidia-smi

问题四 安装 nvidia-docker

docker 安装
参考nvidia-docker安装
另外docker 若使用docker hub镜像可能下载较慢,可以更换docker国内镜像

nvidia-docker run -it fce289e99eb9

docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.

是由于nvidia-docker未注册导致的,可以运行以下步骤解决: docker-engine-setup
Systemd drop-in file

sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/override.conf <

Daemon configuration file

sudo tee /etc/docker/daemon.json <

问题五:加载tensorflow-gpu的docker镜像 20:25

在docker-hub 找到合适的tensorflow-gpu镜像
注意下载的tensorflow-gpu的版本中gpu驱动的要求。

docker pull tensorflow/tensorflow:nightly-gpu-py3-jupyter

总算搞定了!!

下一篇写关于tensorflow跑一些简单网络的测试代码。

你可能感兴趣的:(机器学习)