Mic92 / nixos-shell

Spawns lightweight nixos vms in a shell
MIT License
685 stars 39 forks source link

Failing with current unstable #57

Closed viraptor closed 1 year ago

viraptor commented 2 years ago

When running nixos-shell with -I nixpkgs=channel:nixos-unstable to get access to packages not available yet in a release, I get a failure to create users:

/nix/store/jrnaxgnf7kskxjb0xilcz42jv86ai8vs-nixos-vm
running activation script...
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "\x{0}\x{0}\x{0}\x{0}...") at /nix/store/sr09hv1nv3ikc7qbnhrgbrcyjjxn8j25-update-users-groups.pl line 10.
Activation script snippet 'users' failed (2)
setting up /etc...
chown: invalid user: 'root:root'
Activation script snippet 'var' failed (1)
chown: invalid user: 'root:root'
chown: invalid user: 'root:messagebus'
chown: invalid user: 'root:root'
chown: invalid user: 'root:root'
...

This results in not being able to log in as root either.

Mic92 commented 2 years ago

What nixpkgs are you using? nix-instantiate -I nixpkgs=channel:nixos-unstable --json --eval --expr "with import <nixpkgs> {}; lib.version"

Mic92 commented 2 years ago
./bin/nixos-shell -I nixpkgs=channel:nixos-unstable ./examples/vm.nix

still works fine here. Try deleting nixos.qcow2 in the same directory. It might be a corruption of your nix user json database. It seems to contain only null bytes.

dit7ya commented 2 years ago

I was having the same problem. Deleting nixos.qcow2 solved the problem.