diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2021-09-07 06:20:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-07 06:20:47 +0100 |
commit | 5de68de484a67e3e7db053c67721c3fc66af793e (patch) | |
tree | ef0b8ba407880ee7d6bfb9def259aaca5bbf205d /nixos/doc/manual/administration | |
parent | 2a55504a99ed3d82d08d6cdc382190deb4036902 (diff) | |
parent | 828474abfb4ccd324c1fce3da5f7b0ff454bb21e (diff) |
Merge pull request #128935 from bobby285271/pr7
nixos/doc: convert "Chapter 56. Troubleshooting" to CommonMark
Diffstat (limited to 'nixos/doc/manual/administration')
9 files changed, 102 insertions, 124 deletions
diff --git a/nixos/doc/manual/administration/maintenance-mode.section.md b/nixos/doc/manual/administration/maintenance-mode.section.md new file mode 100644 index 0000000000000..0aec013c0a9b1 --- /dev/null +++ b/nixos/doc/manual/administration/maintenance-mode.section.md @@ -0,0 +1,11 @@ +# Maintenance Mode {#sec-maintenance-mode} + +You can enter rescue mode by running: + +```ShellSession +# systemctl rescue +``` + +This will eventually give you a single-user root shell. Systemd will +stop (almost) all system services. To get out of maintenance mode, just +exit from the rescue shell. diff --git a/nixos/doc/manual/administration/maintenance-mode.xml b/nixos/doc/manual/administration/maintenance-mode.xml deleted file mode 100644 index 74abfdd7c6634..0000000000000 --- a/nixos/doc/manual/administration/maintenance-mode.xml +++ /dev/null @@ -1,16 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - version="5.0" - xml:id="sec-maintenance-mode"> - <title>Maintenance Mode</title> - - <para> - You can enter rescue mode by running: -<screen> -<prompt># </prompt>systemctl rescue</screen> - This will eventually give you a single-user root shell. Systemd will stop - (almost) all system services. To get out of maintenance mode, just exit from - the rescue shell. - </para> -</section> diff --git a/nixos/doc/manual/administration/network-problems.section.md b/nixos/doc/manual/administration/network-problems.section.md new file mode 100644 index 0000000000000..d360120d72d03 --- /dev/null +++ b/nixos/doc/manual/administration/network-problems.section.md @@ -0,0 +1,21 @@ +# Network Problems {#sec-nix-network-issues} + +Nix uses a so-called *binary cache* to optimise building a package from +source into downloading it as a pre-built binary. That is, whenever a +command like `nixos-rebuild` needs a path in the Nix store, Nix will try +to download that path from the Internet rather than build it from +source. The default binary cache is `https://cache.nixos.org/`. If this +cache is unreachable, Nix operations may take a long time due to HTTP +connection timeouts. You can disable the use of the binary cache by +adding `--option use-binary-caches false`, e.g. + +```ShellSession +# nixos-rebuild switch --option use-binary-caches false +``` + +If you have an alternative binary cache at your disposal, you can use it +instead: + +```ShellSession +# nixos-rebuild switch --option binary-caches http://my-cache.example.org/ +``` diff --git a/nixos/doc/manual/administration/network-problems.xml b/nixos/doc/manual/administration/network-problems.xml deleted file mode 100644 index 1035e4e056a94..0000000000000 --- a/nixos/doc/manual/administration/network-problems.xml +++ /dev/null @@ -1,27 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - version="5.0" - xml:id="sec-nix-network-issues"> - <title>Network Problems</title> - - <para> - Nix uses a so-called <emphasis>binary cache</emphasis> to optimise building a - package from source into downloading it as a pre-built binary. That is, - whenever a command like <command>nixos-rebuild</command> needs a path in the - Nix store, Nix will try to download that path from the Internet rather than - build it from source. The default binary cache is - <uri>https://cache.nixos.org/</uri>. If this cache is unreachable, Nix - operations may take a long time due to HTTP connection timeouts. You can - disable the use of the binary cache by adding <option>--option - use-binary-caches false</option>, e.g. -<screen> -<prompt># </prompt>nixos-rebuild switch --option use-binary-caches false -</screen> - If you have an alternative binary cache at your disposal, you can use it - instead: -<screen> -<prompt># </prompt>nixos-rebuild switch --option binary-caches <replaceable>http://my-cache.example.org/</replaceable> -</screen> - </para> -</section> diff --git a/nixos/doc/manual/administration/rollback.section.md b/nixos/doc/manual/administration/rollback.section.md new file mode 100644 index 0000000000000..290d685a2a18d --- /dev/null +++ b/nixos/doc/manual/administration/rollback.section.md @@ -0,0 +1,38 @@ +# Rolling Back Configuration Changes {#sec-rollback} + +After running `nixos-rebuild` to switch to a new configuration, you may +find that the new configuration doesn't work very well. In that case, +there are several ways to return to a previous configuration. + +First, the GRUB boot manager allows you to boot into any previous +configuration that hasn't been garbage-collected. These configurations +can be found under the GRUB submenu "NixOS - All configurations". This +is especially useful if the new configuration fails to boot. After the +system has booted, you can make the selected configuration the default +for subsequent boots: + +```ShellSession +# /run/current-system/bin/switch-to-configuration boot +``` + +Second, you can switch to the previous configuration in a running +system: + +```ShellSession +# nixos-rebuild switch --rollback +``` + +This is equivalent to running: + +```ShellSession +# /nix/var/nix/profiles/system-N-link/bin/switch-to-configuration switch +``` + +where `N` is the number of the NixOS system configuration. To get a +list of the available configurations, do: + +```ShellSession +$ ls -l /nix/var/nix/profiles/system-*-link +... +lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link -> /nix/store/202b...-nixos-13.07pre4932_5a676e4-4be1055 +``` diff --git a/nixos/doc/manual/administration/rollback.xml b/nixos/doc/manual/administration/rollback.xml deleted file mode 100644 index 80d79e1a53f15..0000000000000 --- a/nixos/doc/manual/administration/rollback.xml +++ /dev/null @@ -1,41 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - version="5.0" - xml:id="sec-rollback"> - <title>Rolling Back Configuration Changes</title> - - <para> - After running <command>nixos-rebuild</command> to switch to a new - configuration, you may find that the new configuration doesn’t work very - well. In that case, there are several ways to return to a previous - configuration. - </para> - - <para> - First, the GRUB boot manager allows you to boot into any previous - configuration that hasn’t been garbage-collected. These configurations can - be found under the GRUB submenu “NixOS - All configurations”. This is - especially useful if the new configuration fails to boot. After the system - has booted, you can make the selected configuration the default for - subsequent boots: -<screen> -<prompt># </prompt>/run/current-system/bin/switch-to-configuration boot</screen> - </para> - - <para> - Second, you can switch to the previous configuration in a running system: -<screen> -<prompt># </prompt>nixos-rebuild switch --rollback</screen> - This is equivalent to running: -<screen> -<prompt># </prompt>/nix/var/nix/profiles/system-<replaceable>N</replaceable>-link/bin/switch-to-configuration switch</screen> - where <replaceable>N</replaceable> is the number of the NixOS system - configuration. To get a list of the available configurations, do: -<screen> -<prompt>$ </prompt>ls -l /nix/var/nix/profiles/system-*-link -<replaceable>...</replaceable> -lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link -> /nix/store/202b...-nixos-13.07pre4932_5a676e4-4be1055 -</screen> - </para> -</section> diff --git a/nixos/doc/manual/administration/store-corruption.section.md b/nixos/doc/manual/administration/store-corruption.section.md new file mode 100644 index 0000000000000..bd8a5772b37c6 --- /dev/null +++ b/nixos/doc/manual/administration/store-corruption.section.md @@ -0,0 +1,28 @@ +# Nix Store Corruption {#sec-nix-store-corruption} + +After a system crash, it's possible for files in the Nix store to become +corrupted. (For instance, the Ext4 file system has the tendency to +replace un-synced files with zero bytes.) NixOS tries hard to prevent +this from happening: it performs a `sync` before switching to a new +configuration, and Nix's database is fully transactional. If corruption +still occurs, you may be able to fix it automatically. + +If the corruption is in a path in the closure of the NixOS system +configuration, you can fix it by doing + +```ShellSession +# nixos-rebuild switch --repair +``` + +This will cause Nix to check every path in the closure, and if its +cryptographic hash differs from the hash recorded in Nix's database, the +path is rebuilt or redownloaded. + +You can also scan the entire Nix store for corrupt paths: + +```ShellSession +# nix-store --verify --check-contents --repair +``` + +Any corrupt paths will be redownloaded if they're available in a binary +cache; otherwise, they cannot be repaired. diff --git a/nixos/doc/manual/administration/store-corruption.xml b/nixos/doc/manual/administration/store-corruption.xml deleted file mode 100644 index b9d11152d5e13..0000000000000 --- a/nixos/doc/manual/administration/store-corruption.xml +++ /dev/null @@ -1,36 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - version="5.0" - xml:id="sec-nix-store-corruption"> - <title>Nix Store Corruption</title> - - <para> - After a system crash, it’s possible for files in the Nix store to become - corrupted. (For instance, the Ext4 file system has the tendency to replace - un-synced files with zero bytes.) NixOS tries hard to prevent this from - happening: it performs a <command>sync</command> before switching to a new - configuration, and Nix’s database is fully transactional. If corruption - still occurs, you may be able to fix it automatically. - </para> - - <para> - If the corruption is in a path in the closure of the NixOS system - configuration, you can fix it by doing -<screen> -<prompt># </prompt>nixos-rebuild switch --repair -</screen> - This will cause Nix to check every path in the closure, and if its - cryptographic hash differs from the hash recorded in Nix’s database, the - path is rebuilt or redownloaded. - </para> - - <para> - You can also scan the entire Nix store for corrupt paths: -<screen> -<prompt># </prompt>nix-store --verify --check-contents --repair -</screen> - Any corrupt paths will be redownloaded if they’re available in a binary - cache; otherwise, they cannot be repaired. - </para> -</section> diff --git a/nixos/doc/manual/administration/troubleshooting.xml b/nixos/doc/manual/administration/troubleshooting.xml index b055acadacf3c..d447b537335bf 100644 --- a/nixos/doc/manual/administration/troubleshooting.xml +++ b/nixos/doc/manual/administration/troubleshooting.xml @@ -9,8 +9,8 @@ you manage your NixOS system. </para> <xi:include href="../from_md/administration/boot-problems.section.xml" /> - <xi:include href="maintenance-mode.xml" /> - <xi:include href="rollback.xml" /> - <xi:include href="store-corruption.xml" /> - <xi:include href="network-problems.xml" /> + <xi:include href="../from_md/administration/maintenance-mode.section.xml" /> + <xi:include href="../from_md/administration/rollback.section.xml" /> + <xi:include href="../from_md/administration/store-corruption.section.xml" /> + <xi:include href="../from_md/administration/network-problems.section.xml" /> </chapter> |