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.
As my work depends on this laptop, I did purchase the additional on-site support.
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.
I expect support to want to deal with Windows only, so 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.
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.
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:
Run update-grub, reboot, and things will work.
Battery Conservation Mode
Battery conservation mode prevents your laptop battery from charging fully and keeps it around 60% instead. This should aid the longevity of the battery.
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 we then activate using:
systemctl daemon-reload systemctl start battery-conservation-mode systemctl stop battery-conservation-mode systemctl enable battery-conservation-mode
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 could put this in a systemd unit to enable it automatically at start-up.
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.
Snap apps with Wayland and Zsh
There’s are two longstanding issues using snap apps in Ubuntu. Two issues that still exist in Ubuntu 20.04 beta.
Snap apps don’t show up in Gnome’s Activities view when using Wayland instead of Xorg. Snap apps cannot be started from the command-line when using zsh instead of bash. Looking into this, I ran into numerous discussions on both topics. Most notably:
The zsh work-around mentioned in these and other discussions works very well. Just add the following line to your .zshrc. (Adding it to /etc/zsh/zshrc should work as well.)
emulate sh -c 'source /etc/profile.d/apps-bin-path.sh'
When using bash the scripts in /etc/profile.d/ are sourced automatically. Zsh does not bother with them, unless we instruct it to.
Unfortunately the work-arounds for Wayland did not work for me. They failed to convince Wayland and Gnome to look in snap’s applications folder.
The following line links snap’s applications folder into the Ubuntu’s main applications folder.
sudo ln -s /var/lib/snapd/desktop/applications/ /usr/share/applications/snap
Unlike all the other work-arounds out there, there’s no need to logout and log back in. This works instantly.