1
0
Fork 0
knowledge-base/KB/Linux/Desktop/Surface.md

172 lines
5.9 KiB
Markdown
Raw Normal View History

2022-09-04 12:54:22 +00:00
---
creation date: 2022-09-02
tags: [surface,linux,sp8,microsoft]
---
A guide for the [Surface Pro 8](https://github.com/linux-surface/linux-surface/wiki/Surface-Pro-8). Based on https://github.com/linux-surface/linux-surface/wiki.
This guide is for [ArchLinux](https://archlinux.org/) and improves the instructions to be more structured and suited for the SP8.
## Prerequisites
* USB adapter cable for USB A to USB C
* USB Drive, see [[KB/Linux/Desktop/Archinstall]] for getting an ISO onto USB
* External keyboard, because Type Cover will not work without custom kernel
## Prepare
* If Windows is still on disk, boot into it and update everything, so Surface firmware gets updated
* Head into BIOS to _change boot order_ and disable _Secure Boot_
* Shut down device
* Press and hold _Volume up_ and in parallel hit power button once until boot logo appears
* Keep _Volume up_ pressed
* Disable Secure Boot entirely
* Change boot order by drag'n'drop USB Drive to first position, maybe uncheck all other options
## Install
Boot from USB drive and edit ISO live boot options to copy USB drive contents to RAM, because you need to plug in an external keyboard for installation
* Press _e_ during selection of Arch ISO
* Add `copytoram=y` as option
* Exit with CTRL+x
Proceed with install like you would usually do. [[KB/Linux/Desktop/Archinstall]] is an easy way with little configuration to get an install up and running.
This installation uses `systemd-boot` as bootloader. Your experience of the tutorial may vary if you pick another one.
In generel, you should pick wayland. It has much better touch, gesture and pen support.
## Post install
After you've successfully booted into your installation, some additional steps need to be performed to get your Type Cover and touchpad etc. working.
Disclaimer: Don't mix the `iptsd` of the official repository with the `iptsd` mentioned here, they're different and may soon get merged.
### pacman repository
Let's add the the official _pacman_ repository of _linux-surface_
```shell
curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc sudo pacman-key --add -
sudo pacman-key --finger 56C464BAAC421453
sudo pacman-key --lsign-key 56C464BAAC421453
```
Edit `/etc/pacman.conf`:
```shell
[linux-surface]
Server = https://pkg.surfacelinux.com/arch/
```
Refresh by invoking `sudo pacman -Syu`
### Install required packages
Install the following packages, some of them are also in the [AUR](https://aur.archlinux.org/).
```shell
# the actual kernel and their headers
linux-surface
linux-surface-headers
# SP 8 is an Intel device
intel-ucode
# needed for later compiling modules
dkms
meson
```
### Make touchpad work and allow Type Cover during early boot (luks)
Touchpad will _not_ work out of the box. The SP8 needs a different touchpad module and the _proper_ `iptsd`, not the one from the official linux-surface repository.
Ensure that `dkms` and `meson` are installed.
1. Clone `git clone https://github.com/quo/ithc-linux`
1. `cd ithc-linux`
2. Execute `sudo make dkms-install`
2. Clone `git clone https://github.com/quo/iptsd`
1. `cd iptsd`
2. Execute the following commands in order
```shell
meson build --wrap-mode=forcefallback --buildtype=debugoptimized -Dmarch=native
ninja -C build
sudo build/src/daemon/iptsd
sudo ninja -C build install
sudo systemctl daemon-reload
sudo systemctl enable iptsd.service
```
* For _ ithc_ to load properly, you need to edit kernel parameters in your `entries/....conf` file and add `intremap=nosid`. Add a `.conf` for the SP8 if not already present.
* You also need to edit the `MODULES` in your `/etc/mkinitcpio.conf` so that type cover will also work during early [encryption](https://github.com/linux-surface/linux-surface/wiki/Disk-Encryption) dialog
```shell
MODULES=(btrfs i915 surface_aggregator surface_aggregator_registry surface_aggregator_hub surface_hid_core 8250_dw surface_hid surface_kbd intel_lpss intel_lpss_pci pinctrl_tigerlake)
```
* Regenerate initramfs with `mkinitcpio -P`
* Reboot, you should no longer need your external keyboard
### pen
Install `libwacom-surface` from the [AUR](https://aur.archlinux.org/).
### screen rotation
Install `iio-sensor-proxy`.
### 120hz display
Follow instructions [here](https://github.com/linux-surface/linux-surface/wiki/Surface-Pro-8#enable-120hz-and-solve-screen-flickering) to extract the EDID. Ensure you're in X.org.
Afterwards, your `entries/....conf` systemd-boot entry could look like
```shell
title Arch Linux (linux-surface)
linux /vmlinuz-linux-surface
initrd /intel-ucode.img
initrd /initramfs-linux-surface.img
options ... intremap=nosid drm_kms_helper.edid_firmware=eDP-1:edid/edid.bin
```
In addition, your `/etc/mkinitcpio.conf` needs `FILES=(/usr/lib/firmware/edid/edid.bin)` and ensure you re-generate initramfs with `mkinitcpio -P`.
### Fix Type Cover suspend
If suspended via Type Cover, Touch might not work. Prevent this by editing `/etc/libinput/local-overrides.quirks` and add the following contents
```shell
[Microsoft Surface Cover]
MatchName=*Microsoft Surface *Cover*
MatchDMIModalias=dmi:*svnMicrosoftCorporation:*
AttrKeyboardIntegration=internal
ModelTabletModeNoSuspend=1
```
Reboot.
## Recommended software
[[KB/Linux/GNOME]] has wonderful support for touch devices. You should probably use it.
Useful GNOME extensions
* improved gestures `gestureImprovements@gestures` (https://extensions.gnome.org/extension/4245/gesture-improvements/)
* improved on screen keyboard `improved-osk` (https://extensions.gnome.org/extension/4413/improved-osk/)
List of extensions personally used:
```json
[
"appindicatorsupport@rgcjonas.gmail.com",
"dash-to-dock@micxgx.gmail.com",
"gestureImprovements@gestures",
"improvedosk@nick-shmyrev.dev",
"launch-new-instance@gnome-shell-extensions.gcampax.github.com",
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]
```
`xournal` is a wonderful program for you pen.