For @amrits as well
I have a Lenovo Legion Y540 which is a precursor to the Legion 5. It’s model 15IRH, has only RTX 2060 Ti graphics (no hybrid in BIOS possible). Couple things I’ve found while troubleshooting.
- The Legion series was spec’d for primarily Windows gaming and so most likely will not receive any Linux support from Lenovo.
- The Legion Y540 was an up-spec’d Ideapad; I found this after booting GRUB with the
acpi_video=vendor
option, which resulted in /sys/class/backlight/ideapad. Using acpi_video=ideapad
in GRUB resulted in a hang at boot time; no further troubleshooting was possible.
- The F5/F6 keys worked in Linux Mint using
EnableBrightnessControl=1
but getting there was a struggle, having to boot into compatibility mode first with the Nouveau drivers, then installing NVIDIA, then rebooting, then messing with the 10-nvidia.conf file. I eventually switched to Arch Linux (EndeavourOS) as I could get better troubleshooting info.
After hours of systematic trial-and-error, and hours of frustration, I was able to make the following work. Using kernel 5.10 and NVIDIA 465. All this is done using sudo or other account with root privileges.
First:
Edit etc/default/grub:
Add kernel parameter acpi_video=native
This allows the system to generate the nvidia_0 backlight class.
Run update-grub
for Debian systems, grub-mkconfig -o /boot/grub/grub.cfg
for Arch systems
Second:
Edit /etc/mkinitcpio.conf:
MODULES="nvidia nvidia_modeset nvidia_uvm nvidia_drm"
Notice that @shashank_96 's edit is missing the nvidia_uvm
module.
On Debian, run updateinitramfs -u
.
On Arch-based, you need to add hooks for when you rebuild the kernel.
Edit /etc/pacman.d/hooks/nvidia.hook:
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c ‘while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P’
Then run mkinitcpio -P
Third and last:
To enable kbd brightness, edit /usr/share/X11/xorg.conf.d/10-nvidia.conf:
Section “OutputClass”
Identifier “nvidia”
MatchDriver “nvidia-drm”
Driver “nvidia”
Option “AllowEmptyInitialConfiguration”
Option “RegistryDwords” “EnableBrightnessControl=1;”
ModulePath “/usr/lib/x86_64-linux-gnu/nvidia/xorg”
EndSection
So this is a lot of hoops to jump through but I was able to get my F5/F6 keys working. Troubleshooting this is a bear because the issues almost always seem to arise at the GRUB/ kernel module level.
One other resource that may help, but I haven’t investigated yet, is in the Manjaro article ACPI Kernel Parameters and how to choose them. If you know which version of Windows your Legion 5 was built for, you may be able to get further along the troubleshooting path than I did using trial-and-error.