Install not working on fresh Ubuntu 20.04 machine

I have found that the nix installer is no longer working on Ubuntu 20.04.6 LTS, x86_64-linux. In particular, on a fresh install/VM I’m running:

curl -L https://releases.nixos.org/nix/nix-2.16.1/install > /tmp/install-nix.sh
yes | sh /tmp/install-nix.sh --daemon
. "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
nix-shell

The install proceeds without issue but I’m seeing a failure attempting to run nix-shell, or any other nix-* command for that matter,

cs-tze7x4cv-light-gpu-homedir-721859% nix-shell     
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted

The closest issue I can find is error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted · Issue #3435 · NixOS/nix · GitHub, but I have not been able to get any of the workarounds presented therein to work. The issue also appears to have lost traction.

Why am I getting this error? How can I install nix?

Not sure what’s going on, but I don’t think there’s any intrinsic break on Nix’s end. I was able to install it in GA on 20.04, at least: try new nix on oldbuntu · abathur/nix@d4c0a61 · GitHub

Update: started a fresh VM and tried again! Now I’m able to run nix-shell, but

cs-tze7x4cv-light-gpu-homedir-780599% nix-env -iA cachix -f https://cachix.org/api/v1/install
installing 'cachix-1.6'
error: opening lock file '/nix/var/nix/profiles/per-user/sam.ainsworth/profile.lock': No such file or directory

Am I missing something?

Hmm. Maybe this is Per-user profiles not created when $HOME mounted on NFS · Issue #3356 · NixOS/nix · GitHub?

Ah that may be it! I am not mounting $HOME via NFS, but it is mounted from a separate (virtual) disk. Could that be related?

I ended up getting the install to work with the workarounds Per-user profiles not created when $HOME mounted on NFS · Issue #3356 · NixOS/nix · GitHub and error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted · Issue #3435 · NixOS/nix · GitHub.