Lenovo Legion 7 (2021) and Arch Linux

The Lenovo Legion 7 is one of the best high-end laptops you can buy right now. Its sleek design, large screen-to-body ratio, and excellent cooling capabilities make it the perfect fit for anyone looking for a powerful machine in a decently portable package.

Lenovo Legion 7 (2021) and Arch Linux
Photo by Hardware Canucks / YouTube

The Lenovo Legion 7 is one of the best high-end laptops you can buy right now. Although it's mainly aimed at a gaming audience, its sleek design, large screen-to-body ratio, and excellent cooling capabilities make it the perfect fit for anyone looking for a powerful machine in a decently portable package.

The model I have is the Legion 7 16ACH-06 with the following specifications:

  • AMD Ryzen 7 5800H (8 Cores, 16 Threads, Base 3.2GHz, Turbo 4.4GHz)
  • NVIDIA GeForce RTX 3070 Mobile
  • GPU MUX Switch (Dedicated + Optimus Graphics)
  • 32GB DDR4 3200MHz RAM
  • 2TB M.2 NVMe PCIe SSD
  • 16" QHD (2560x1600) 165Hz 3ms 500nits HDR400 IPS Display
  • 300W Power Supply

As with most laptops on the market, this device came pre-installed with Windows 10 Home as well as the Lenovo Vantage App which allows users to modify system settings typically accessed through the UEFI menu.

Post contents

Linux Addiction

Even though Windows is without a doubt the best operating system for gaming, that's not what I wanted to use this device for. As a CompSci student, I wanted to have a machine that allows me to code and compile projects on the go, manage multiple virtual machines, and have decent battery life. So, after checking that everything was working fine, I imaged the entire disk using Clonezilla in case something went wrong, and proceeded to install Arch Linux.

I'm not going to describe the entire installation process since the Arch Wiki does it better than I could ever hope to, but I still want to mention a couple of things:

  1. I only made a single ext4 partition (instead of separate root, home, and swap) and created a /swapfile for easy resizing later down the line. However, you can partition your drive however you see fit.
  2. When running pacstrap, I recommend installing a lot more than just what the wiki recommends:
pacstrap /mnt base linux linux-firmware amd-ucode efibootmgr grub git nano vim linux-headers net-tools networkmanager sudo
  1. After installing a desktop environment / display manager / window manager combo (in my case, that's LightDM and AwesomeWM), you should also install the necessary video drivers:
pacman -S nvidia xf86-video-amdgpu

Bug Fixing

Most of the laptop's hardware was working out of the box, including:

  • Keyboard
  • Touchpad
  • RGB lighting presets (Fn+Space)
  • Performance profiles (Fn+Q)
  • Camera
  • Microphone
  • WiFi & Bluetooth
  • I/O Ports
  • GPU Switching (since you do that from the UEFI)
  • Battery Conservation Mode (using a simple script)
  • Multihead Support
  • Suspend/Hibernate Support

The default IOMMU groups were also decent, with the GPU Video and Audio buses being separate from the rest of the system. This, along with the GPU MUX switch shows promise for a single-GPU PCI passthrough setup...

Sadly, Linux is not officially supported by Lenovo on this model, so two major issues were immediately noticeable: backlight control and speaker audio.

Backlight Control

ℹ️
Update:After updating to drivers nvidia-510.xx, brightness control no longer works in dedicated mode. For a temporary solution, try downgrading back to nvidia-495.46-9.

The backlight was a surprisingly easy fix. First, I had to add nvidia.NVreg_RegistryDwords=EnableBrightnessControl=1 to my kernel parameters. After this, I created a couple of udev rules to give non-root users access to the ACPI backlight controls. Finally, I wrote a couple of scripts that automatically get the current brightness level and add/subtract 10%. You can find all scripts as well as the udev rules in this git repository.

Audio

ℹ️
Update:As of kernel 5.18, audio is no longer an issue. If you still can't get it to work, make sure that you have enabled CONFIG_SERIAL_MULTI_INSTANTIATE in your kernel config.If you need a guide on how to apply patches and build a custom kernel, you can check out this post.

The audio issues are sadly almost impossible to fix. The 3.5mm headphone jack and Bluetooth audio work fine. However, the speakers have a couple of Cirrus CS35L41 pre-amps that Linux doesn't recognize correctly, and therefore doesn't initialize. Despite that, there's still hope: This thread shows promising results with similar models and it is estimated that a working driver will be ready by early 2022.

Refresh Rate

Another less important quirk is that Xorg prefers the 60Hz mode by default when using the dedicated GPU. This can easily be fixed by creating a /usr/share/X11/xorg.conf.d/10-nvidia-refresh-rate.conf file and adding the following contents:

Section "Screen"
  Identifier "Screen 0"
  Subsection "Display"
    Modes "2560x1600_165"
  EndSubsection
EndSection
/usr/share/X11/xorg.conf.d/10-nvidia-refresh-rate.conf

Touchpad

Finally, there is a small chance that the touchpad drivers won't load correctly when booting the laptop, forcing you to restart the machine. This can be fixed by creating a modprobe dependency:

softdep i2c_hid pre: pinctrl_amd
softdep usbhid pre: pinctrl_amd
/etc/modprobe.d/touchpad.conf

Conclusion

Even though using Arch on this laptop is not 100% smooth sailing, I feel that the few issues it has will be ironed out during the next couple of months. So, if you are currently in the market for a powerful machine to install Linux on, I'd definitely recommend giving this one a shot - if you can find it in stock, that is.