Skip to content

Instantly share code, notes, and snippets.

@katherlee
Last active September 3, 2019 19:46
Show Gist options
  • Save katherlee/8024e62082e68238183044aee257c361 to your computer and use it in GitHub Desktop.
Save katherlee/8024e62082e68238183044aee257c361 to your computer and use it in GitHub Desktop.
Installing Arch Linux on ThinkPad P1 Gen 2

Installing Arch Linux on ThinkPad P1 Gen 2

I recently got my hands on a ThinkPad P1 Gen 2 with an Intel i7 9850H, an NVIDIA Quadro T2000, 16 GB RAM, 500 GB SSD, and a 500 nits FHD display (which is AWESOME!) Since there's an empty RAM slot and an empty SSD slot I upgraded it with another 16 GB of RAM and 1 TB of SSD. I plan to keep the OEM Windows 10 intact on the 500 GB drive (for making slides and playing games) and install Arch on the 1 TB one.

I mostly followed the great an-idiots-guide-to-installing-arch-on-a-lenovo-carbon-x1-gen-6 when installing arch, and I note the differences in this document.

Dual booting with Windows

The Windows installation comes with a EFI partition itself, so we don't have to create a new EFI partition for /boot. Simply create the partitions for the root directory and (optionally) the home directory and mount the EFI partition on the Windows drive as /boot. Here's my lsblk output:

NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
nvme1n1               259:0    0   477G  0 disk  
├─nvme1n1p1           259:1    0   260M  0 part  /boot
├─nvme1n1p2           259:2    0    16M  0 part  
├─nvme1n1p3           259:3    0 475.7G  0 part  
└─nvme1n1p4           259:4    0  1000M  0 part  
nvme0n1               259:5    0 931.5G  0 disk  
├─nvme0n1p1           259:6    0   512M  0 part  
└─nvme0n1p2           259:7    0   931G  0 part  
  └─cryptlvm          254:0    0   931G  0 crypt 
    ├─main_group-swap 254:1    0    32G  0 lvm   [SWAP]
    ├─main_group-root 254:2    0   256G  0 lvm   /
    └─main_group-home 254:3    0   643G  0 lvm   /home

You could probably guess that nvme1n1 is the Windows drive, and nvme0n1 is the linux one. nvme0n1p1 is the EFI partition I created following the guide, and is not necessary. nvme1n1p1 is the EFI partition on the Windows drive. If you use systemd-boot as your bootloader, then it will automatically detect the Windows Boot Manager and make an entry for it.

NVIDIA

Bumblebee

I followed the wiki and installed the following

sudo pacman -S nvidia xf86-video-intel mesa bumblebee lib32-virtualgl lib32-nvidia-utils

and added my username to the bumblebee group. Everything works out of the box. You can test it using

optirun nvidia-smi

It should tell you you have a Quadro T2000.

External display

Somehow Lenovo likes to wire the HDMI output to the iGPU. To connect to a external monitor, you'll have to configure Bumblebee and the X server following this. Everytime you connect the HDMI cable, run optirun intel-virtual-output. If it doesn't complain, you'll able to access your external display.

optimus-manager

TODO

Undervolting

You may or may not want to undervolt your CPU. I did, and it helped a little with the thermals. Simply install the intel-undervolt AUR package, and modify /etc/intel-undervolt.conf for your taste. Enabling the systemd service intel-undervolt.service activates it. I used -135 mV undervolt for CPU and cache, but it really depends on your preference.

Fan control

I used thinkfan to deal with the fan speed. It feels much smoother than the Windows fan control (which is shitty). I installed the following packages

pacman -S thinkfan tpapi-bat lm-sensors

Reboot, and make a copy of the sample config

sudo cp /usr/share/doc/thinkfan/examples/thinkfan.conf.simple /etc/thinkfan.conf

Uncomment the following line from the sample config

tp_fan /proc/acpi/ibm/fan

and enable thinkfan.service. The fan is now under control!

Chinese input method

I need to type Chinese from time to time so I need a input method. My favorite is RIME. I use KDE, so I installed the following packages for fcitx:

pacman -S fcitx-im fcitx-rime kcm-fcitx

After a relogin fcitx will start automatically. The following lines needs to be added to ~/.pam_environment to have fcitx work properly in some applications.

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

YubiKey

I needed YubiKey for some of my accounts. For Firefox simply install libu2f-host and it will work fine in most cases.

Display scaling

Display scaling is done mostly following the wiki. I use KDE, so I simply forced a font scaling factor of 1.25 (dpi=120). Most KDE and Qt apps can be scaled in the KDE system settings, under "Appearance -> Fonts -> Force font DPI".

Firefox is a GTK app and GTK only allows integer scaling. One way to get around this is to go to about:config and change the value of layout.css.devPixelsPerPx to 1.25.

Most Chromium- or Electron- based apps accepts a command line parameter --force-device-scale-factor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment