NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.53k forks source link

Graphical freeze on boot #328972

Open PatrickDaG opened 1 month ago

PatrickDaG commented 1 month ago

Describe the bug

The kernel param option introduced in https://github.com/NixOS/nixpkgs/pull/324921 results in my system graphical output freezing on boot.

Steps To Reproduce

Boot on my config with the newest nixos-unstable.

Additional context

Journal on non working setup when the screen freezes:

Jul 20 20:51:08 desktopnix kernel: nvidia-uvm: Loaded the UVM driver, major device number 234.
Jul 20 20:51:08 desktopnix systemd-modules-load[1623]: Inserted module 'nvidia'
Jul 20 20:51:08 desktopnix (udev-worker)[1838]: nvidia: Process '/nix/store/m101dg80ngyjdb02g6jwy80sr7kzj26g-bash-5.2p26/bin/bash -c 'for i in $(cat /proc/driver/nvidia/gpus/*/infor>
Jul 20 20:51:08 desktopnix systemd-modules-load[1623]: Inserted module 'nvidia_modeset'
Jul 20 20:51:08 desktopnix kernel: nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  555.58.02  Tue Jun 25 01:10:21 UTC 2024
Jul 20 20:51:08 desktopnix kernel: [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
Jul 20 20:51:09 desktopnix kernel: [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1
Jul 20 20:51:09 desktopnix kernel: Console: switching to colour dummy device 80x25
Jul 20 20:51:09 desktopnix kernel: nvidia 0000:01:00.0: vgaarb: deactivate vga console
Jul 20 20:51:09 desktopnix kernel: fbcon: nvidia-drmdrmfb (fb0) is primary device
Jul 20 20:51:09 desktopnix kernel: Console: switching to colour frame buffer device 240x67
Jul 20 20:51:09 desktopnix kernel: nvidia 0000:01:00.0: [drm] fb0: nvidia-drmdrmfb frame buffer device
Jul 20 20:51:09 desktopnix systemd[1]: systemd-vconsole-setup.service: Deactivated successfully.
Jul 20 20:51:09 desktopnix systemd[1]: Stopped Virtual Console Setup.
Jul 20 20:51:09 desktopnix systemd[1]: Stopping Virtual Console Setup...
Jul 20 20:51:09 desktopnix systemd[1]: Starting Virtual Console Setup...
Jul 20 20:51:09 desktopnix systemd-modules-load[1623]: Inserted module 'nvidia_drm'

Journal on working boot:

Jul 21 19:34:27 desktopnix systemd[1]: Started Load/Save RF Kill Switch Status.
Jul 21 19:34:27 desktopnix kernel: nvidia-uvm: Loaded the UVM driver, major device number 234.
Jul 21 19:34:27 desktopnix systemd-modules-load[1621]: Inserted module 'nvidia'
Jul 21 19:34:27 desktopnix (udev-worker)[1757]: nvidia: Process '/nix/store/m101dg80ngyjdb02g6jwy80sr7kzj26g-bash-5.2p26/bin/bash -c 'for i in $(cat /proc/driver/nvidia/gpus/*/infor>
Jul 21 19:34:27 desktopnix kernel: nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  555.58.02  Tue Jun 25 01:10:21 UTC 2024
Jul 21 19:34:27 desktopnix systemd-modules-load[1621]: Inserted module 'nvidia_modeset'
Jul 21 19:34:27 desktopnix kernel: [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
Jul 21 19:34:28 desktopnix kernel: [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1
Jul 21 19:34:28 desktopnix systemd-modules-load[1621]: Inserted module 'nvidia_drm'
Jul 21 19:34:28 desktopnix systemd-modules-load[1621]: Inserted module 'uinput'

Notify maintainers

@CobaltCause

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
 - host os: `Linux 6.8.12, NixOS, 24.11 (Vicuna), 24.11pre-git`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - nixpkgs: `/run/current-system/nixpkgs`

Add a :+1: reaction to issues you find important.

CobaltCause commented 1 month ago

Oof. Out of curiosity, what happens if you:

  1. boot a system with the new kernel parameter
  2. wait till you reach the graphical freeze
  3. press ctrl and a function key to switch to a different TTY from the graphical one
  4. press ctrl and the function key to switch back to the TTY that's doing the graphical stuff

Does that unfreeze it?

PatrickDaG commented 1 month ago

Tried it. The screen remained frozen. I wasn't able to switch TTY.

CobaltCause commented 1 month ago

Hmm okay, thanks for trying. I think it would probably be a safe bet to revert my PR then. In the meantime you could probably use a workaround like

hardware.nvidia.modesetting = false;
boot.kernelParams = [ "nvidia-drm.modeset=1" ];

to get the old behavior. Not sure if there's anything that makes decisions based on hardware.nvidia.modesetting though.

CobaltCause commented 1 month ago

I think it would probably be a safe bet to revert my PR then.

On second thought, there are quite a few of backlinks from https://github.com/NixOS/nixpkgs/pull/324921 about it fixing things for people, so maybe it's not so cut and dry...

CobaltCause commented 1 month ago

It might help to know some more about your setup to debug this:

  1. What model GPU is this happening with?
  2. Is the machine in question a laptop or a desktop? (I see your logs say "desktopnix" but asking anyway to make sure)
  3. Is the monitor physically connected directly to the GPU's display outputs?

Also, can you SSH into the machine while the screen is frozen?

PatrickDaG commented 1 month ago

It's a gtx 1080 in a desktop. I have 3 monitors all connected directly to the graphics card. I can ssh into the PC after it froze it seems to startup just fine, journal also contains no unexpected errors as far as I can see. This should be all the relevant configuration I have set.

TomaSajt commented 1 month ago

I have also encountered some issues with my display after https://github.com/NixOS/nixpkgs/pull/324921 was merged.

Every time I booted into my computer, right before the login screen was supposed to appear my screen would turn black with a message in the middle saying "Not Optimum Mode, Recommended Mode 3840x2160 60Hz" (this is a Samsung monitor).

I could work around this issue by changing my display to HDMI2 and back to HDMI1, which would fix the issue.

The config workaround mentioned above works for me, thanks for sharing it

Not sure how much this helps, just wanted to share another instance where this option fails.

(Something of note might be that my hardware has some ACPI issues, since I have to use the libata.noacpi=1 kernel parameter to get rid of some errors. I've heard that ACPI may be related to the "Not optimum mode" message, but it hasn't appeared before the PR mentioned above. (I've tried getting rid of the kernel param, but it didn't help))

Pengiie commented 1 month ago

I also encountered the same issue where my computer finishes booting, but the screen stays frozen before it reaches the TTY login. I also cannot switch TTYs.

I'm on a desktop GTX 1070 with my main monitor connected with DP and the second one HDMI. The workaround mentioned here to use the old behavior does fix the issue for me. The before and after of journalctl matches the same output as the original post, I'm using Nvidia drivers 555.58.02.

laycookie commented 1 week ago

Hmm okay, thanks for trying. I think it would probably be a safe bet to revert my PR then. In the meantime you could probably use a workaround like

hardware.nvidia.modesetting = false;
boot.kernelParams = [ "nvidia-drm.modeset=1" ];

to get the old behavior. Not sure if there's anything that makes decisions based on hardware.nvidia.modesetting though.

Have the same issue as everyone else, however the work around does not work for me. I'm able to boot, however when I try into a wayland compositor with the command Hyprland my screen just turns black, I also tried other compositers and the issue persists.

CPU: i7 8700k GPU: GTX 1080