ubuntu20.04安装完显卡驱动后黑屏问题解决
进入修复模式卸载已装驱动
我开始是在 可视化软件 软件与更新 中安装的显卡驱动,并按照网上教程禁用了nouveau驱动。但在重启过程中,发现电脑黑屏,左上角有横光标闪过。
于是再次按照网上教程,按住ctrl+alt+f1-6,进入tty模式,都没反应。于是只能进入修复模式卸载已装驱动,具体操作如下:
重启电脑,在系统选择界面选择ubuntu advanced(高级选项),然后选择带有括号的recovery mode
进入之后,在白框中选择root选项并进入
左下角出现 Press Enter for maintenance.....,按回车Enter
进入命令行后,输入下面代码卸载已有驱动,然后reboot重启进入系统
apt remove --purge nvidia*
卸载已有驱动后,禁用nouveau驱动。输入下面代码打开文档
sudo gedit /etc/modprobe.d/blacklist.conf
在文档后面添加下面代码并保存关闭
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
然后更新
sudo update-initramfs -u
完成以上后,去官网下载并重装驱动
官网下载并重装驱动
1. 系统更新
sudo apt update
sudo apt upgrade -y
2. 安装基础工具
sudo apt install -y build-essential cmake
sudo apt install -y lightdm
在弹出对话框选择"lightdm"
3. 进入英伟达官网 https://www.nvidia.cn/,找到自己显卡对应linux驱动,下载。完成后放入一个英文路径下的文件夹。路径要记住,后面要用到
4. 检查nouveau驱动是否禁用成功,输入下面代码,没有任何输出说明成功
lsmod | grep nouveau
5. 进入字符界面,后续将没有图形化界面,黑屏命令行状态。
按住组合键ctrl+alt+f3(f1-f6均可)进入字符界面,先输入用户名,再输入密码
6. 关闭图形界面
sudo service lightdm stop
7. 给驱动加权限
cd /home/wh //这里为驱动文件存放的英文路径
chmod 755 NVIDIA-Linux-x86_64-535.113.01.run //这里为你下载的驱动文件名,按Table键也可补全
8. 输入下面代码,安装驱动
sudo ./NVIDIA-Linux-x86_64-535.113.01.run -no-x-check -no-nouveau-check
9. 安装过程中一些选项的选择:
Multiple kernel module types are available for this systems. Which would you like to use? NVIDIA Proprietary MIT/GPL
An alternate method of installing the NVIDIA driver was detected.(This is usually a package provided by your distributor.) A driver installed via that method may integrate better with you system than a driver installed by
naidia-installer
Please review the message provided by the maintainer of this alternate installation method and decide how to proceed: Continue installation Abort installtion
The NVIDIA driver provided by Ubuntu can be installed by launching the "Software & Updates" application,and by selecting the NVIDIA driver from the "Additional Drivers" tab.
Continue installation
Would you like to register the kernel module source with DKMS? This will allow DKMS.... Yes
Install NVIDIA's 32-bit compatibility libraries? NO
Would you like to run the nvidia-xconfig utility to automatically update you X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.
Yes
10. 出现下面字样,说明安装成功
Your X configuration file has been successfully updated. Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version:535.113.01) is now complete.
11. 然后在命令行输入下面代码,重启。重启过程中,按f2进入bios模式,显卡设置为独立显卡,并关闭安全启动
sudo service lightdm start && reboot
12. 重启电脑,安装完成。