Unable to suspend properly on Thinkpad P15v Gen 3 AMD/NVIDIA

I recently bought a ThinkPad P15v Gen 3 with a Ryzen 7 6850H and an RTX A2000. I immediately began having issues with sleep. When I suspend the system with systemctl or by closing the lid, subsequent attempts to wake the laptop produce no signs of life aside from the power button and fn-lock/microphone-lock lighting up. Combing through the system journal, I find a message

PM: Some devices failed to suspend, or early wake event detected

but I can’t find anything relevant in the surrounding logs. At boot, I see the messages

[0.442677] ACPI BIOS Error (bug): Failure creating named object [_SB.PCI0.LPC0.EC0.LHKF], AE_ALREADY_EXISTS (20240827/dswload2-326)
[0.442707] ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20240827/psobject-220)

but everything I’ve read says these messages are harmless.

I tried a stock installation of Ubuntu 24.04 LTS, and sleep seemed to be broken there too. I was only able to get success in some cursory tests of Ubuntu 22.04 LTS, for which this laptop is certified by Canonical, apparently. However, that uses really old kernels and packages.

My system configuration and system journal are below. I’ve tried many combinations of NVIDIA, udev, and power management settings, but it doesn’t seem like any of that has made a difference.

Any advice on what to try from here? It feels like I’ve exhaused all the documentation I can find.

configuration.nix:

{ config, pkgs, ... }:

{
  imports = [./hardware-configuration.nix];

  hardware.graphics.enable = true;
  hardware.nvidia = {
    prime = {
      amdgpuBusId = "PCI:e6@0:0.0";
      nvidiaBusId = "PCI:1@0:0.0";
    };
    open = true;
    modesetting.enable = true;
    #powerManagement.enable = true;
  };
  powerManagement.enable = true;
  services.udev.extraRules = ''
  ACTION=="add", SUBSYSTEM=="pci", DRIVER=="pcieport", ATTR{power/wakeup}="disabled"
'';
#   boot.kernelParams = [ "module_blacklist=amdgpu" ];


  #Everything below this was generated by the GUI installer
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos";
  networking.networkmanager.enable = true;

  time.timeZone = "America/Chicago";

  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;

  services.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

  users.users.testnixos = {
    isNormalUser = true;
    description = "testnixos";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      kdePackages.kate
    #  thunderbird
    ];
  };

  # Install firefox.
  programs.firefox.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  system.stateVersion = "25.11"; # Did you read the comment?

}

hardware-configuration.nix:

{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/b86446ac-a061-4972-a779-e162f09b4ef9";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/229F-7AC4";
      fsType = "vfat";
      options = [ "fmask=0077" "dmask=0077" ];
    };

  swapDevices = [ ];

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

system journal:

Mar 24 21:32:14 nixos systemd-logind[1028]: Lid closed.
Mar 24 21:32:14 nixos dbus-daemon[999]: [system] Activating service name='org.kde.powerdevil.wakeupsourcehelper' requested by ':1.37' (uid=1001 pid=1729 comm="/nix/store/cjp76k3s65wx3lhkjx2k51dkxf9lhgwc-powerd") (using servicehelper)
Mar 24 21:32:14 nixos org.kde.powerdevil.wakeupsourcehelper[2194]: Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
                                                                   Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
                                                                   If this causes problems, reconfigure your locale. See the locale(1) manual
                                                                   for more information.
Mar 24 21:32:14 nixos dbus-daemon[999]: [system] Successfully activated service 'org.kde.powerdevil.wakeupsourcehelper'
Mar 24 21:32:14 nixos systemd-logind[1028]: The system will suspend now!
Mar 24 21:32:14 nixos ModemManager[1841]: <msg> [sleep-monitor-systemd] system is about to suspend
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Demoting known real-time threads.
Mar 24 21:32:14 nixos ModemManager[1841]: <msg> [sleep-monitor-systemd] ready to sleep; dropping inhibitor
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Successfully demoted thread 1780 of process 1770.
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Successfully demoted thread 1770 of process 1770.
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Successfully demoted thread 1619 of process 1566.
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Successfully demoted thread 1566 of process 1566.
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Successfully demoted thread 1572 of process 1565.
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Successfully demoted thread 1565 of process 1565.
Mar 24 21:32:14 nixos rtkit-daemon[1301]: Demoted 6 threads.
Mar 24 21:32:14 nixos kwin_wayland[1489]: Failed to delay sleep: The operation inhibition has been requested for is already running
Mar 24 21:32:14 nixos dbus-daemon[999]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.7' (uid=0 pid=1113 comm="/nix/store/l8g3fkhm48zbxk8r44fgmc3dyi59p4mj-networ")
Mar 24 21:32:14 nixos systemd[1]: Starting Network Manager Script Dispatcher Service...
Mar 24 21:32:15 nixos dbus-daemon[999]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Mar 24 21:32:15 nixos systemd[1]: Started Network Manager Script Dispatcher Service.
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: CTRL-EVENT-DSCP-POLICY clear_all
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=COUNTRY alpha2=US
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=COUNTRY alpha2=US
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=COUNTRY alpha2=US
Mar 24 21:32:15 nixos wpa_supplicant[1197]: p2p-dev-wlp2s0: CTRL-EVENT-DSCP-POLICY clear_all
Mar 24 21:32:15 nixos wpa_supplicant[1197]: p2p-dev-wlp2s0: CTRL-EVENT-DSCP-POLICY clear_all
Mar 24 21:32:15 nixos wpa_supplicant[1197]: nl80211: deinit ifname=p2p-dev-wlp2s0 disabled_11b_rates=0
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: CTRL-EVENT-DSCP-POLICY clear_all
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: Removed BSSID 3c:6a:d2:52:04:4e from ignore list (clear)
Mar 24 21:32:15 nixos wpa_supplicant[1197]: wlp2s0: CTRL-EVENT-DSCP-POLICY clear_all
Mar 24 21:32:15 nixos wpa_supplicant[1197]: nl80211: deinit ifname=wlp2s0 disabled_11b_rates=0
Mar 24 21:32:15 nixos systemd[1]: Starting Pre-Sleep Actions...
Mar 24 21:32:16 nixos systemd[1]: pre-sleep.service: Deactivated successfully.
Mar 24 21:32:16 nixos systemd[1]: Finished Pre-Sleep Actions.
Mar 24 21:32:16 nixos systemd[1]: Reached target Sleep.
Mar 24 21:32:16 nixos systemd[1]: Starting System Suspend...
Mar 24 21:32:16 nixos systemd[1]: user-175.slice: Unit now frozen-by-parent.
Mar 24 21:32:16 nixos systemd[1]: user@1001.service: Unit now frozen-by-parent.
Mar 24 21:32:16 nixos systemd[1]: session-2.scope: Unit now frozen-by-parent.
Mar 24 21:32:16 nixos systemd[1]: user-1001.slice: Unit now frozen-by-parent.
Mar 24 21:32:16 nixos systemd[1]: user.slice: Unit now frozen.
Mar 24 21:32:16 nixos systemd-sleep[2239]: Successfully froze unit 'user.slice'.
Mar 24 21:32:16 nixos systemd-sleep[2239]: Performing sleep operation 'suspend'...
Mar 24 21:32:16 nixos kernel: PM: suspend entry (s2idle)
Mar 24 21:32:16 nixos kernel: Filesystems sync: 0.009 seconds
Mar 24 21:32:17 nixos kernel: Freezing user space processes
Mar 24 21:32:17 nixos kernel: Freezing user space processes completed (elapsed 0.000 seconds)
Mar 24 21:32:17 nixos kernel: OOM killer disabled.
Mar 24 21:32:17 nixos kernel: Freezing remaining freezable tasks
Mar 24 21:32:17 nixos kernel: Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
Mar 24 21:32:17 nixos kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 24 21:32:17 nixos kernel: PM: Some devices failed to suspend, or early wake event detected
Mar 24 21:32:17 nixos kernel: [drm] PCIE GART of 1024M enabled (table at 0x000000F41FC00000).
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: SMU is resuming...
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: SMU is resumed successfully!
Mar 24 21:32:17 nixos kernel: nvme nvme0: D3 entry latency set to 10 seconds
Mar 24 21:32:17 nixos kernel: nvme nvme0: 16/0/0 default/read/poll queues
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring gfx_0.0.0 uses VM inv eng 0 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring gfx_0.1.0 uses VM inv eng 1 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.0.0 uses VM inv eng 4 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.1.0 uses VM inv eng 5 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.2.0 uses VM inv eng 6 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.3.0 uses VM inv eng 7 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.0.1 uses VM inv eng 8 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.1.1 uses VM inv eng 9 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.2.1 uses VM inv eng 10 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring comp_1.3.1 uses VM inv eng 11 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring kiq_0.2.1.0 uses VM inv eng 12 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring sdma0 uses VM inv eng 13 on hub 0
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring vcn_dec_0 uses VM inv eng 0 on hub 8
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring vcn_enc_0.0 uses VM inv eng 1 on hub 8
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring vcn_enc_0.1 uses VM inv eng 4 on hub 8
Mar 24 21:32:17 nixos kernel: amdgpu 0000:e6:00.0: amdgpu: ring jpeg_dec uses VM inv eng 5 on hub 8
Mar 24 21:32:17 nixos kernel: psmouse serio1: synaptics: queried max coordinates: x [..5678], y [..4694]
Mar 24 21:32:17 nixos kernel: psmouse serio1: synaptics: queried min coordinates: x [1266..], y [1162..]
Mar 24 21:32:17 nixos kernel: OOM killer enabled.
Mar 24 21:32:17 nixos kernel: Restarting tasks ... done.
Mar 24 21:32:17 nixos kernel: random: crng reseeded on system resumption
Mar 24 21:32:17 nixos kernel: PM: suspend exit
Mar 24 21:32:17 nixos kernel: PM: suspend entry (s2idle)
Mar 24 21:32:17 nixos kernel: Filesystems sync: 0.009 seconds
-- Boot f7970c0bd2684357bef9c650780a87e2 --
Everything past this came from a minute later when I forced the system to power down.

Consider a firmware upgrade with fwupdmgr. Lenovo have excellent support for this.

Also, given this is clearly just your graphics never coming alive again, I’d say nvidia is implicated.

Try using the laptop without configuring the nvidia driver at all; the mesa drivers are generally better behaved.

nvidia’s very, very latest (stable) driver (595.58.03) supposedly finally started offering more standardized sleep tooling:

Modified nvidia.ko to handle video memory preservation on its own when the open kernel modules are in use if NVreg_UseKernelSuspendNotifiers=1 is enabled. When the proprietary driver is in use, or if kernel suspend notifiers are disabled, video memory preservation requires using the /proc/driver/nvidia/suspend interface for suspend and resume notifications.
See the chapter titled “Configuring Power Management Support” in the README for more information.

I.e., if you use the latest driver and set NVreg_UseKernelSuspendNotifiers=1, this may be more successful than powermanagement.enable.

powermanagement.enable is what the release note talks about in the second half, for the record, it’s a systemd service that just saves GPU memory in main memory on suspend.

Unless you’re using this new driver feature, it’s required for suspend on GPUs with more than 256MB of memory, which last I checked, is all of them these days.


Some other notes, which won’t fix your issue:

This is a different powerManagement from the nvidia one. It’s enabled by default, you shouldn’t need to set this.

That rule makes it so that pcie devices cannot wake the laptop. I would remove this, at best it makes wake not work.

This is harmful, amdgpu will need to be loaded by the kernel if you want offload to work.

Also consider enabling hardware.nvidia.powerManagement.finegrained (which is unrelated to powerManagement.enable, despite the name, the NixOS module is a mess). It allows the GPU to fully turn off when not in use; This should be the default behavior, but the NixOS module breaks the default.

dynamicBoost can also be useful.

Thanks for your help. I removed the redundant/harmful configurations. I’ve also updated to the latest firmware (1.28 BIOS/1.17 ECP). Unfortunately, I don’t have any real progress to report. I tested Mesa and NVIDIA open/proprietary:

...
hardware.nvidia = {
    prime = {
      amdgpuBusId = "PCI:e6@0:0.0";
      nvidiaBusId = "PCI:1@0:0.0";
    };
    open = true;
    modesetting.enable = true;
    powerManagement.enable = true;
    powerManagement.finegrained = true;
};
boot.kernelParams = [ "nvidia.NVreg_UseKernelSuspendNotificers=1" ];
...

I haven’t been able to reach it over SSH after doing a sleep cycle; would a graphics lockup prevent the SSH daemon from running? If not, I’m worried NVIDIA would not be to blame.

Remove that line if you’re using the new feature. I don’t know what happens if you try to store/restore state with both interfaces at the same time; hopefully the powermanagement service just fails.

The new nvidia driver that supports this also isn’t in nixpkgs yet (literally released a day or two ago), you have to override it:

{ pkgs, lib, ... }: {
  # Remove this when nixpkgs catches up!!!
  hardware.nvidia.package = pkgs.kernelPackages.nvidiaPackages.mkDriver {
    version = "595.58.03";
    sha256_64bit = lib.fakeHash;
    openSha256 = lib.fakeHash;
    settingsSha256 = lib.fakeHash;
    usePersistenced = false;
  }
}

Right, that’s indeed less likely. Sounds to me like it really is the firmware that’s struggling, perhaps the laptop doesn’t support the sleep state Linux attempts to put it in or something (though that’s fairly new hardware, as well as lenovo, I’d find it surprising if there was this big of an incompatibility).

Can you share the last-boot logs from the journal with journalctl --boot -1? Scratch that, the journal you have shared is that, right?

Are you dual-booting windows or anything of the sort?