Since a couple of days I noticed that the “running activation script” startup stage takes more and more times. Today it took 5 minutes at least, which is huge. It also happens when I switch configuration via
nixos-rebuild switch. I don’t know why that’s happening. I don’t know how to fix this, I don’t even know how to start to investigate, and I don’t really want to restart my computer since it seems to be getting worst…
Does it also occur when you
nixos-rebuild switch to the same configuration?
Is it because a systemd service startup time? You could investigate with
systemctl list-units during the switch.
Thanks for your help
I didn’t know about
systemd-analyze and here is the result:
Startup finished in 12.949s (firmware) + 2.450s (loader) + 16min 50.232s (kernel) + 12.730s (userspace) = 17min 18.362s
This is awful…
It seems to be a kernel problem, nothing to do with any unit…
While doing a
nixos-rebuild switch, there is one thing that takes a lot of time and CPU (100% of one core): It’s Perl running some script named
update-users-groups with some json file (which I suppose describes my users/groups configuration). I think that’s the problem.
Why is it so slow and CPU consuming?
Turns out this Perl script starts by decoding what should be a JSON file named
/var/lib/nixos/uid-map. For unknown reason, on my computer, this file seems to just contain more than 3GB of pure garbage. How did that happened? I don’t know but this quest is starting to be fun.
Garbage starts just before writing an accent in my username (I accidentally used non ascii characters in my username in my configuration file a while ago). So I guess its basically the same issue as this: uid-map gets corrupted by Unicode usernames · Issue #80426 · NixOS/nixpkgs · GitHub
Removing the file
/var/lib/nixos/uid-map and making sure that you don’t put non ascii characters in usernames should solve the issue.
hmm, this is an unfortunate bug