Nixos-switch rebuild quite long to run restarting sysinit-reactivation.target

When I run nixos-rebuild switch without anything new, it takes like 4s to start printing setting up /etc (so to finish building)… but then it takes 1mn40s just to run restarting sysinit-reactivation.target:

$ time sudo nixos-rebuild switch
warning: Git tree '/etc/nixos' is dirty
building the system configuration...
warning: Git tree '/etc/nixos' is dirty
activating the configuration...
setting up /etc...
reloading user units for leo...
restarting sysinit-reactivation.target
sudo nixos-rebuild switch  0,01s user 0,01s system 0% cpu 1:40,76 total

This is a really long time for not much, which is annoyingly long when we need to apply many changes to our configuration sequentially.

Is it normal? Why is it taking so long? It seems like it would be more efficient to just reboot to apply the changes :stuck_out_tongue: Is there any plan to make this faster somehow?

6 Likes

Same problem. The transaction was much faster just several months ago. I personally uninstalled NixOS then, and now can’t find what happened during that interval.

1 Like

Tried to report in sysinit-reactivation.target takes ages on `nixos rebuild` · Issue #313696 · NixOS/nixpkgs · GitHub

Hello, I’ve had the same problem and fixed it.
Apperently I had an error in my hardware-configuration.nix.
You can regenerate it with the nixos-generate-config command.

Same issue, it takes around 1:47 total for me now when it used to be 0:07 total or less.

edit: for me the issue was related to “virtualisation.virtualbox.guest.enable = true”
After removing that from my config things went back to normal

1 Like