NixOS / nixpkgs

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

Completely freezes when shutting down / rebooting / logging out #40388

Open Pauan opened 6 years ago

Pauan commented 6 years ago

Issue description

I had used NixOS for several months without any problems, however recently I've had quite a few nasty problems.

With a fresh installation of NixOS unstable, I cannot shutdown, reboot, or log out. When I attempt to do so, everything completely freezes:

  1. The screen remains on the KDE desktop.

  2. My mouse does not work.

  3. My keyboard does not work (even the Numlock button on my keyboard does not work!)

  4. In addition, the fan in my computer goes into super-high-speed mode (it makes a lot of noise).

I have tried waiting for hours, and it does not fix it. The only way to fix it is to do a hard shutdown (which is obviously not good at all!)

This problem does not happen with the Live CD or the VirtualBox image, it is only with a fully-installed system. In addition, I did not used to have this problem, so it is a regression.

I am using a laptop, and I don't think it's a configuration problem (a fresh configuration fails, and my old configuration also fails).

Here are the journalctl logs from the time I attempted the shutdown until the hard shutdown.

Steps to reproduce

  1. Install NixOS unstable.

  2. Boot.

  3. Shutdown / reboot / logout from the KDE start menu.

    Alternatively, use shutdown now or reboot in the TTY console.

Technical details

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.14.39, NixOS, 18.09pre139651.6db7f92cc2a (Jellyfish)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.0.2`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`
jcrben commented 6 years ago

nixos-unstable channel currently does not work for me - when I try running sudo nixos-rebuild --upgrade switch from stable 18.03, I get immediately (no reboot?) dropped into tty1 with a short message ("Welcome to NixOS 18.03...) and my keyboard does not work. I then have to press the power button to turn off and select the prior generation.

Well, being dropped in a tty where my keyboard does not work is a jarring experience (maybe related to https://github.com/NixOS/nixpkgs/issues/40218?) but it turns out that if I select the unstable generation after rebooting with the power button my system does boot OK. I'm running KDE Plasma + i3. Chromium doesn't really seem to work, but that's off-topic here... (worked after upgrading)

@Pauan any chance you could share your entire configuration.nix and hardware-configuration.nix plus laptop model? I could try running your exact config on my thinkpad t460s. Not sure what the scope of "fresh configuration" and "old configuration" entails.

teto commented 6 years ago

I have some rare freezes (touchpad/keyboard won't work) on laptop when the lid moves. CLosing/moving the lid and reopening usually solves it (try several times). Might be related.

Pauan commented 6 years ago

@jcrben "Fresh configuration" just means the default configuration which is created by nixos-generate-config --root /mnt (i.e. the same config a new user would have). Which means the problem has nothing to do with my old configuration.

Here is a simple configuration which reproduces the problem for me.

Here is the exact laptop that I am using.

@teto Maybe, but my problem happens 100% of the time, and it has nothing to do with the lid moving (I keep my lid closed and I use an external monitor).

matthewbauer commented 6 years ago

For reproducing this:

Pauan commented 6 years ago

@matthewbauer I have an Intel video card, and also an Nvidia video card.

The services.xserver.videoDrivers is the default (which is [ "ati" "cirrus" "intel" "vesa" "vmware" "modesetting" ]), so I guess it's loading the intel driver. Here is the glxinfo for my computer.

When I disable X/sddm/plasma, the same problem happens. Here is the output of journalctl for the non-X attempt. I'm not sure if it's relevant, but the last on-screen message that I see is Started mdadm-shutdown.service., and after that it hangs.

I tried running lspci, but it got stuck at 100% CPU and never finished. When I tried killing it, it refused to be killed, and I got these journalctl messages.

It will take quite some time for me to test out other distros to see if it's a problem on them or not.

coretemp commented 6 years ago

@teto I have the same problem as you have. In my case it happened when I was watching a webm file via VLC.

I don't know how to reproduce it, but if it has happened once, the probability of it happening again is higher. Putting the machine to sleep (by closing the lid) and then opening the lid again solved the problem in one case for only 5 seconds and subsequently for at least an hour (indefinite time).

I use intel graphics and there is no nvidia card present.

Can you post your kernel version too?

coretemp commented 6 years ago

@Pauan I expect that NixOS Unstable is unstable, because the code has not been vetted by Intel to work yet. For example, for my kernel version Intel has never released a version that is supposed to work with it.

As such I cannot expect it to work. Kernel 4.14.4 would be a version that should work, for example.

Pauan commented 6 years ago

@coretemp Indeed, I am aware of the risks of using unstable. I was not blaming anyone. And if nobody used unstable, who would find these bugs before they hit stable?

Though I'm a little confused: it seems like my problem is with the kernel (it happens even with X disabled), so what does that have to do with Intel?


I will try out 18.03 (stable) and see if that fixes the problem.

Pauan commented 6 years ago

I just now tested 18.03.132336.ef74cafd3e5 (from https://nixos.org/nixos/download.html), and I get the exact same problem.

coretemp commented 6 years ago

@Pauan I was not saying that you were blaming anyone.

I have seen the same behavior and I use an Intel graphics chip. I only see this behavior with Intel graphics.

If this is a desktop and you are currently using Intel graphics, try buying a cheap passively cooled mass produced commodity AMD card for 50 dollar. It will likely make your issues go away.

I doubt anyone here can mean anything for you, if it really requires Intel to do some work.

I also wasn't really pointing out any risks. I was just stating a fact. It's not that it's unstable, because it's relatively new. It's unstable in that there is no reason at all to expect it to work. I don't know how NixOS's Unstable relates to the unstable in e.g. Debian, but I can imagine there is a reason why Intel publishes combinations of versions forming a functioning graphics stack.

Pauan commented 6 years ago

@coretemp No, your problem is different.

The bug reported in this thread happens even with services.xserver.videoDrivers = [] (and it only happens when shutting down), so it's clearly not related to the Intel video card drivers.

If you are having problems with the Intel video card drivers, you should file a new bug report.

I doubt anyone here can mean anything for you, if it really requires Intel to do some work.

Except we don't even know why this bug is happening. We are currently in the "figure out why the bug is happening" stage, so it's unproductive to immediately blame it on Intel and say that there's nothing we can do.

I don't know how NixOS's Unstable relates to the unstable in e.g. Debian, but I can imagine there is a reason why Intel publishes combinations of versions forming a functioning graphics stack.

NixOS unstable isn't the same as Debian unstable, and in any case the problem happens even with NixOS stable, and in any case the problem is unrelated to Intel.

mcs0042 commented 6 years ago

Just tried installing NixOS yesterday (using 18.03, the version from nixos.org) and I'm running into a similar issue, even when using the default configuration.nix with a few lines uncommented. As above, when I try to shutdown, log out, or reboot, everything freezes and I'm forced to do a hard shutdown. When I start back up, my fan often (but not always) goes into super-high-speed mode. Furthermore, when starting back up, I usually end up in a tty rather than on the login screen, even though I have KDE enabled, but I think this might be a consequence of the hard shutdown.

More specifically,

Please let me know if there's any other information I can provide!

Pauan commented 6 years ago

@AgentChicken Does your computer have an Intel graphics card, or is it Nvidia only?

mcs0042 commented 6 years ago

It has an integrated Intel HD Graphics 630.

mcs0042 commented 6 years ago

At least for me, it would seem that this issue was causing all the shutdown problems.

I switched back to Manjaro a couple of weeks after running into this problem only to run into similar troubles before eventually finding the wiki post. As suggested by this comment, I added acpi_osi=! acpi_osi="Windows 2009" to my kernel parameters (I have a Gigabyte Aero 15, so I thought I should probably try the workaround recommended for the Gigabyte P35V5) and the issue seemed to disappear completely. After a few days of using Manjaro without any issues, I decided to give Nix another go, using the kernel parameter workaround this time. Since installing Nix early this afternoon and changing the parameters, I've not run into any shutdown/reboot/logout issues whatsoever.

I thought I should post this now, in case anyone is looking for a fix. I'll report back in a couple of days, just in case the issue turns out to be something else and the shutdown problems reappear.

matthewbauer commented 6 years ago

Ok that's unfortunate but not something we can easily fix in Nixpkgs. We can leave this open for future users in hopes of finding a solution.

If you do find the right combination of kernel flags that fixes this, I highly encourage you to contribute to https://github.com/NixOS/nixos-hardware so that other users can benefit. Hopefully the Linux kernel people can figure out a fix for this!

pinage404 commented 5 years ago

I had the same annoying issue since few months ago

I have a Gigabyte Sabre 15

Type Hardware in my laptop
CPU 7th Generation Intel® Core™ i7-7700HQ
Video Graphics Intel® HD Graphics 630
Video Graphics NVIDIA® GeForce® GTX 1050 Ti GDDR5 4GB

I added this to my configuration.nix

{
    # ...
    boot.kernelParams = [
        "acpi_osi=! acpi_osi=\"Windows 2009\""
    ];
    # ...
}

And it works ! \o/ (even if i don't understand how and why) Thank you so much

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
pinage404 commented 2 years ago

To upgrade NixOS from 21.05 to 21.11

It seems that we need to change it to (the same but without the space)

{
  # ...
  boot.kernelParams = [
    "acpi_osi=!acpi_osi=\"Windows 2009\""
  ];
  # ...
}
Artturin commented 2 years ago

To upgrade NixOS from 21.05 to 21.11

It seems that we need to change it to (the same but without the space)

{
  # ...
  boot.kernelParams = [
    "acpi_osi=!acpi_osi=\"Windows 2009\""
  ];
  # ...
}

you (probably) want

"acpi_osi=!" "acpi_osi='Windows 2009'"

https://github.com/NixOS/nixpkgs/pull/133625