Repository navigation
Description
Describe the bug
While trying to upgrade the system using nixos-rebuild switch, it crashed/quit the window manager (I'm using Sway) and hang there with a black screen and a white cursor forever. I had to force the machine to shutdown.
After I reboot the machine, when I tried nixos-rebuild switch again, it would just say could not find any previously installed systemd-boot and exit the command, not doing any upgrade at all. I had to manually do sudo bootctl install, as suggested in this discourse topic and reboot the machine several times to finally get rid of this issue and be able to upgrade again.
When I thought the issue went away, a couple of days later, during the process of nixos-rebuild switch, the WM just crashed again and the same thing happened again. Does anyone know what happened or what i did wrong?
I also created a separate discourse topic for this. Based on the replies from other users, this issue happened on KDE Plasma as well.
Steps To Reproduce
Steps to reproduce the behavior:
nixos-rebuild switch- wait til the command finishes
Expected behavior
The command successfully runs and exits, without quitting the desktop environment.
Screenshots
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 5.10.79, NixOS, 21.11 (Porcupine)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.4`
- channels(rollschild): `""`
- channels(root): `"nixos-21.11pre332033.715f6341195, nixpkgs-21.11pre293858.141b2b111d7"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
UPDATE:
There's a similar issue but I don't think it's the same exact issue because in my case there weren't any errors. Sway just automatically quit and all I saw was a black screen with a white cursor.

Activity
nixos-discourse commentedon Nov 20, 2021
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/nixos-rebuild-switch-crashes-wm-de/16127/8
kurnevsky commentedon Nov 20, 2021
Something similar happened to me couple of times with xmonad, when a lot of packages were rebuilt. But it didn't hang the system, just exited my X11 and gave me the terminal (probably because I use xinit).
primeos commentedon Nov 20, 2021
I can confirm that part. Sway didn't technically crash (at least in my case) but I kinda got thrown back to the tty/VT and had to kill Sway via Ctrl+C. Really sucks... Likely another case of a komplex NixOS / activation script change that got merged without a proper review. It first happened to me during this week (I didn't update for a while) and I'll try to trace it down during the weekend (was already on my TODO list).
Might be something like #141192 (could be completely unrelated but I immediately disliked what I saw there tbh).
mohe2015 commentedon Nov 20, 2021
While I can understand your frustration I think you could've phrased that a bit nicer.
primeos commentedon Nov 20, 2021
Well, tbh that was already the heavily filtered and nice version (apart from the
immediately disliked what I saw there, that could come off the wrong way, I mainly meant that such a complex change got merged very quickly and with few reviews even though it was problematic before and might be controversial in the first place - and I'm complaining about the process, not individuals).I'm just very frustrated (to put it mildly) because this stuff happens again and again (at least just once or twice per year, but still..) and I often have to deal with it...
Artturin commentedon Nov 22, 2021
Made this pr for an unrelated issue but could someone test if it helps #146964
systemd.additionalUpstreamSystemUnits = [ "dbus-org.freedesktop.login1.service" ];dschrempf commentedon Nov 24, 2021
Just to mention: This also happens with X11 and XMonad when using the provided NixOS services.
SFrijters commentedon Nov 24, 2021
Seeing the same thing with X11+Openbox. I've updated my system to include #146964 but I think it's only clear if this works if a subsequent update would trigger a restart of the problem units, right?
rollschild commentedon Nov 24, 2021
The tricky part of this issue is that I was able to upgrade without quitting Sway and I thought the issue was resolved (although at the end of the text outputs of
nixos-rebuild switchit still saidcould not find any previously installed systemd-boot). But a couple of days later when I tried upgrading again this issue resurfaced. Let me try to upgrade a couple more times and if this issue doesn't show up again I can close this.Artturin commentedon Nov 24, 2021
Please send logs from journalctl
journalctl -b -1can be used to see the previous bootstarcraft66 commentedon Nov 25, 2021
Just wanted to chime in and say I've experienced this numerous times on X11 using i3. The only way to rebuild properly is doing it from a tty.
Artturin commentedon Nov 25, 2021
Logs?
ncfavier commentedon Nov 25, 2021
I think this might be related to #140046
flokli commentedon Nov 25, 2021
There's two issues intertwined here. One is restarting too many graphical-related services (probably introduced by #141192), the other one was a too strict regex when detecting bootloaders (which was fixed with #140046).
Revert "Merge pull request NixOS#141192 from helsinki-systems/feat/im…
primeos commentedon Nov 27, 2021
I finally had time to look at this and it is indeed caused by #141192 as I feared. I recommend to revert it ASAP: #147609
dasJ commentedon Nov 27, 2021
As author of the breaking PR I'm really sorry that this happened and I understand the frustration. Of course I'm not against reverting this PR if it breaks people's systems but if it isn't reverted this weekend I'll take some time during this weekend and try to reproduce and fix the mentioned issues. Again, I'm not saying people should just live with their broken systems until I find some magic solution so if it's coming to a revert I'll live with rebuilding an improved PR.
One thing that should be considered if this is reverted is whether to revert it on both master and 21.11 or just on 21.11 (people just seemed to have lived with the issues on unstable). Again, I'm not telling anyone what to do here, just adding this to consider.
Revert "Merge pull request #141192 from helsinki-systems/feat/improve…
primeos commentedon Nov 27, 2021
Thanks! I'm really frustrated by this kind of issue (it's currently my main frustration with NixOS but luckily such regressions are very rare - although not rare enough) but of course my frustration is not with you. There where a lot of things that went wrong here (no VM test that could've catched it, not enough reviews, too quickly merged, to few bug reports/complaints, etc.) and I hope that we can improve the process over time (I'll try to help with that as good as I can - e.g. I hope that I'll have time soon to write a VM test that could catch this issue before it hits a channel: #146809 - also huge thanks to @Artturin for #147272 which seems like a good idea in general).
I'm definitely also for reverting it ASAP, especially with the NixOS 21.11 release imminent. Huge thanks to @nrdxp for sharing that opinion.
That's something I find really strange... No idea why there where so few reports :o (maybe it doesn't affect KDE/Gnome (as much), people didn't want to open a bug report without additional information, or most did indeed just live with it).
One request: Please ping me for a review. Thanks :)
(One unfortunate issue with the last PR was that it wasn't mentioned in #74899 so I only got the notification when the issue was closed by merging the PR (#74899 (comment)). I should've still added a comment and tested it but I was very low on time and hoped that it'd be fine this time.)
mohe2015 commentedon Nov 27, 2021
I'm in that part of people.
evils commentedon Nov 28, 2021
FWIW
i experienced this issue on 2021-11-03 (on sway) and didn't report it
i assumed it was a one-off (something i think may not be worth avoiding on nixos-unstable)
an incorrect conclusion that was re-enforced by me only getting a third occurrence on sway yesterday
even though the issue did occur on every new
switchon my laptop running i3 (which i only use occasionally (probably spanning changes that trigger this issue)),i assumed that was an adequately different system that the issue wasn't related
and X based stuff is common enough that i thought someone would be on it
i'm definitely going to be more likely to report this kind of stuff in the future
especially when we're approaching a release branch-off
though lack of know-how on collecting data about such a crash definitely held me back from filling in the bug report issue template as well
("it crashed" doesn't feel like an actionable report to me, especially in this case as running
switchimmediately after, doesn't cause the issue again)i felt obliged to investigate before reporting, but since i had no idea what could have caused it, didn't want to spend a lot of time on this, and assumed someone more familiar with the matter would catch it
dasJ commentedon Nov 28, 2021
One thing I am wondering is what the exact conditions are to trigger this issue. We've been running this change on close to 70 different system configurations deployed to a couple of hundred devices that are headless, using i3, or a full KDE environment and nothing ever happened. I'm not saying these problem's don't exist, I'm just curious why they show up. Does anyone have the
switch-to-configurationoutput for an affected system? If not there's not really a lot I can do because I am unable to reproduce this.Edit the systemd-logind assumption from discourse seems to be wrong. When I change my logind unit, no logind and hence no i3 is restarted:
primeos commentedon Nov 28, 2021
The relevant socket units have to change between the old and new revision / NixOS generation.
Strange. Was that on
nixos-unstableand two Nixpkgs revisions that differ significantly enough so that many units get restarted?TODO: I'll have to grab my logs later and put them into a Gist.Update: Here are my personal logs from testing on a secondary system with Sway: https://gist.github.com/primeos/604b516a843dfcadc2e816b02a271e7e (only
BAD-REVISION-1 -> GOOD-REVISION-1was fine)The following additional units got:
dbus.service', 'systemd-journald.service', 'wpa_supplicant.service'cups.socket', 'dbus.socket', 'fstrim.timer', 'libvirtd-admin.socket', 'libvirtd-ro.socket', 'libvirtd.socket', 'nix-daemon.socket', 'pcscd.socket', 'systemd-coredump.socket', 'systemd-journald-audit.socket', 'systemd-journald-dev-log.socket', 'systemd-journald.socket', 'systemd-rfkill.socket', 'systemd-tmpfiles-clean.timer', 'systemd-udevd-control.socket', 'systemd-udevd-kernel.socket', 'virtlockd.socket', 'virtlogd.socket'**Edit: I expected more but if my allowlist changes are correct it might just be due to
dbus.service(I'm quite surprised that only dbus, systemd-journald, and wpa_supplicant were restarted).Should at least be consistently reproducible with Sway.
Not sure if there's just one or multiple causes but I've seen e.g. D-Bus restarted which seems very problematic to me.
PS: Sorry if my replies are a bit direct, I just have to keep it short due to time constraints.
Edit: I've also got the following at the end of
nixos-rebuild switch:Revert "Merge pull request NixOS#141192 from helsinki-systems/feat/im…