I find myself trying to recover from a bootloader install gone sideways and can boot recovery media I have on hand (very old 18.09) but the system I’m trying to recover is 20.09. I know I can just do a reinstall after mounting the disks but am unsure if this will take me back to the old release and require another update or if it will use the channels as defined in the disk install. I’d rather know before I do anything potentially destructive just to save some time.
I could be wrong, but I think this is what nixos-enter is for. It allows you to chroot into your existing system. From there you should be able to fix your configuration.nix up and re-run nixos-rebuild.
Your installation media should come with it. So just boot up, mount your existing partition to /mnt and run nixos-enter.
I tried that but kept having problems with the nix store being read only. Is there a way to use nixos-enter and have a writable nix store? I probably missed something obvious.
On my system (pretty fresh, just reinstalled today) the directories inside of /nix/store are read only. I think that’s by design.
When is it complaining about being read only?
I was trying to do a nix-channel --update and got that error. I did manage to get updated boot media so this is now academic for me. If I’m in this situation again I could try a build without any updates and see if the read only store is not an issue (I expect it to be).
Did the updated media help?
Just to give you something to contrast, here are the permissions on my /nix/store directory itself.
It looks like the directory itself is writable on a new system, but the contents for the most part are read only.
Yep, updated media let me just do nixos-install without nixos-enter. I’d have to see why nixos-enter with similar permissions to yours doesn’t like to do a nix-channel --update.