From 6946cb0e2ee8e4d6378fc8af82b9fd0cde1aa79b Mon Sep 17 00:00:00 2001 From: Daniel R Date: Thu, 30 Nov 2023 11:41:18 -0400 Subject: [PATCH] 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 --- source/guides/faq.md | 15 --------------- source/guides/troubleshooting.md | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/source/guides/faq.md b/source/guides/faq.md index 1991b64..c543b5c 100644 --- a/source/guides/faq.md +++ b/source/guides/faq.md @@ -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 diff --git a/source/guides/troubleshooting.md b/source/guides/troubleshooting.md index 35170fc..3261f62 100644 --- a/source/guides/troubleshooting.md +++ b/source/guides/troubleshooting.md @@ -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.