You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a niche situation, but it's possible to run into.
If running switch-to-configuration.pl on activation fails, the profile remains active. This is broken behavior in the vanilla nixos-rebuild as well that got copied over one-to-one when doing the initial write in Zig.
This has the potential to lead to a situation where the only generation that remains on a machine is a broken generation that has not been applied yet, and a subsequent reboot will lead to an unusable system with no generation to rollback to.
This can be a rather serious issue due to no space on an EFI partition when copying the kernel there (which is required when using ZFS encryption or LUKS, as a common example).
As an example, when I was adding sops-nix to my configuration, I attempted to set my user passwords with it. I did this incorrectly at first, but did not know because I had to clean all my generations first before activation due to the aforementioned space issue. I cleaned all the generations, since this was a normal issue, and ended up not being able to sudo due to the password hash being incorrectly set. This made switching generations impossible, since that requires root access. Rebooting only made this worse, due to even login now being impossible because of incorrectly set password hashes. I had to run nixos install from an external live USB with a former working config to get things working again.
How To Reproduce
Attempt to apply a broken configuration (aka switch-to-configuration.pl fails to run)
Clean all generations using sudo nix-collect-garbage -d or nixos generation delete --all
The only remaining generation is the broken one, despite not being activated. Rollback is now impossible.
Expected Behavior
Rollback should have been possible; instead of a failed switch-to-configuration.pl leaving the broken active profile in place, the active profile should be rolled back to the previous working one.
Make sure this will also be handled upon SIGTERM and forceful cancellations. This has not yet been done at the time of writing, will update when that is the case.
What Happened?
This is more of a niche situation, but it's possible to run into.
If running
switch-to-configuration.pl
on activation fails, the profile remains active. This is broken behavior in the vanillanixos-rebuild
as well that got copied over one-to-one when doing the initial write in Zig.This has the potential to lead to a situation where the only generation that remains on a machine is a broken generation that has not been applied yet, and a subsequent reboot will lead to an unusable system with no generation to rollback to.
This can be a rather serious issue due to no space on an EFI partition when copying the kernel there (which is required when using ZFS encryption or LUKS, as a common example).
As an example, when I was adding
sops-nix
to my configuration, I attempted to set my user passwords with it. I did this incorrectly at first, but did not know because I had to clean all my generations first before activation due to the aforementioned space issue. I cleaned all the generations, since this was a normal issue, and ended up not being able tosudo
due to the password hash being incorrectly set. This made switching generations impossible, since that requires root access. Rebooting only made this worse, due to even login now being impossible because of incorrectly set password hashes. I had to runnixos install
from an external live USB with a former working config to get things working again.How To Reproduce
switch-to-configuration.pl
fails to run)sudo nix-collect-garbage -d
ornixos generation delete --all
Expected Behavior
Rollback should have been possible; instead of a failed
switch-to-configuration.pl
leaving the broken active profile in place, the active profile should be rolled back to the previous working one.Features
nixos 0.12.0-dev git rev: 2d44c5c8a077f778b96fd1f213611786144d9a72 zig version: 0.13.0 optimisation mode: ReleaseSafe Compilation Options ------------------- flake :: true nixpkgs_version :: 24.05
The text was updated successfully, but these errors were encountered: