本来以为很简单的,没想到踩了这么多坑。花了好几天时间才装好。
如果有外置显示器的需求的话,建议不要碰 gnome3 和 wayland
因为这台笔记本的 hdmi 口和 mini dp 口直连独显,如果需要双显卡工作的话必须使用 intel-virtual-output , intel-virtual-output 这个东西貌似不支持 wayland, 总是检测不到 virtual display (wayland 从只差一步到放弃 = =)。
基于 Xorg 的 gnome3 对 intel-virtual-output 支持完好, 不过不知道什么原因, 在连接外置显示器的情况下, 合上盖子或者是只用外置显示器会导致蜜汁卡吨,花大量时间搜寻后无解(起初以为是acpi的问题,不过内核加参数 acpi=off 会导致笔记本开不了机)。经测试,Xfce4 正常, 所以之后选择了 Xfce4。
为了避免以后踩坑,下面记录下步骤。
1 制作 Arch 启动u盘
2 在BIOS下把显卡模式切换为 DISCRETE
(BIOS 对于显卡有两个模式,分别是MSHYBRID 和 DISCRETE, MSHYBRID是双显卡切换, DISCRETE是只用独显,MSHYBRID模式不能够启动 Arch U盘 )
3 启动 Arch 安装盘
4 fdisk 分区
5 挂载
1 2 3 4 5 6 7
| # /dev/sdb2 是 / , /dev/sdb1 是boot, /dev/sdb3 是 /home # 具体按照自己的分区来 mount /dev/sdb2 /mnt mkdir /mnt/boot mkdir /mnt/home mount /dev/sdb1 /mnt/boot mount /dev/sdb3 /mnt/home
|
6 更新mirrors
1 2 3 4 5
| cd /etc/pacman.d sed -i "s/^\b/#/g" mirrorlist nano mirrorlist #将mirrors.ustc.edu.cn和mirrors6.ustc.edu.cn前面的#去掉 pacman -Syy
|
7 安装base系统
1 2
| pacstrap /mnt base base-devel #如果你想使用ifconfig之类的工具,请在上面加上net-tools
|
8 生成fstab
1
| genfstab -U -p /mnt >>/mnt/etc/fstab
|
9 chroot
1
| arch-chroot /mnt /bin/bash
|
10 配置locale
1 2 3 4 5
| cd /etc nano locale.gen #将en_US.UTF-8,zh_CN.GBK,zh_CN.GB2312,zh_CN.GB18030,zh_CN.UTF-8前的#去掉 locale-gen echo LANG=zh_CN.UTF-8 >> locale.conf
|
11 设置时区
1
| ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
12 设置主机名
1
| echo 主机名 >> /etc/hostname
|
13 用户配置
1 2 3 4
| passwd #修改root密码 useradd -m -g users -G wheel -s /bin/bash 用户名 passwd 用户名
|
14 安装GRUB
1 2 3
| # 具体硬盘要根据自己的来 pacman -S grub-bios grub-install /dev/sdb
|
开机需要内核开启一些参数(如果不加这些参数之后的bbswitch工作会不正常, 见这里)
1 2 3 4 5 6 7 8 9
| vim /etc/default/grub # 配置 GRUB_CMDLINE_LINUX_DEFAULT GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi=! acpi_osi=\"Windows 2009\"" # 之后生成grub.cfg grub-mkconfig -o /boot/grub/grub.cfg # 开启dhcpcd systemctl enable dhcpcd.service
|
15 退出chroot, 重启
16 安装synaptics驱动
1
| pacman -S xf86-input-synaptics
|
17 安装 xorg
1
| pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils
|
18 安装xfce4
1 2 3 4
| pacman -S xfce4 xfce4-goodies # 如果需要从命令行启动xfce的话只需要进行如下步骤 cp /etc/X11/xinit/xinitrc ~/.xinitrc # 在.xinitrc后加上 exec startxfce4 即可
|
19 配置双显卡
1 2 3 4 5 6
| pacman -S bumblebee pacman -S mesa pacman -S xf86-video-intel pacman -S nvidia gpasswd -a 用户名 bumblebee systemctl enable bumblebeed.service
|
在 /etc/X11/xorg.conf.d下创建一个文件 20-intel.conf
, 内容如下
1 2 3 4 5
| Section "Device" Identifier "Intel Graphics" Driver "intel" BusID "PCI:00:02:0" # <<<< replace with correct address EndSection
|
配置 /etc/bumblebee/xorg.conf.nvidia
内容如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Section "ServerLayout" Identifier "Layout0" Option "AutoAddDevices" "true" Option "AutoAddGPU" "false" EndSection Section "Device" Identifier "DiscreteNvidia" Driver "nvidia" VendorName "NVIDIA Corporation" # If the X server does not automatically detect your VGA device, # you can manually set it here. # To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data # as you see in the commented example. # This Setting may be needed in some platforms with more than one # nvidia card, which may confuse the proprietary driver (e.g., # trying to take ownership of the wrong device). Also needed on Ubuntu 13.04. BusID "PCI:01:00:0" # Setting ProbeAllGpus to false prevents the new proprietary driver # instance spawned to try to control the integrated graphics card, # which is already being managed outside bumblebee. # This option doesn't hurt and it is required on platforms running # more than one nvidia graphics card with the proprietary driver. # (E.g. Macbook Pro pre-2010 with nVidia 9400M + 9600M GT). # If this option is not set, the new Xorg may blacken the screen and # render it unusable (unless you have some way to run killall Xorg). Option "ProbeAllGpus" "false" Option "AllowEmptyInitialConfiguration" Option "NoLogo" "true" Option "UseEDID" "true" # Option "UseDisplayDevice" "none" EndSection
|
具体有哪些地方要改呢?
对于一般用户,去掉BusID的注释即可。
如果有外界屏幕需求的话, 需要把 UseEDID
和 AutoAddDevices
设置为 true
, 然后加上 Option "AllowEmptyInitialConfiguration"
(这三个操作必不可少,缺了AllowEmptyInitialConfiguration会导致 独显初始化失败)
更改之后不能进入X环境(因为系统会使用I卡,但是目前只用独显状态I卡识别不了,导致no screen found)
20 安装 lightdm(如果命令行启动可以不做)
1 2 3
| pacman -S lightdm pacman -S lightdm-gtk-greeter systemctl enable lightdm.service
|
21 重启,在BIOS中把显卡选项切换为 MSHYBRID
(不切换进不了系统)
22 输入帐号密码之后可以登录
23 安装 libxss(intel-virtual-output 依赖这个)
24 激活外接屏幕
1 2 3 4
| # 先激活下 独显, 如果没有此操作,外屏不能被激活 = = ,如果失败的话可能因为显卡未初始化完全,等几秒再尝试下 optirun glxspheres64 # 显示成功之后执行下面的命令,外接屏被正确识别 intel-virtual-output
|
25 安装常用软件(从AUI里面拷贝出来了一些常用的软件,具体根据自己需要装)
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| pacman -S bc rsync mlocate bash-completion pkgstats arch-wiki-lite pacman -S zip unzip unrar p7zip lzop cpio pacman -S avahi nss-mdns pacman -S alsa-utils alsa-plugins pacman -S pulseaudio pulseaudio-alsa pacman -S ntfs-3g dosfstools exfat-utils f2fs-tools fuse fuse-exfat autofs mtpfs pacman -S --asdeps --needed cairo fontconfig freetype2 pacman -S networkmanager dnsmasq network-manager-applet nm-connection-editor pacman -S networkmanager-openconnect networkmanager-openvpn networkmanager-pptp networkmanager-vpnc system_ctl enable NetworkManager.service # 时间校准 pacman -S ntpd systemctl enable ntpd
|
其它输入法之类的就不说了。
最好加一下archlinuxcn的源,里面可以直接安装sublime, vscode, wps之类的软件,非常方便。
参考:
https://my.oschina.net/codeaxe/blog/127533
https://bbs.archlinux.org/viewtopic.php?id=169742
https://github.com/Bumblebee-Project/Bumblebee/issues/764#issuecomment-234494238
https://wiki.archlinux.org/index.php/Clevo_P650RS
https://wiki.archlinux.org/index.php/Kernel_parameters
https://wiki.archlinux.org/index.php/Bumblebee