Got NixOS up and running, and logged in and tried to update a channel I added, but I’m getting an error about …/per-user/root/channels “does not exist” and have no idea how to get this corrected. Its the first thing I’ve tried to do after finishing the install.
Details in the screenshot attached, because I can’t get VirtualBox to obey its bidirectional cut 'n paste so I can’t get data out the VM…
The warning can be ignored.
The error looks like your per-user profile is owned by someone other than yourself. I’m guessing it’s owned by root. You’ll presumably need to
sudo chown -R rayascott /nix/var/nix/profiles/per-user/rayascott.
Thanks for your help. That’s fixed it. Is it normal for root to own the entire /nix tree in a NixOS install? The reason I ask is because I installed NixOS using the lustrate method, so I followed those installation instructions which includes this…
- Change ownership of the
/nix tree to root (since your Nix install was probably single user):
$ sudo chown -R 0.0 /nix
… which I assume is what’s caused this problem.
Manually changing ownership of the entire /nix tree isn’t part of the type NixOS install (that I can find).
I don’t know what the lustrate method is. Typically for a single-user install your user account owns
/nix, and for a multi-user install
root will own most of
/nix, except the
/nix/var/nix/profiles/per-user folders are owned by each user in question.
/nix/var/nix/profiles/per-user itself is world-writable and sticky.
Which is to say, chowning the entire
/nix tree to
root should work if you haven’t created any per-user profiles yet, but if you have it will break those users.
Thanks very much for the explanation. So now I know why it happened. The lustrate install method is the swapping out of an existing Linux instance with a NixOS installation.
lustrate - “purify by expiatory sacrifice, ceremonial washing, or some other ritual action.”