Unable to run sudo nixos-rebuild switch: "returned non-zero exit status 203."

I recently installed installed NixOS 26.05

I had to suddenly shutdown my computer while sudo nixos-rebuild switch –upgrade. When booting to complete the command, I’m now met with the following output:

Command 'systemd-run -E LOCALE_ARCHIVE -E NIXOS_INSTALL_BOOTLOADER -E NIXOS_NO_CHECK --collect --no-ask-password --pipe --quiet --service-type=exec --unit=nixos-rebuild-switch-to-configuration /nix/store/3anjdskhwgar6aimj8qi633y76f8p7m0-nixos-system-nixos-26.05.7813.0dd31db7e6db/bin/switch-to-configuration switch' returned non-zero exit status 203.

What can I do to fix this?

I’ve tried sudo nixos-rebuild switch --repair but to not avail.

Okay, I ran sudo nixos-rebuild switch --repair for the second or third time, and that seemed to fix it.

1 Like

Yep, that’s mostly all you can do, short of wiping the store entirely and reinstalling. There’s also --check-contents as per nix-store --verify - Nix 2.35.2 Reference Manual which will take additional time but is more thorough.

1 Like