This is some notes and personal observations for dealing with Linux on Legion Devices. If you are looking for a guide to fix all the weird quirks, then cszach/linux-on-lenovo-legion is the place to look for. That repository helped me the most.
- Laptop - Legion Slim 5 16AHP9 (AMD Ryzen 7 8845HS + RTX 4060)
Operating System: Fedora Linux 41
Kernel Version: 6.12.6-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
Memory: 30.6 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 83DH
System Version: Legion Slim 5 16AHP9
NOTE: All of these are also automated into a bash script available here
Run this and it'll tell Linux to use the Local Hardware Clock
sudo timedatectl set-local-rtc 1 --adjust-system-clock
I'm using Fedora because they have their guide is easier to work with than ArchWiki for me and I have custom python scripts to automate most stuff for Fedora.
-
Setup SecureBoot Follow the instructions from RPM Fusion - HowTo/Secureboot
-
Import the key to EFI Firmware by running the following.
sudo mokutil --import /etc/pki/akmods/certs/public_key.der
How to revert?
`sudo mokutil --export` and it will export the keys to the current directory. `sudo mokutil --delete <THE FILE>` will "un-enroll". It's okay even if your linux installation is gone. Using a live USB you can do the same. It's stored in your UEFI Firmware so it's better to not fill the memory with unused keys.
If it's too confusing, just disable it
sudo mokutil --disable-validation
-
sudo dnf install akmod-nvidia -y
watch -n 1 modinfo -F version nvidia
Once it prints NVIDIA driver version, reboot. Fans will spin up and it will happen in the background. If you reboot before that, just re-install and wait again.
Since we have a Hybrid-GPU configuration, By default it should be using our iGPU. So technically the dGPU should be turned off or on Low Power state. But at the time of writing this, that's kind of broken. Which is the reason I'm writing and documenting this.
- Monitor Driver using
watch -n 1 cat /proc/driver/nvidia/gpus/0000:01:00.0/power
cat /sys/bus/pci/devices/0000:01:00.0/power/control
should outputauto
watch -n 1 cat /sys/class/drm/card0/device/power_state
will output the current power state. It's ACPI power state so- DO > D1 > D2 > D3 > D3Cold
- D3Cold means it's barely using any power. Which is what you want when you're not using the dGPU. But you will notice that it's stuck on D0 if the power management isn't working properly.
**NOTE** : At the time of writing, For me, it is not working and is always D0 even when I'm not using it
This should be the default but for some reason, it didn't happen.
-
In
/etc/modprobe.d/nvidia.conf
, add followingoptions nvidia_drm modeset=1 fbdev=1 options nvidia NVreg_DynamicPowerManagementVideoMemoryThreshold=0
-
In
/etc/udev/rules.d/nvidia.rules
# Remove NVIDIA USB xHCI Host Controller devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1" # Remove NVIDIA USB Type-C UCSI devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1"
-
Reboot
**NOTE** : As mentioned in the discussion, Changing Legion Power Profiles or Unplugging while charging etc will Switch to D0 and eat the battery. So restarting at that time is only the way.