1.卸载nvidia驱动
Search what packages from nvidia you have installed.
dpkg -l | grep -i nvidia
if you want to be sure that you will purge everything related to nvidia you can give this command。卸载以nvidia-开头的包
sudo apt-get remove --purge nvidia-*
这个命令会卸载掉nvidia-common
,而这个包是ubuntu-desktop
的一个依赖包,所以需要重新安装下ubuntu-desktop
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf //清空配置文件
Also sometimes the nouveau driver get blacklisted from nvidia driver. With purge command it should UN-blacklisted. If you want to be sure that nouveau will be load in boot, you can force-load it by add it to /etc/modules。重启nouveau驱动
echo 'nouveau' | sudo tee -a /etc/modules
tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
2.安装显卡驱动
先卸载驱动
sudo apt-get remove --purge nvidia-*
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf
echo 'nouveau' | sudo tee -a /etc/modules
关闭lightdm
sudo service lightdm stop
开启:
sudo start lightdm
查看当前适用的显卡驱动:
prime-select query
如果输出intel, 则执行下列命令:
sudo update-alternatives --config i386-linux-gnu_gl_conf
选择nvidia-340-uvm那一项
sudo update-alternatives --config x86_64-linux-gnu_gl_conf
同样选择nvidia-340-uvm那一项
最后执行更新系统:
sudo ldconfig -n
sudo update-initramfs -u
选择nvi的驱动:
sudo prime-select nvidia
查看当前的启动级别
runlevel
如果安装官方驱动后,出现开机无法黑屏的情况,解决办法
可在grub引导界面(就是让你选择操作系统的界面)按e进入grub启动命令设置,在“ linux /boot/vmlinuz-……(中间省略)……ro quiet splash……”这一行splash后面添加nomodeset(要先添加空格),然后ctrl+c或者F10启动就能成功进入。