at 23.05-pre 1.7 kB view raw
1<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-rollback"> 2 <title>Rolling Back Configuration Changes</title> 3 <para> 4 After running <literal>nixos-rebuild</literal> to switch to a new 5 configuration, you may find that the new configuration doesn’t work 6 very well. In that case, there are several ways to return to a 7 previous configuration. 8 </para> 9 <para> 10 First, the GRUB boot manager allows you to boot into any previous 11 configuration that hasn’t been garbage-collected. These 12 configurations can be found under the GRUB submenu <quote>NixOS - 13 All configurations</quote>. This is especially useful if the new 14 configuration fails to boot. After the system has booted, you can 15 make the selected configuration the default for subsequent boots: 16 </para> 17 <programlisting> 18# /run/current-system/bin/switch-to-configuration boot 19</programlisting> 20 <para> 21 Second, you can switch to the previous configuration in a running 22 system: 23 </para> 24 <programlisting> 25# nixos-rebuild switch --rollback 26</programlisting> 27 <para> 28 This is equivalent to running: 29 </para> 30 <programlisting> 31# /nix/var/nix/profiles/system-N-link/bin/switch-to-configuration switch 32</programlisting> 33 <para> 34 where <literal>N</literal> is the number of the NixOS system 35 configuration. To get a list of the available configurations, do: 36 </para> 37 <programlisting> 38$ ls -l /nix/var/nix/profiles/system-*-link 39... 40lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link -&gt; /nix/store/202b...-nixos-13.07pre4932_5a676e4-4be1055 41</programlisting> 42</section>