Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty manifest.json in profiles #10641

Open
jheidbrink opened this issue May 3, 2024 · 2 comments
Open

Empty manifest.json in profiles #10641

jheidbrink opened this issue May 3, 2024 · 2 comments
Labels

Comments

@jheidbrink
Copy link

jheidbrink commented May 3, 2024

Describe the bug

I'm using home-manager modules from within my configuration.nix. When running nixos-rebuild switch, activating the home-manager environments fails for my two users. When investigating the issue, I found that /nix/var/nix/profiles/per-user/<user>/profile/manifest.json is an empty file for both users. Older profiles are ok.

I cannot use the nix profile command to remove the broken profile, because

nix profile remove 0
error: [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal

Steps To Reproduce

I don't know how to reproduce this. I have experienced system crashes recently, but given that the profiles are in the Nix store, my assumption is that they are built somewhat atomically and hope that system crashes don't lead to half-built derivations in the store.

nix-env --version output

nix-env (Nix) 2.18.1

Additional context

I have opened an issue in home-manager about this: nix-community/home-manager#5348 - but I guess home-manager simply uses nix profile, so it's probably better located here.

It seems people encountered empty manifest.json before:

#4742
NixOS/nixpkgs#18279
https://discourse.nixos.org/t/home-manager-stopped-working-on-my-non-nixos/6023

Priorities

Add 👍 to issues you find important.

@jheidbrink jheidbrink added the bug label May 3, 2024
@edolstra
Copy link
Member

edolstra commented May 3, 2024

Nix doesn't fsync changes to the Nix store by default (see the option sync-before-registering). So in case of a system crash, manifest.json can show up as a zero-byte file. You can check for this kind of corruption by doing nix store verify -v ~/.nix-profile.

@jheidbrink
Copy link
Author

Thanks! verify -v ~/.nix-profile actually confirmed a corrupt store path. Nice to learn about the sync-before-registering, I'll try this! As far as I understand it, with that option set to false, the possiblity of this kind of corruption is expected and not a bug, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants