双显卡配置方案已经发到了deepin bbs,不知道会不会被采纳,更新到wiki中。
前言
一直觊觎Deepin Linux的美色,奈何256G硬盘太小,一直没装。昨天终于把持不住了,格掉了D盘,装上了Deepin。
此处不提供安装教材,安装教程见官网。
安装之后
首次启动问题
如果你的电脑也有Nvidia独显,不出意外,第一次启动不会成功,屏幕上会有类似这样的错误消息:
nouveau 000:01:00.0 tmr: stalled at XXXXXXXXXXX
nouveau 000:01:00.0 tmr: stalled at XXXXXXXXXXX
nouveau 000:01:00.0 tmr: stalled at XXXXXXXXXXX
nouveau是Nvidia显卡的开源驱动,出现类似错误消息是因为显卡驱动出了问题。
要解决驱动问题,需要想办法启动系统。长按电源键强制关机,重新启动,当grub菜单显示时,按下e键。

找到splash quite这行,在splash quite后面添加:
nouveau.modeset=0;

然后直接按下F10,不出意外的话系统会启动,并显示登录界面。
登录进系统之后,还需要完全禁用nouveau驱动。
打开深度终端,首先要修改/etc/modprobe.d/blacklist-bcm43.conf
$ sudo dedit /etc/modprobe.d/blacklist-bcm43.conf
在文件末尾加上这两行
blacklist nouveau
options nouveau modeset=0
再执行以下两条命令,从内核彻底禁用nouveau驱动并重启:
$ sudo update-initramfs -u
$ sudo init 6
重启后,执行以下命令,如果没有输出,说明nouveau已经被禁用:
$ lsmod | grep -i nouveau
安装驱动程序
笔者使用官方的闭源驱动,闭源驱动的优点不再解释。
下载的驱动是后缀名为run的文件,我的是NVIDIA-Linux-x86_64-440.100.run。
在安装之前,需要按下Ctrl+Alt+F2切换到TTY下,输入用户名密码登录。然后执行以下命令,关闭lightdm:
$ sudo systemctl stop lightdm
切换到驱动文件所在路径,执行以下命令:
$ chmod +x NVIDIA-Linux-x86_64-440.100.run
$ sudo ./NVIDIA-Linux-x86_64-440.100.run
一路回车之后,完成安装。再重启一次。
$ sudo init 6
配置xorg.conf
重启之后,执行以下命令,查看显卡情况:
$ nvidia-smi
如果识别出了Nvidia的显卡型号,说明安装成功。但是可以看到显存占用为0M,说明显卡并没有启用。需要创建/etc/X11/xorg.conf来配置显卡。

首先执行以下命令,查看显卡的BusID:
$ lspci | egrep -i 'VGA|3D'
输出如下
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
其中00:0.20是Intel集显,对应的BusID为0:2:0。01:00.0是Nvidia独显,对应的BusID为1:0:0。
在这里我提供三种配置方案:A.启用双显卡,集显为默认显卡(均衡)、B.启用独显,屏蔽集显(高性能)、C.启用集显,屏蔽独显(低功耗)。
以下是配置文件,需要填写到/etc/X11/xorg.conf,注意修改自己的BusID:
方案A:启用双显卡,集显为默认显卡
Section "ServerLayout"
Identifier "layout"
Screen 0 "intel"
Screen 1 "nvidia"
EndSection
Section "Device"
Identifier "intel"
Driver "intel"
BusID "0:2:0"
Option "AccelMethod" "SNA"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "1:0:0"
Option "ConstrainCursor" "off"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration" "on"
Option "IgnoreDisplayDevices" "CRT"
EndSection
方案B:启用独显,屏蔽集显
Section "Module"
Load "modesetting"
EndSection
Section "Device"
Identifier "Card0"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
方案C:启用集显,屏蔽独显
Section "Module"
Load "modesetting"
EndSection
Section "Device"
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
创建文件/etc/lightdm/display_setup.sh,写入以下内容:
#!/bin/sh
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
赋予执行权限:
$ sudo chmod +x /etc/lightdm/display_setup.sh
修改/etc/lightdm/lightdm.conf:
找到#display-setup-script=这行,修改为
display-setup-script=/etc/lightdm/display_setup.sh
重新启动后,配置生效。
发张我启用双显卡默认集显的图:

bookmarked!!, I like your website.
wow, awesome blog article.Really looking forward to read more. Want more.
Enjoyed every bit of your article post.Really thank you! Keep writing.
Thank you ever so for you blog.Thanks Again. Will read on…
Enjoyed every bit of your post. Awesome.
Great blog article.Really looking forward to read more. Keep writing.
I really liked your blog post.Really looking forward to read more. Really Great.
Wow, great article.Really thank you! Will read on…
Enjoyed every bit of your blog post.Really thank you! Cool.
Enjoyed every bit of your post. Really Cool.
Looking forward to reading more. Great post.Much thanks again. Awesome.
I used to be able to find good info from your blog articles.
Appreciate you sharing, great blog article.Really looking forward to read more. Cool.
hq pharmacy online 365: canadian mail order pharmacy – pharmacy home delivery
Very good information. Lucky me I ran across your website by accident (stumbleupon). I have book marked it for later!
Looking forward to reading more. Great article post.Really looking forward to read more.
Very neat blog post.Really thank you! Keep writing.
Appreciate you sharing, great article.Really looking forward to read more. Awesome.
A round of applause for your blog. Great.
I can’t go into details, but I have to say its a good article!
Very good article.Much thanks again. Great.
fantastic internet site, I could definitely go to your web page once more…acquired some really nice info.
Makes sense to me.
Very neat article post.Really thank you! Fantastic.
Very neat article.Much thanks again. Fantastic.
nicee content keep writing
Thank you ever so for you blog article. Awesome.
Thank you ever so for you blog.Much thanks again. Want more.