1
0
Fork 0
mirror of https://github.com/NixOS/nix.dev.git synced 2024-10-18 00:06:26 -04:00

move question on rechecking binary cache to a Nix recipe (#808)

* mv question -f faqs -t nix-recipes

* add nix-recipes to page index and fix hierarchy

* change question to statement

* rephrase a few sentences and add links

* move the question to troubleshooting

* fix broken link

---------

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
This commit is contained in:
Daniel R 2023-11-30 11:41:18 -04:00 committed by GitHub
parent 7cf19eced1
commit 6946cb0e2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 18 deletions

View file

@ -29,21 +29,6 @@ $ echo "trusted-binary-caches = https://cache.nixos.org" >> /etc/nix/nix.conf
$ nix-build helpers/bench.nix --option extra-binary-caches https://cache.nixos.org
```
### How do I force nix to re-check whether something exists at a binary cache?
Nix caches the contents of binary caches so that it doesn't have to query them
on every command. This includes negative answers (cache doesn't have something).
The default timeout for that is 1 hour as of writing.
To wipe all cache-lookup-caches:
```shell-session
$ rm $HOME/.cache/nix/binary-cache-v*.sqlite*
```
Alternatively, use the `narinfo-cache-negative-ttl` option to reduce the
cache timeout.
### How to operate between Nix paths and strings?
See <http://stackoverflow.com/a/43850372>

View file

@ -1,10 +1,19 @@
# Troubleshooting
This page is a collection of tips to solve problems you may encounter using Nix.
## What to do if a binary cache is down or unreachable?
Pass [`--option substitute false`](https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-substitute) to Nix commands.
### How to fix: `error: querying path in database: database disk image is malformed`
## How to force Nix to re-check if something exists in the binary cache?
Nix keeps track of what's available in binary caches so it doesn't have to query them on every command.
This includes negative answers, that is, if a given store path cannot substituted.
Pass the [`--narinfo-cache-negative-ttl`](https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-narinfo-cache-negative-ttl) option to set the cache timeout in seconds.
## How to fix: `error: querying path in database: database disk image is malformed`
This is a [known issue](https://github.com/NixOS/nix/issues/1353).
Try:
@ -21,7 +30,7 @@ $ mv /nix/var/nix/db/db.sqlite /nix/var/nix/db/db.sqlite-bkp
$ sqlite3 /nix/var/nix/db/db.sqlite-bkp ".dump" | sqlite3 /nix/var/nix/db/db.sqlite
```
### How to fix: `error: current Nix store schema is version 10, but I only support 7`
## How to fix: `error: current Nix store schema is version 10, but I only support 7`
This is a [known issue](https://github.com/NixOS/nix/issues/1251).
@ -37,7 +46,7 @@ $ nix-store --init # this is the old nix-store
$ nix-store --load-db < /tmp/db.dump
```
### How to fix: `writing to file: Connection reset by peer`
## How to fix: `writing to file: Connection reset by peer`
This may mean you are trying to import a too large file or directory into the [Nix store](https://nixos.org/manual/nix/stable/glossary#gloss-store), or your machine is running out of resources, such as disk space or memory.