Nix store corrupted #137

Closed
opened 2022-05-16 18:18:33 +00:00 by a · 9 comments
Owner

Something seems to be wrong with our /nix since the following command errors out:

nix-collect-garbage -d
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: reading symlink: File name too long

I've already tried sudo nix-store --verify --check-contents --repair to fix it, didn't work.

Something seems to be wrong with our `/nix` since the following command errors out: ``` nix-collect-garbage -d finding garbage collector roots... 0 store paths deleted, 0.00 MiB freed error: reading symlink: File name too long ``` I've already tried `sudo nix-store --verify --check-contents --repair` to fix it, didn't work.
a added the
bug
label 2022-05-16 18:18:33 +00:00
a added this to the (deleted) project 2022-05-16 18:18:33 +00:00
Author
Owner

This is probably a bad idea, but...

sudo rm -rf /nix/store

Let's give it a try!

This is probably a bad idea, but... ``` sudo rm -rf /nix/store ``` Let's give it a try!
Author
Owner

Didn't fix the issue

Didn't fix the issue
Author
Owner

I think that just made everything worse since now the Nix store is not only corrupted, but also deleted.

I think that just made everything worse since now the Nix store is not only corrupted, but also deleted.
a started working 2022-05-16 18:58:36 +00:00
Author
Owner

I think the safest thing to do here is uninstall and reinstall Nix, unfortunately.

I think the safest thing to do here is uninstall and reinstall Nix, unfortunately.
Author
Owner

That didn't work either, for some VERY strange reason.

However, I installed Nix on a brand new system and it didn't have this bug, so I'm not sure what's going on.

That didn't work either, for some VERY strange reason. However, I installed Nix on a brand new system and it didn't have this bug, so I'm not sure what's going on.
Author
Owner

Finally fixed this with some help from the Nix Matrix chat:

5/16/2022, 2:27:55 PM - ᠎: I'm using Nix on Arch Linux and currently when I run `nix-store --gc --print-roots`, I get the error `error: reading symlink: File name too long`. Running the command with more verbosity `-vvvvv` doesn't print anything more.
5/16/2022, 2:28:27 PM - K900 (bcachefs when): How did you install it?
5/16/2022, 2:28:35 PM - K900 (bcachefs when): That sounds like you have a symlink loop somewhere
5/16/2022, 2:28:38 PM - ᠎: Using the `nix` package in the official Arch repos
5/16/2022, 2:28:47 PM - ᠎: <@k900:0upti.me "That sounds like you have a syml..."> How can I find the symlink loop?
5/16/2022, 2:29:02 PM - K900 (bcachefs when): You could try running it under strace
5/16/2022, 2:29:10 PM - K900 (bcachefs when): It'll probably be easy to see in the output
5/16/2022, 2:30:23 PM - slabity: `find` should also print an error like "Too many levels of symbolic links"
5/16/2022, 2:31:05 PM - slabity: If you use `-follow` flag
5/16/2022, 2:38:35 PM - ᠎: <@k900:0upti.me "You could try running it under s..."> Hmmm, I tried strace but I can't find anything helpful in the [output](https://paste.tildeverse.org/?ad33e9da5166efe9#CrkvD621c2pG7nx3kZvtuCMzsoDnhb7akqVp8zrDoyc9)
5/16/2022, 2:38:53 PM - aszlig left the room: Replaced by new connection
5/16/2022, 2:38:54 PM - aszlig joined the room
5/16/2022, 2:38:57 PM - K900 (bcachefs when): You have a multi-user setup, so you need to strace the nix-daemon
5/16/2022, 2:39:03 PM - K900 (bcachefs when): Not nix-store itself
5/16/2022, 2:44:19 PM - ᠎: OK, I tried attaching strace to the nix-daemon process and [this](https://paste.tildeverse.org/?58e9a8bf8c642a73#Es12pyCDzSbKz3N1eK2PhzZkbPJney4FufT1a4Xb53s3) was the output.
5/16/2022, 2:45:12 PM - K900 (bcachefs when): You also want to attach with `-f`, so you get the child processes
5/16/2022, 2:46:31 PM - aktaboot: ```
error: failed to extract archive (Write failed)

       … while fetching the input 'github:NixOS/nixpkgs/nixpkgs-unstable'

how can i debug this ?
5/16/2022, 2:46:44 PM - K900 (bcachefs when): There should be more context
5/16/2022, 2:46:49 PM - K900 (bcachefs when): Maybe you're out of disk space?
5/16/2022, 2:47:09 PM - aktaboot: hm could be
5/16/2022, 2:47:56 PM - ᠎: <@k900:0upti.me "You also want to attach with `-f..."> Alright, I think I found the issue:

sudo strace -p 1472619 -f &| grep LONG
[pid 1476702] readlink("/proc/825383/cwd", 0x7ffc8b7556c0, 64) = -1 ENAMETOOLONG (File name too long)

Thanks for the help!
5/16/2022, 2:48:37 PM - aktaboot: <@k900:0upti.me "Maybe you're out of disk space?"> are you a wizard ?
5/16/2022, 2:48:52 PM - K900 (bcachefs when): No, but you were complaining about disk space last night
5/16/2022, 2:49:13 PM - zonnebloem: :)
5/16/2022, 2:52:46 PM - aktaboot: but what is weird is that it does that with nix search, ig it cant even fetch a repo index or smth

Finally fixed this with some help from the Nix Matrix chat: ``` 5/16/2022, 2:27:55 PM - ᠎: I'm using Nix on Arch Linux and currently when I run `nix-store --gc --print-roots`, I get the error `error: reading symlink: File name too long`. Running the command with more verbosity `-vvvvv` doesn't print anything more. 5/16/2022, 2:28:27 PM - K900 (bcachefs when): How did you install it? 5/16/2022, 2:28:35 PM - K900 (bcachefs when): That sounds like you have a symlink loop somewhere 5/16/2022, 2:28:38 PM - ᠎: Using the `nix` package in the official Arch repos 5/16/2022, 2:28:47 PM - ᠎: <@k900:0upti.me "That sounds like you have a syml..."> How can I find the symlink loop? 5/16/2022, 2:29:02 PM - K900 (bcachefs when): You could try running it under strace 5/16/2022, 2:29:10 PM - K900 (bcachefs when): It'll probably be easy to see in the output 5/16/2022, 2:30:23 PM - slabity: `find` should also print an error like "Too many levels of symbolic links" 5/16/2022, 2:31:05 PM - slabity: If you use `-follow` flag 5/16/2022, 2:38:35 PM - ᠎: <@k900:0upti.me "You could try running it under s..."> Hmmm, I tried strace but I can't find anything helpful in the [output](https://paste.tildeverse.org/?ad33e9da5166efe9#CrkvD621c2pG7nx3kZvtuCMzsoDnhb7akqVp8zrDoyc9) 5/16/2022, 2:38:53 PM - aszlig left the room: Replaced by new connection 5/16/2022, 2:38:54 PM - aszlig joined the room 5/16/2022, 2:38:57 PM - K900 (bcachefs when): You have a multi-user setup, so you need to strace the nix-daemon 5/16/2022, 2:39:03 PM - K900 (bcachefs when): Not nix-store itself 5/16/2022, 2:44:19 PM - ᠎: OK, I tried attaching strace to the nix-daemon process and [this](https://paste.tildeverse.org/?58e9a8bf8c642a73#Es12pyCDzSbKz3N1eK2PhzZkbPJney4FufT1a4Xb53s3) was the output. 5/16/2022, 2:45:12 PM - K900 (bcachefs when): You also want to attach with `-f`, so you get the child processes 5/16/2022, 2:46:31 PM - aktaboot: ``` error: failed to extract archive (Write failed) … while fetching the input 'github:NixOS/nixpkgs/nixpkgs-unstable' ``` how can i debug this ? 5/16/2022, 2:46:44 PM - K900 (bcachefs when): There should be more context 5/16/2022, 2:46:49 PM - K900 (bcachefs when): Maybe you're out of disk space? 5/16/2022, 2:47:09 PM - aktaboot: hm could be 5/16/2022, 2:47:56 PM - ᠎: <@k900:0upti.me "You also want to attach with `-f..."> Alright, I think I found the issue: ``` sudo strace -p 1472619 -f &| grep LONG [pid 1476702] readlink("/proc/825383/cwd", 0x7ffc8b7556c0, 64) = -1 ENAMETOOLONG (File name too long) ``` Thanks for the help! 5/16/2022, 2:48:37 PM - aktaboot: <@k900:0upti.me "Maybe you're out of disk space?"> are you a wizard ? 5/16/2022, 2:48:52 PM - K900 (bcachefs when): No, but you were complaining about disk space last night 5/16/2022, 2:49:13 PM - zonnebloem: :) 5/16/2022, 2:52:46 PM - aktaboot: but what is weird is that it does that with nix search, ig it cant even fetch a repo index or smth ```
Author
Owner

I think it was because @notaiden and I were testing very long file paths and deep directories for no good reason and it ended up breaking Nix somehow :/

I think it was because @notaiden and I were testing very long file paths and deep directories for no good reason and it ended up breaking Nix somehow :/
a closed this issue 2022-05-16 19:57:23 +00:00
a stopped working 2022-05-16 19:57:23 +00:00
58 minutes 47 seconds
Owner

lmao sorry

lmao sorry
Author
Owner

No worries, fixing this issue taught me quite a bit about Nix!

No worries, fixing this issue taught me quite a bit about Nix!
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Total time spent: 58 minutes 47 seconds
a
58 minutes 47 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: exozyme/exozyme#137
No description provided.