Open amalgame21 opened 9 months ago
Let's ping the nixos-rebuild package maintainer @Profpatsch.
Is there a particular reason nixos-rebuild.sh only checks for sudo
here?
Sorry I just noticed that the wiki is unofficial.
Encountering the same issue on unstable channel, removing "${maybeSudo[@]}"
or replacing it with doas
causes it to fail with
building the system configuration...
'/nix/store/v4ymdm28ycahb7c6s5jpgaw9jvb23lr3-system-path/bin/busctl --json=short call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager ListUnitsByPatterns asas 0 0' exited with value 1 at /nix/store/656162gvsjii70n248ksg8yxmdh7apaw-nixos-system-hostname-24.05.20231129.e92039b/bin/switch-to-configuration line 145.
warning: error(s) occurred while switching to the new configuration
I ran into the same issue but only because my EFI entries got wiped somehow (no data lost, just EFI entry broke). Turns out (in my case) I could just reinstall the bootloader entries as shown in the wiki: https://nixos.wiki/wiki/Bootloader#From_an_installation_media
If this link is broken in the future, here's the command I ran in a Ubuntu installation USB (after manually mounting system root in /mnt
, along with dev, sys, and proc):
NIXOS_INSTALL_BOOTLOADER=1 chroot /mnt /nix/var/nix/profiles/system/bin/switch-to-configuration boot
I've seen similar issues when sudo won't run correctly due to a misconfiguration of some sort.
I am testing the latest stable NixOS. I followed this guide to use
doas
instead ofsudo
. It works fine.Today I have to use live USB to rescue my OS, because I messed up with the
hardware-configuration.nix
and it was no longer bootable. In the chroot environment after runningnixos-enter
,nixos-rebuild switch
failed to run because it hit this line: https://github.com/NixOS/nixpkgs/blob/08be2ef0bfd785b984bd0fc66d764b153afaf28f/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh#L161And I have to remove the
"${maybeSudo[@]}"
in this line manually to make it run (with some error, but at least it processhardware-configuration.nix
and the OS is bootable again after that). https://github.com/NixOS/nixpkgs/blob/08be2ef0bfd785b984bd0fc66d764b153afaf28f/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh#L189Am I doing something wrong?
By the way, in the doas wiki, The syntax of
security.doas.extraRules = { ... }
is wrong. It should besecurity.doas.extraRules = [{ ... }]
.