NixOS / nixos-hardware

A collection of NixOS modules covering hardware quirks.
Creative Commons Zero v1.0 Universal
2.08k stars 646 forks source link

Legion 16irx8h Random Freeze #1050

Open MAkcanca opened 4 months ago

MAkcanca commented 4 months ago

System Information

Device: Lenovo Legion 16irx8h Kernel Version: 6.9.8 OS: NixOS with mostly default setup Hardware Configuration: Using nixos-hardware/lenovo/legion/16irx8h, Quiet Mode(blue) and Hybrid Graphics

Problem Description

I was randomly switching the power settings from power saver to balanced etc. then letting system dim screen multiple times. System suddenly froze, nothing written in journalctl. I had to press and hold the power button. Latest journalctl logs from last boot, freeze happened around 19:39

Jul 19 19:38:25 nixos systemd[1]: Starting Hostname Service...
Jul 19 19:38:25 nixos systemd-timesyncd[1308]: Network configuration changed, trying to establish connection.
Jul 19 19:38:25 nixos systemd-timesyncd[1308]: Network configuration changed, trying to establish connection.
Jul 19 19:38:25 nixos systemd-timesyncd[1308]: Network configuration changed, trying to establish connection.
Jul 19 19:38:25 nixos systemd-timesyncd[1308]: Contacted time server 162.159.200.1:123 (2.nixos.pool.ntp.org).
Jul 19 19:38:25 nixos dbus-daemon[1503]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jul 19 19:38:25 nixos systemd[1]: Started Hostname Service.
Jul 19 19:38:33 nixos .org.gnome.Char[51683]: JS LOG: Characters Application exiting
Jul 19 19:38:37 nixos wpa_supplicant[1720]: wlp0s20f3: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-61 noise=9999 txrate=526600
Jul 19 19:38:41 nixos wpa_supplicant[1720]: wlp0s20f3: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-61 noise=9999 txrate=526600
4JX commented 4 months ago

Same as #1043, also happens on my 16ACH6H. I feel it happens more when the laptop is doing a high workload situation, but I do not have a reproducible setup. Started happening after I switched to Wayland+GNOME from X11+KDE, might be related to graphics?.

Will try to pull logs next time it

4JX commented 3 months ago

Hey, this seems to be related to https://discourse.nixos.org/t/kernel-panic-system-freezes-no-bsod/45424 and https://forums.developer.nvidia.com/t/series-550-freezes-laptop/284772. I can recreate the kernel panics part pretty solidly and there's a bunch of people with legions over there.

I've changed my driver to 560.31.02 (another solution proposed is to roll back to 53X.X.X or to try another driver like nvidia-open/noveau+nvk) and it has at least fixed the shutdown panics and sleep freezes from a quick test, will see how it fares long term.

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta; # Currently 560.31.02
MAkcanca commented 2 months ago

@4JX What is your boot.kernelPackages configuration and current kernel version? linuxPackages_latest does not work with config.boot.kernelPackages.nvidiaPackages.beta requires patching

4JX commented 2 months ago

Kernel is at pkgs.linuxKernel.packages.linux_6_10 - Linux terra 6.10.7 #1-NixOS SMP PREEMPT_DYNAMIC Thu Aug 29 15:36:13 UTC 2024 x86_64 GNU/Linux

Also params just in case:

nix-repl> outputs.nixosConfigurations.terra.config.boot.kernelParams      
[ "amd_pstate=active" "loglevel=4" "drm.edid_firmware=eDP-1:edid/16ach6h.bin,eDP-2:edid/16ach6h.bin" "nvidia-drm.modeset=1" "nvidia-drm.fbdev=1" "nvidia.NVreg_PreserveVideoMemoryAllocations=1" "nvidia.NVreg_OpenRmEnableUnsupportedGpus=1" ]

Full config over at https://github.com/4JX/nixos-config

Edit: Looks like the normal driver caught up version wise

MAkcanca commented 2 months ago

Did not work. 560.35 and 6.10 is somehow not compatible (?) Throws the error below after building

inconsistent kernel versions: 6.10.9
6.6.50

Also 560 is not available in latest versions of 24.05 channel, only up to 550. I tried only using unstable for Nvidia then keep it stable (24.05) for rest of the system but sadly no luck with the config below

Current relevant configuration.nix part:

let 
  unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
in {
  imports =
    [ 
      <nixos-hardware/lenovo/legion/16irx8h>
      ./hardware-configuration.nix
    ];
    ...
      boot.kernelPackages = unstable.linuxPackages_6_10;
      hardware.nvidia.package = unstable.linuxPackages.nvidiaPackages.latest;
}

I was only able to build after switching to unstable.linuxPackages_6_6

4JX commented 2 months ago

in latest versions of 24.05 channel

Ah, I follow nixos-unstable (which is pretty darn stable despite its name, you should give it a chance).

inconsistent kernel versions: 6.10.9 6.6.50

boot.kernelPackages = unstable.linuxPackages_6_10;

You probably have some part of your system still depending on 6.6 somewhere. I'm doing fine on unstable with this.