Skip to content

Instantly share code, notes, and snippets.

@linderd
Forked from timlinux/README.md
Last active March 13, 2024 19:06
Show Gist options
  • Star 80 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save linderd/71ec30048e78813115ba3f634e1b0817 to your computer and use it in GitHub Desktop.
Save linderd/71ec30048e78813115ba3f634e1b0817 to your computer and use it in GitHub Desktop.
Linux on Thinkpad P14s Gen2 AMD / T14 Gen2 AMD

Linux (Fedora 35) on a Thinkpad P14s [T14] Gen2 AMD

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with AMD Ryzen 7 5850U. It should also be suitable for the Thinkpad T14 Gen2 AMD as they are technically the same modell.
Meanwhile there is also a good test on youtube and an entry in the arch-wiki, which also comments some points mentioned here.

Detailed specs

Shipped:

  • Host: 21A1S00D.00 ThinkPad P14s Gen 2a
  • Resolution: 1920x1080
  • CPU: AMD Ryzen 7 PRO 5850U
  • GPU: integrated Vega 8
  • Memory: 16 GB
  • SSD: 1 TB (Samsung)

Custom:

  • additional 16 GB RAM (Crucial 3200 MHz SO-DIMM)
  • Intel AX210 WiFi 6E

Distribution

At first I used Fedora 34, which worked good. But with the upgrade to kernel 5.14 the ethernet interface stopped working, which drove me mad. So I decided to checkout the fresh Ubuntu 21.10 on kernel 5.13. After release of Fedora 35 (with which the ethernet interface works again) I switched back to Fedora again, because of personal preferences. Meanwhile there is Kernel 5.16 in Fedora 35 which added a lot of improvements.
I strongly recommend to use a Distribution with a recent kernel instead of a LTS-version as they will support this laptop better with every release.

Installation

I used the automatic partitioning of the GUI-fedora-Installer with Btrfs. Everything else was also set to default.

Problems and Fixes

There were some really annoying problems with this laptop on kernels <5.16, which are now almost gone:

WLAN/WiFi

The most obvious problem after installation is the non-existence of the Wifi-interface, so I had to use a LAN-cable first. The problem is the Realtek chip 8852AE, which is built in the AMD-version of this laptop. The drivers for this card are not in the linux-kernel yet (kernel 5.13 and 5.14). The best way out in my opinion is to change the card to a well supported Intel one. Since Kernel 5.16 the realtek-card is officially supported, so the following steps are obsolete.

Intel AX210

Because I got nerved by the fact that I had to install the kernel module for the Realtek card with every (little) kernel-update, I bought the Intel AX210 M.2-Module for 13€ and placed it in the slot of the Realtek module. Works out of the box, is fast and supports Wifi6E (only tested Wifi6). This should also work with the Intel AX200, as some guy on reddit said.
AX201 and AX211 should not work because of the wrong card format. Congratulations to Intel for the great driver support. With the AX210 I get theoretical Wifi speed of 1400 MBit/s with my Wifi6 Access Point (Unifi 6 LR).

Realtek 8852AE

There is a github-repo (https://github.com/lwfinger/rtw89), where you can find the suitable driver, with these commands:

sudo dnf install make automake gcc git gcc-c++ kernel-devel
git clone https://github.com/lwfinger/rtw89.git -b v5
cd rtw89
make
sudo make install
sudo modprobe rtw89pci

If you get an error on make you may have to restart the machine and try it again. After finishing you should be able to use Wifi as desired.

When you update to a newer kernel (and reboot), you have to activate this modul again with the following steps:

cd rtw89
make clean
make
sudo make install
sudo modprobe rtw89pci

It sounds like this driver is on a good way to get into the kernel. (But I could not wait longer when I heard that you can easily change the card). According to the arch-wiki the driver for the realtek-card will be added in kernel 5.16.

Standby (Sleep/Hibernate)

Kernels <5.16 did not support S0ix-sleep with the AMD CPU, but the fix is easy: Go to BIOS-Settings - Config - Energy-Optimization - select Linux instead of Windows 10. This will use S3-sleep instead of S0ix.
Since 5.16 you can use also S0ix (Windows-setting in BIOS), which also consumes less energy than S3 as @evanslify mentioned in the comments below. With S0ix the Laptop will take about ten seconds to startup after sleep, you can resolve this by adding iommu=pt to your kernel parameters (e.g. with grubby):

sudo grubby --args="iommu=pt" --update-kernel=ALL

This will make waking up as fast as with S3.
Thanks to evanslify@

Fan noise on video streaming

The following is broken on Firefox 98, so I use chromium at the moment...
The fan tends to get loud when you stream videos in firefox, especially in higher resolutions. FullHD videos even started stuttering. At first I installed optional video codecs for Fedora:

[activate RPMfusion free and nonfree]

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

[enable codecs]

sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin

sudo dnf groupupdate sound-and-video

I also had to manually activate the cisco H.264-plugin in firefox. Open about:addons and activate the OpenH264-Plugin. This made the noise and the stuttering better but it did not go away.

The trick did hardware-acceleration in Firefox:

[RPMfusion needed]

sudo dnf install ffmpeg libva libva-utils

In about:config you have to set two parameters to true and restart firefox:

gfx.webrender.enabled = True
media.ffmpeg.vaapi.enabled = True

This did the trick, videos are played smooth up to 4K and the fan stays quiet.

Optimizations

Energy Saving

Integrated in Gnome

With Gnome 40/41 energy-saving-functions are integrated which are not compatible with tlp. So you can either use tlp or the new feature of gnome 41. I checked both and it feels like the battery lasts longer on the standard-gnome-feature and not tlp. I did not really test it, it's only my personal feeling.

TLP

To install TLP for battery tuning:

dnf install tlp tlp-rdw

After that you can start tlp with sudo tlp start, it recommended me to install two other tools for more optimizations:

[RPMfusion needed]

sudo dnf install http://repo.linrunner.de/fedora/tlp/repos/releases/tlp-release.fc$(rpm -E %fedora).noarch.rpm 
sudo dnf install akmod-acpi_call smartmontools

With this tool you can set loading treshholds, recalibrate the battery and much more...

P-state for the Ryzen CPU

Since kernel 5.17 you can manually activate the p-state support for the Ryzen CPU. This will allow your CPU to lower the clock down to 400 MHz instead of 2.2 GHz. The activation can easily be done by activating the p-state kernel module and deactivating the legacy module. It is described here. The effect is not that ground-breaking as I hoped.

Thinkfan

I did not get to work thinkfan, but the fan is really quiet after hw-acceleration in firefox is activated.

BT-Codecs/Pipewire

I am still fighting to get my bluetooth-headphones to work correctly. For Ubuntu I installed pipewire instead of pulseaudio, which is already standard in Fedora. In Fedora you also need a special package for aptX-support:

[RPMfusion free needed]

sudo dnf install pipewire-codec-aptx

But it still does not work perfectly, I will add new tricks, if I find something. After a few weeks I think the problem is multidevice-bluetooth and Linux. With Apple- and Windwos-Devices this works better, with Linux I often need to disconnect all other devices.

Conclusion

Works well on Linux, I'm excited to newer kernels for even better support. Battery life could really be better. I hope it will get better with better kernel support of the AMD 5000 APUs.

Comment useful tricks and thanks for all those hacks :)

Update-history (incomplete)

  • 02.04.2022: update to kernel 5.16-improvements and add battery-measurements of @evanslify
  • 17.06.2022: integrate 5.17 p-state improvements

PS:

I sold my Thinkpad, because I was really annoyed of the battery-life and other problems popping in. In favor I now bought a ARM-based machine with another UNIX based system. Thanks to everyone for help and tips. I will let this piece online for further help ;)

@itsmeRoland
Copy link

itsmeRoland commented Mar 29, 2022

don´t forget: this ist the BIOS update for the Intel T14/P14s

@tdimitrov
Copy link

don´t forget: this ist the BIOS update for the Intel T14/P14s

I don't know why they are referring to the Intel WIFI, but it's for the AMD version. The README says:

Support models     ThinkPad T14 Gen 2 (Machine Types:20XK,20XL)
                   ThinkPad P14s Gen 2 (Machine Types:21A0,21A1)

Mine is 21A0. I've installed the BIOS but I see no improvement. I forgot to 'load defaults' so I'll give it another shot tonight, but I don't believe it will change anything.

@itsmeRoland
Copy link

itsmeRoland commented Mar 29, 2022

Hmmmm ? Is it possible that I was on the false/wrong path:
Support models: ThinkPad P14s Gen 2 (Machine Types:21VX,21VY)

@tdimitrov
Copy link

Definitely something looks off. I suggest to find your machine by serial number on lenovo website and bookmark the page. You'll have easy access to BIOS downloads, warranty info and so on.
And on top of it - less likely to try to install the wrong BIOS.

Maybe it's worth sharing one more thing. The update with fwupdmgr failed, so I burned the iso to a usb stick and booted from it. There were at least two moments where the laptop seemed hanging on a black screen, then restarted, showed a screen saying something like "Performing recovery from UEFI BIOS" and then it booted properly. If you decide to go this way - leave it for 15mins to do its thing :)

@itsmeRoland
Copy link

itsmeRoland commented Mar 29, 2022

Thanks ! I have found now the correct/matching BIOS. I also didn't use fwupdmgr and an external DVD burner helped. After 10 minutes the cake was eaten and the new BIOS installed (;-) It works.

@tdimitrov
Copy link

You're welcome :)

@evanslify
Copy link

I can confirm S0ix is working on this machine. Power consumption is greatly improved: ~520 mW/h (-0.9%) in S3; ~251 mW/h (-0.44%) in S0ix.
However, it will introduce a greater delay while waking up. Add iommu=pt to cmdline solves this.

Also, microphone mute LED is not working properly by default. Refer to this gist for a workaronud.

@itsmeRoland
Copy link

I didn't even notice that with the Micro LED. I actually never use the micro on my Linux computer and the camera shutter shows it with the hardware red dot. I hope no one has heard me swear yet. Thanks for the hint.

@sebastian-wien
Copy link

although i am running ubuntu 21.10 and not fedora i stick to this "thread" - battery life IS very poor. draining like 30% over night and now within 30 mins of light browsing it lost 7%.

is this the same at your side?? maybe i am spoiled by macs, but this can't be normal :(

@itsmeRoland
Copy link

what do you do with your computer if it eats 30% of the battery capacity in one night? When I turn off my computer in the evening, it still has 100% after 16 hours in the morning. Does your poor laptop have to keep working when everyone is asleep or did you set "USB always on" in the BIOS? And 7% for 30 minutes with active/working internet browser is not such a bad number. Certain processes are still running in the background. After all, that would be more than seven hours of running time for the battery and therefore for the computer.

@sebastian-wien
Copy link

@itsmeRoland very good point, i did not calculated that. my bad.

@TriplEight
Copy link

@tdimitrov

I don't know why they are referring to the Intel WIFI, but it's for the AMD version. The README says

Could you please share the link you're getting for your 21A0? For mine, I have only this and there I can find only BIOS v 1.13.

@tdimitrov
Copy link

@tdimitrov

I don't know why they are referring to the Intel WIFI, but it's for the AMD version. The README says

Could you please share the link you're getting for your 21A0? For mine, I have only this and there I can find only BIOS v 1.13.

Very strange. I can't see 1.15 BIOS for my machine anymore too. But the link to the README for 1.15 is still alive, which is even more strange.

@bradleysmith
Copy link

bradleysmith commented Apr 29, 2022

@tdimitrov @TriplEight @sebastian-wien bios 1.17 is out.

The Linux instructions did not work, it complains about an invalid or missing signature.
Using the USB stick (ISO image) did work. It takes a good 5-10 minutes and there's a lot of black screen time with the fans on maximum. No testing done yet but no obvious issues either.

@itsmeRoland
Copy link

I have now installed the BIOS version 1.17 for my P14s Gen.2 AMD.. Via a boot CD. Worked very well (in my case on my machine). However, the LED for the Micro is still on; whether the mic is on or not. Strange and irritating.

@tdimitrov
Copy link

tdimitrov commented May 4, 2022

bios 1.17 is out.

Thanks! I've installed it - still no improvement for the power consumption during S3 sleep. I'm getting used to it however :)

@evanslify
Copy link

evanslify commented May 4, 2022 via email

@LukasPietzschmann
Copy link

Hi there, I read that people here had problems updating the BIOS using fwupd. I also had problems doing that (BIOS 1.14 to 1.17). But I found out that disabling secure boot, then updating with fwupd, then reenabling secure boot makes the update work just fine.
Maybe this is helpful for others, too.

@TriplEight
Copy link

I've installed BIOS v 1.17. Nothing worked for me from this manual including the disabled secure boot. What worked was creating a BootUSB and booting from it.

Now I'm struggling with amdgpu installation in ubuntu 22.04.

@rnestler
Copy link

rnestler commented May 9, 2022

There seem to be fixes on the way for 5.18 for AMD s2idle/S0ix: https://www.phoronix.com/scan.php?page=news_item&px=Linux-s2idle-More-AMD-Lenovo

@bradleysmith
Copy link

Anyone upgraded to Fedora 36 yet?

@linderd
Copy link
Author

linderd commented May 12, 2022

Anyone upgraded to Fedora 36 yet?

I did to check the p-state support in kernel 5.17.
But it's not really that groundbreaking, it enables the CPU to clock as low as 400 MHz, when you don't need it.
Therefore S0ix support broke again..
I will add notes about activating amd-pstate as soon as I have time for it.

@mmtechslv
Copy link

mmtechslv commented May 18, 2022

I had a very annoying issue in Fedora 35/36 where I would get stuck in the Lenovo splash screen. From what I understand it was a bug in shim package(UEFI loader) when Lenovo boot mode was in "Quick". I was basically getting stuck in the Lenovo logo while the LUKS password request was awaiting in the background. Changing boot mode into "Diagnostics"(No Lenovo logo) fixed it. However, the issue is severe and can manifest differently. More details can be found here https://bugzilla.redhat.com/show_bug.cgi?id=1955416

Also in addition to that, it seems that the T14 gen 2 BIOS version(factory version 1.13) is buggy, hence it caused me a myriad of problems after shim package got updated. Therefore, I highly recommend updating the BIOS to the newer version 1.17. You can use fwupd tool to update it if you have installed OS

@JesusMcCloud
Copy link

FYI Bluetooth works flawlessly using https://github.com/lwfinger/rtw89-BT

@pimou
Copy link

pimou commented Aug 5, 2022

Thank you for your experience.
I have a T14 GEN2 Intel i5 but I have some problems with Fedora (36). These do not appear under Ubuntu 22.04 LTS with the OEM kernel (I have not tried another kernel).
In the Bios, I have enabled "Wireless Auto Disconnection" : auto disable wireless when LAN is connected.
When I boot with LAN disconnected : no problem.
If I then connect the LAN, the Wifi is disconnected but I get 2 messages in the log:
-iwlwifi 0000:09:00:0 : failed to send flush command (-132)

  • System incurred a non-fatak error in ??()
    WARNING: CPU: 6 PID: 94 at net/mac80211/sta_info.c:1095
    __sta_info_destroy_part2+0x136/0x160 [mac80211]

When I start up with the LAN connected, the NetworkManager-wait-online.service process then takes a long time.

Following these problems, I tested other distributions including Ubuntu which is now installed on the laptop.

@eriteric
Copy link

I really doubt the screen I have on this t14 gen 2 amd is 500nits brightness or an IPS panel as the specs on mine say. It does have the privacy screen which makes it hard to view at an angle, willing to accept that impedes the viewing angles even when off. Just wondering if there is a setting to increase the brightness more than what xbacklight -set 100 does. It is really bad, also have a light band across the bottom of the screen. Are others like this? Wish there was some way to measure, but it's very dim, about a quarter of a macbook air's brightness.

@afro-coder
Copy link

@linderd what was the ARM based laptop you purchased I'm curious

@linderd
Copy link
Author

linderd commented Mar 15, 2023

@linderd what was the ARM based laptop you purchased I'm curious

a M1 Macbook Air.
At the moment with macOS, but I think I will try Asahi Linux sooner or later.

@LetMyPeopleCode
Copy link

a M1 Macbook Air. At the moment with macOS, but I think I will try Asahi Linux sooner or later.

Be careful with ARM Linux. There are a number of packages that don't have a compiled binary available for it. I don't run Linux as a daily driver, so It's faster to RDP into my Thinkpad from my Mac to run X86_64 Ubuntu in Hyper-V and pull down a binary than trying to compile one with ARM Linux on Apple Silicon.

@afro-coder
Copy link

True everyone with the M1 has this same complaint

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