unixsysadmin.com

Fedora on a ThinkPad P1

ThinkPad P1

The Lenovo ThinkPad P1

Note, this post is based on Fedora 29.  For a more recent experience, see Fedora 30 on a ThinkPad P1. Following on from the successful RHEL8 on a ThinkPad P1 installation I thought I would revisit my Fedora install.

Specifications

As a reminder, here are the specifications of the ThinkPad P1:

Note: at the time of writing, there were reports that changing between discrete and hybrid graphics or changing the Thunderbolt settings caused issues.  This seems to be dependent on the version of BIOS being used.  Reference: Reddit thread: New BIOS to fix bricks and thermal issues for X1/P1 series from Lenovo. It is recommended to check your BIOS for updates before changing BIOS settings. Additional references:

Installation settings

The Fedora 29 installation wasn’t quite as smooth as the RHEL 8 install. Here are some notes from the various BIOS and boot combinations I used with the Fedora 29 Live USB.

The following combination did not seem to work:

However, two combinations did work:

Working combination 1:

Working combination 2:

Neither of these options are ideal.  For my latest installation, I thought I would try option 1 and then apply the latest kernel update.  At that point we can then see whether we can remove the acpi=off flag, switch to Discrete Graphics or try the NVIDIA drivers.

Kernel updates

The Fedora 29 kernel shipped with 4.18.16-300 but a ‘dnf update’ at the time of writing brought this to 4.19.4-300.

dnf update kernel

Additional testing without the NVIDIA drivers

I tested the following after fully updating the system:

This booted to the login screen, accepted my credentials but then gave me a blank screen.

Install the NVIDIA drivers

I wanted to keep BIOS settings to ‘hybrid graphics’ so that the integrated GPU can be used when I boot back into Windows, so I decided to reboot (with the ‘quiet rhgb acpi=off‘ flags) and install the NVIDIA drivers in Fedora.

Launching ‘Software’ in Gnome for the first time should prompt you to confirm whether you want to enable Fedora Third Party Software Repositories.  In the event that this doesn’t appear you can install the following RPM which adds some repositories in /etc/yum.repos.d.

sudo dnf install fedora-workstation-repositories-29-1.fc29.noarch

Search for ‘nvidia’ in the software window and the ‘NVIDIA Linux Graphics Driver’ should be listed.

Select the NVIDIA Linux Graphics Driver.  The following will appear giving some details about the package and the source – RPM Fusion:

Fedora NVIDIA Linux Graphics Driver Install

The installer does the following:

I proceeded to reboot the laptop – first with the ‘acpi=off rhgb quiet‘ options and then without them.  Both options allowed me to boot into the graphical desktop and removing the acpi=off flag allows all the CPUs to become visible and the power management functionality works correctly – battery levels, brightness levels with the function keys, etc.

Remove the acpi=off flag

To remove the ‘acpi=off rhgb quiet’ entries from the EFI menu permanently the following is performed:

Edit /etc/default/grub and identify the GRUB_CMDLINE_LINUX stanza which should read something like this:

GRUB_CMDLINE_LINUX="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 resume=UUID=a8b47a6f-1223-42aa-8b73-5c922cee1901 acpi=off rhgb quiet"

Remove the unwanted entries acpi=off rhgb quiet

Regenerate the UEFI menu
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Verify /boot/efi/EFI/fedora/grub.cfg is as expected and optionally reboot.  Note that I chose to remove the rhgb and quiet options from the boot loader.  This generates extra message on the console but these can sometimes be useful.

Kernel Updates with NVIDIA

The kernel modules with the NVIDIA driver must be rebuilt with each kernel update.  Using the NVIDIA packages from the RPM Fusion repository we installed from the Gnome Software Application takes care of this for us.

I was initially running kernel 4.19.5-300.fc29.x86_64 but 4.19.6-300.fc29.x86_64 was available.  Perform the update as normal:

sudo dnf update

After the update completes, the Akmods daemon builds the NVIDIA package for the new kernel.  In this case, it places it in the following directory:
# ls -l /usr/lib/modules/4.19.6-300.fc29.x86_64/extra/nvidia
total 24792
-rw-r--r--. 1 root root 95664 Dec 7 11:16 nvidia-drm.ko
-rw-r--r--. 1 root root 22108608 Dec 7 11:16 nvidia.ko
-rw-r--r--. 1 root root 1353760 Dec 7 11:16 nvidia-modeset.ko
-rw-r--r--. 1 root root 1818664 Dec 7 11:16 nvidia-uvm.ko

Important: after the dnf command completes it will take a short time (less than a minute) to compile the module. Do not reboot until this process completes.

Power Management

TLP – Linux Advanced Power Management can enhance the battery life on the ThinkPad P1.  The installation is fairly straightforward.  To begin, install tlp and smartmontools from the standard Fedora repos:

dnf install tlp smartmontools

Take a backup of the default TLP configuration:
cp -p /etc/default/tlp /etc/default/tlp.default

Optionally edit /etc/default/tlp and alter the battery charge thresholds:
START_CHARGE_THRESH_BAT0=40
STOP_CHARGE_THRESH_BAT0=45

The above is a good option if the ThinkPad is mainly used at a desk with a plugged in power supply.  This should extend the life of the battery.  The drawback is that if you need to charge the battery to 100% so you can work without the power supply, you’ll have to stop the TLP service or alter the settings.

Install the ThinkPad specific kernel modules for TLP:
dnf install http://repo.linrunner.de/fedora/tlp/repos/releases/tlp-release.fc$(rpm -E %fedora).noarch.rpm
dnf install akmod-tp_smapi akmod-acpi_call kernel-devel

For further information about these modules, see Which kernel module do i need for my hardware, tp-smapi or acpi-call?  I noted that the ‘akmod-tp_smapi’ module didn’t seem to be required on the ThinkPad P1 – but as per the previous link “remove the unnecessary module package…. However, it doesn’t hurt to keep both.”

Enable the service and start it at boot time:

systemctl enable tlp.service
systemctl start tlp.service

To monitor the TLP service:
tlp-stat

Summary

With a few tweaks, Fedora 29 is running on the ThinkPad P1 using the NVIDIA Graphics driver and with ‘hybrid’ options selected in the BIOS.  TLP settings are working fine.

Useful resources

Exit mobile version