Ubuntu on the Legion 5 Pro (2021)

Heads up: I’m not a gamer. A combination of specs, pricing, availability and urgency led me to purchase this laptop for productivity reasons. My run-through may not cover all aspects needed for gaming.

If the RGB show on the keyboard annoys you, use Fn+SPACE to select a less annoying mode for now. Also: Fn+L to toggle the Legion logo, Fn+Q to toggle thermal profile. These shortcuts work on both Windows and Linux.

Windows

As my work depends on this laptop, I did purchase the additional on-site support. And as I expect support to want to deal with Windows only, I left Windows installed.

Even if you decide to remove Windows, I recommend you set it up first and use it to apply any BIOS or firmware updates prior to installing Ubuntu. (As it turns out, my laptop already shipped with the latest BIOS version.)

The factory Windows install uses about 60GB, so I shrunk the Windows-SSD down to 75GB. You can use the Disk Management tool to do so.

BIOS

Shutdown the laptop and restart it while pressing F2. This gets you into the BIOS. I made the following changes:

  • Graphic Device: Dynamic Graphics (you will need to use nomodeset in GRUB if you don’t do this)
  • Boot > PXE Boot to LAN: Disabled

That’s it. I left Secure Boot enabled. Ubuntu and Ubuntu based Linux distributions have no problem with it.

Install Ubuntu

How to install Ubuntu has been well documented, I won’t repeat it here. Recommended: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/

My notes when following that how-to:

  • Start the laptop while pressing F2 so you can boot from the Ubuntu USB stick.
  • Optional: I chose to manually partition the drive and create an encrypted BTRFS volume voor my root.

Just works

A lot of things actually just work. Nice!

  • Wi-Fi
  • Bluetooth
  • AMD GPU
  • Internal Audio (incl. volume control)
  • Ethernet
  • Clickpad
  • Keyboard
  • USB-C PD power

Brightness Control

You’ll notice that while the brightness function keys appear to work they do not actually change the brightness. You can fix this by editing /etc/default/grub and adding the amdgpu.backlight parameter:

GRUB_CMDLINE_LINUX="amdgpu.backlight=0"

Run update-grub, reboot, and things will work. (This assumes you use Ubuntu 21.04 or later. Earlier version will need an updated kernel from the mainline ppa.)

Scaling

This one is personal, but I think things are too small at the default 100% scaling, and too large at 200%. Using Fractional Scaling at 150% suits me much better. Gnome warns of a performance impact, but this seem negligible for my uses.

Power Saving

I’m running TLP with the default settings for now. Will update this section if/when I make adjustments. With current settings I get about 5 and a half hours of batter time.

sudo apt install tlp smartmontools

My adjustments to tlp.conf so far:

Battery Conservation

Battery conservation mode prevents your laptop battery from charging fully and keeps it around 60% instead. This should aid the longevitity of the battery.

To enable battery conservation:

echo 1 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"

To disable battery conservation:

echo 0 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"

For convenience I created a systemd unit called /etc/systemd/system/battery-conservation-mode.service with the following content:

[Unit]
Description=Battery Conservation Mode

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'echo 1 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"'
ExecStop=/usr/bin/bash -c 'echo 0 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Which you can then start, stop, or have executed automatically upon start-up:

systemctl daemon-reload
systemctl start battery-conservation-mode
systemctl stop battery-conservation-mode
systemctl enable battery-conservation-mode

Function Lock

Maybe you never use the F1, F2,.. keys and just want them to function them as permanent media keys (for volume control, etc.) instead. You can do this by enabling the Fn Lock:

echo 1 > "/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/fn_lock"

Just like the battery conservation mode, you can put this in a systemd unit to enable it automatically at start-up.

File System

Ubuntu comes with periodic SSD trimming out of the box. No need to enable that yourself. If you use encrypted partitions like I do, Ubuntu also enabled discard in crypttab automatically.

Some changes I made to fstab:

  • Added the ssd option for my btrfs file systems.
  • Added the noatime option to both btrfs and ext4 file systems.