Skip to content

Commit

Permalink
move question on rechecking binary cache to a Nix recipe (#808)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
wamirez and fricklerhandwerk authored Nov 30, 2023
1 parent 7cf19ec commit 6946cb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
15 changes: 0 additions & 15 deletions source/guides/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
15 changes: 12 additions & 3 deletions source/guides/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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).

Expand All @@ -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.

Expand Down

0 comments on commit 6946cb0

Please sign in to comment.