Skip to content

Instantly share code, notes, and snippets.

@baatochan
Forked from linderd/README.md
Last active July 4, 2024 13:37
Show Gist options
  • Save baatochan/439eca560e9399c6a4f3ae3d7e72292f to your computer and use it in GitHub Desktop.
Save baatochan/439eca560e9399c6a4f3ae3d7e72292f to your computer and use it in GitHub Desktop.
Linux (Manjaro [Arch]) on a Thinkpad P14s [T14] Gen2 with Intel

Linux (Manjaro [Arch]) on a Thinkpad P14s [T14] Gen2 with Intel

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with 11th gen Intel Core i7-1185G7. It should also be suitable for the Thinkpad T14 Gen2 with Intel as they are technically the same model.

Additionally you may find more AMD specific tips on the gist I've forked. I decided to keep this gist forked as I have used some of the tips they shared and because they inspired me to create my note in the first place.

Sadly there is no entry in the arch-wiki for Intel specific model, but some of the info from AMD one were useful for me. Other useful sources are mentioned in the document in their respective chapters.

Not everything in this doc may be 100% correct as I'm writing this note after having my PC set up and I might have forgotten some of the stuff. I will update it I ever decide to reinstall the OS on my PC.

Detailed specs

  • Host: ThinkPad P14s Gen 2i (20VYS2FD01)
  • Resolution: 1920x1080 (touch)
  • CPU: 11th gen Intel Core i7-1185G7
  • GPU: Intel Iris Xe Graphics G7 96EU and NVIDIA Quadro T500 Mobile
  • Memory: 16 GB (soldered + 1 empty DDR4 slot available)
  • SSD: 1 TB (Samsung)
  • Network: Intel AX201 (Wi-Fi 6)
  • Docking station: Lenovo ThinkPad Thunderbolt 4 WorkStation Dock (40B00300EU)

Linux distro

I've chosen Manjaro as my work PC distro, because I wanted to have a rolling-release distro and Manjaro looked kinda noob friendly as I'm not very into Linux. I can do some stuff but I only use it for work. It's not my first installation tho - I've used Manjaro on my old PC as well.

Installation

IIRC I have installed Manjaro with default settings everywhere beside the partitioning where I created the SDD layout manually. I needed my installation to be fully-encrypted so I sticked with the basic possible layout while keeping the WinRE_DRV partition:

  • 512 MiB fat32 partition with mounting point /boot/efi
  • all remaining space formatted with ext4 with LUKS encryption mounted as /
  • 1000 MiB default WinRE_DRV partition.

I have tried to have better layout with separate /boot partition, but I couldn't make it work without being asked for a password twice. Additionally Manjaro installer still doesn't support LUKS2. After the installation I have found this tutorial for Ubuntu which might help you with better partition management while keeping the installation fully-encrypted. If I were to reinstall the system I would certainly use the suggested layout from that tutorial.

The drawbacks to my layout:

  • Decrypting the drive happens before the kernel is loaded and because of that it takes a lot longer (about 1 min)
  • It uses LUKS1 encryption which is slower and less secure
  • Because there is no swap partition a hibernation doesn't work out-of-the-box (I prefer using the swap file anyway, but it has to be manually set up after the installation)

Problems and fixes

After the installation I was actually pleasantly surprised by the fact that almost everything worked out-of-the-box and I could have used the PC just fine. However there was some stuff that needed tweaking.

Sleep

I haven't tried using the S0ix sleep on this machine - I had gone thru the BIOS even before I installed the OS and I had changed the sleep mode to "Linux" (which is S3 type of sleep). I don't remember anything else that have to be changed in the BIOS but I might be wrong (I think I have turned off the secure boot, but I don't know if that is required).

The S3 sleep works just fine after this change and I don't see any reason to have the S0ix sleep tbh (S0ix offers worse battery efficiency and the only benefit is faster waking up time if I understand it correctly).

Firmware update

The first thing I did after the installation was going thru the firmware update with fwupd. I believe this package might require manual installation but I'm not sure. You may find the info on how to use it here.

Official Thunderbolt docking station

I believe the main reason to do the firmware update was to check if the docking station has the up-to-date firmware. After the issues I had with a dedicated docking station for HP EliteBook 840 G3 I was very skeptical about the idea of having the Thunderbolt docking station under Linux but it turns out that literally everything works perfectly with this dock. No more issues with external displays or missing USB devices, oh yeah! Update: After using it for about a year I have experience some issue with the dock, mostly when connecting/reconnecting it while device is booted up (it doesn't always recognize all the devices properly), but most of the time it just works and it's very nice.

Intel Turbo Boost

Looks like the Intel Turbo is working OK on Manjaro. To check if it is enabled use:

cat /sys/devices/system/cpu/intel_pstate/no_turbo

Value 0 means it's enabled, to disable set it as 1.

Battery conservation mode

As my device is almost exclusively used connected to the docking station (and AC) it is a good idea to limit battery charging to 80%. I was able to achieve that with the tlp. The tutorial for installation is here, but it's in German.

To install tlp use the command (for recent ThinkPads you will also need acpi_call):

sudo pacman -S tlp tlp-rdw acpi_call

To turn on the tlp you need to start the tlp service.

sudo systemctl enable tlp.service && systemctl start tlp.service

After the installation reboot might be required, but I don't remember.

The configuration for tlp is set using the file /etc/tlp.conf. For battery conservation mode you need to set up the params (explained here):

START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80

With this config the battery will always be between 75 and 80%. If you have two batteries you may also set the same values for BAT1.

After setting up tlp battery charging threshold might be reconfigured via KDE system settings under "Advanced power settings" tab.

Audio

I think the audio works out-of-the-box but I installed the sof-firmware package as suggested on arch-wiki.

Hibernation

A decent tutorial about setting up the swap file is available on arch-wiki so I'm not gonna put the instruction here.

During this set up there is a step to add mkinitcpio HOOKS so I went thru the hooks I had on my old Manjaro installation and my current list looks like that:

HOOKS="base udev autodetect modconf block keyboard keymap consolefont encrypt filesystems fsck resume"

It's also a good moment to go thru the GRUB settings and eg. hide it when Linux is the only OS the machine.

Touch screen

This is a first hardware think that I found that doesn't work out-of-the-box. Looks like the solution is to append blacklist raydium_i2c_ts to /etc/modprobe.d/unneeded-modules.conf. It may be done using

echo "blacklist raydium_i2c_ts" | sudo tee /etc/modprobe.d/unneeded-modules.conf

I found the solution here while it's also mentioned on arch-wiki for AMD model.

Fan control/noise

I don't like the cooling system in this laptop at all. The intakes are all from the bottom of the device which may result in overheating when the device is placed incorrectly. Additionally the default fan curves are made in a way that the device has fans turned off for a long time and turns them on on 100% when some temperature is hit. It's kinda annoying because you get a sudden change in the fan noise and this fan is really loud when running on 100%.

It turns out that it might be fixed (to some degree) using the thinkfan. The installation process is described here.

However the thinkfan requires you to create your own config file where you specify the sensors that should be taken into the account and create a fan curve. I found this nice tutorial for my Thinkpad with already prepared config file.

The fan curve from that tutorial looks OK-ish, but I decided to change it based on the one suggested here. It keeps the device hotter but I don't mind it as I'm using it mostly docked. In the end I changed the first threshold to 30 to keep the fan on the first level always on because turning on this fan is always very lound.

I'm attaching the config file I'm using to this gist as a separate file.

DisplayLink docking station

While the official Thunderbolt dock works almost perfectly fine, getting the DisplayLink one (HP USB-C/A Universal Dock Gen 2) to work was a terrible experience. Long story short the DisplayLink doesn't work with Linux because the Linux driver is shit (some say it works OKish with Ubuntu tho). So as we all know the main tutorial for this is the Arch Wiki article about DisplayLink.

The arch wiki only states that to install DisplayLink driver you need to install evdi-git and displaylink. However I have encountered a lot of issues during the installation of both packages. As it was some time ago I don't know what exactly was going on, but I remember it took me few hours to get it working (somehow, more on that later).

You may want to start with installing evdi-git from AUR, which depends on kernel headers and dkms, but if I remember correctly I had to reinstall dkms first.

sudo pacman -Syu dkms base-devel --needed
pamac build evdi-git
pamac build displaylink

After that I had to restart the OS, start the displaylink service (don't do it with the dock connected as it will most likely freeze your GUI) and load the udl kernel module

systemctl start displaylink
modprobe udl

I tried some of the workarounds from Arch Wiki but it looks like I kept only 3.7 - blacklisting nouveau. To do it create a new file /etc/modprobe.d/nouveau.conf with the following content:

blacklist nouveau
options nouveau modeset=0

How does it work?? - Shitty tbh

Well, with everything done above you can use the DisplayLink dock, but it doesn't offer a great experience. Connecting a dock while the device is running will most likely result in the displays being not detected or with GUI frozen (to fix that you have to open tty2 (Ctrl + Alt + F2) and reboot PC). (Re)starting the displaylink service will result in the GUI frozen. The only way to connect the DisplayLink dock properly is to do it when PC is turned off and then boot it up. After that disconnecting the dock and reconnecting should work as long as the connected displays will not change (if you booted the PC with 1, you can't connect a 2nd) and you use the same USB port in laptop. USB, Eth and charging should work OK. You may be able to unfreeze the GUI by restarting the KDE but it is not recommended. In the end - if you can get another dock then just do it. DisplayLink is not worth it.

Thunderbolt dock prevents suspending the OS

It may happen that the OS will wake up just after the suspend when being connected to the Thunderbolt dock with eth cable on. I could mitigate it with disabling the Wake on LAN but it turns out it can be set in many places in Linux. The first thing to do was to use ethtool.

sudo ethtool -s eth0 wol d

After that I set tlp to disallow Wake on LAN by adding WOL_DISABLE=Y into /etc/tlp.conf.

The last step was to reconfigure Network Manager.

nmcli c modify "Wired connection 2" 802-3-ethernet.wake-on-lan disable

With all that set the inability to suspend happens very rarely and if happens it is enough to just wait few minutes and suspend it again.

Updating the kernel to 5.18+

IIRC the LTS kernel when I installed Manjaro was 5.15. After some time I decided to update to 6.1 and encountered an issue which prevented me from booting up. It turns out that all kernel 5.18 and never require you to set a kernel param ibt=off if you have Nvidia drivers installed. Remember to do it before updating because otherwise you would need to use the chroot.

Adding a kernel param requires you to edit the /etc/default/grub file and run update-grub command.

Bluetooth/headset settings

There might be some additional setup required to get the best possible from my BT headphones, but I will be configuring it later. When I have some more tips I will share it here.

Fingerprint

I will check later if the fingerprint scanner works and how to setup it.

Conclusion

This notebook is a really nice device. Works fine on Linux. I hope that working on it will be a lot nicer experience than my old HP. I will do the battery test later but now it seems that 6h of battery life when using only chrome and vscode might be possible.

sensors:
# GPU
- tpacpi: /proc/acpi/ibm/thermal
indices: [1]
# CPU
- hwmon: /sys/class/hwmon
name: coretemp
indices: [2, 3, 4, 5]
# Chassis
- hwmon: /sys/class/hwmon
name: thinkpad
indices: [3, 5, 6, 7]
# SSD
- hwmon: /sys/class/hwmon
name: nvme
indices: [1, 2, 3]
correction: [-5, 0, 0]
# MB
- hwmon: /sys/class/hwmon
name: acpitz
indices: [1]
fans:
- tpacpi: /proc/acpi/ibm/fan
levels:
# LAP FRIENDLY SETUP (kinda loud) #
# - [0, 0, 37]
# - [1, 35, 42]
# - [2, 40, 45]
# - [3, 43, 47]
# - [4, 45, 52]
# - [5, 50, 57]
# - [6, 55, 72]
# - [7, 70, 82]
# - ["level full-speed", 77, 32767]
# SILENT SETUP #
- [0, 0, 32]
- [1, 30, 57]
- [2, 55, 62]
- [3, 60, 67]
- [4, 65, 72]
- [5, 70, 77]
- [6, 75, 82]
- [7, 80, 87]
- ["level full-speed", 85, 32767]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment