···11+# Boot Problems {#sec-boot-problems}
22+33+If NixOS fails to boot, there are a number of kernel command line parameters that may help you to identify or fix the issue. You can add these parameters in the GRUB boot menu by pressing “e” to modify the selected boot entry and editing the line starting with `linux`. The following are some useful kernel command line parameters that are recognised by the NixOS boot scripts or by systemd:
44+55+`boot.shell_on_fail`
66+77+: Allows the user to start a root shell if something goes wrong in stage 1 of the boot process (the initial ramdisk). This is disabled by default because there is no authentication for the root shell.
88+99+`boot.debug1`
1010+1111+: Start an interactive shell in stage 1 before anything useful has been done. That is, no modules have been loaded and no file systems have been mounted, except for `/proc` and `/sys`.
1212+1313+`boot.debug1devices`
1414+1515+: Like `boot.debug1`, but runs stage1 until kernel modules are loaded and device nodes are created. This may help with e.g. making the keyboard work.
1616+1717+`boot.debug1mounts`
1818+1919+: Like `boot.debug1` or `boot.debug1devices`, but runs stage1 until all filesystems that are mounted during initrd are mounted (see [neededForBoot](#opt-fileSystems._name_.neededForBoot)). As a motivating example, this could be useful if you've forgotten to set [neededForBoot](options.html#opt-fileSystems._name_.neededForBoot) on a file system.
2020+2121+`boot.trace`
2222+2323+: Print every shell command executed by the stage 1 and 2 boot scripts.
2424+2525+`single`
2626+2727+: Boot into rescue mode (a.k.a. single user mode). This will cause systemd to start nothing but the unit `rescue.target`, which runs `sulogin` to prompt for the root password and start a root login shell. Exiting the shell causes the system to continue with the normal boot process.
2828+2929+`systemd.log_level=debug` `systemd.log_target=console`
3030+3131+: Make systemd very verbose and send log messages to the console instead of the journal. For more parameters recognised by systemd, see systemd(1).
3232+3333+Notice that for `boot.shell_on_fail`, `boot.debug1`, `boot.debug1devices`, and `boot.debug1mounts`, if you did **not** select "start the new shell as pid 1", and you `exit` from the new shell, boot will proceed normally from the point where it failed, as if you'd chosen "ignore the error and continue".
3434+3535+If no login prompts or X11 login screens appear (e.g. due to hanging dependencies), you can press Alt+ArrowUp. If you’re lucky, this will start rescue mode (described above). (Also note that since most units have a 90-second timeout before systemd gives up on them, the `agetty` login prompts should appear eventually unless something is very wrong.)
-126
nixos/doc/manual/administration/boot-problems.xml
···11-<section xmlns="http://docbook.org/ns/docbook"
22- xmlns:xlink="http://www.w3.org/1999/xlink"
33- xmlns:xi="http://www.w3.org/2001/XInclude"
44- version="5.0"
55- xml:id="sec-boot-problems">
66- <title>Boot Problems</title>
77-88- <para>
99- If NixOS fails to boot, there are a number of kernel command line parameters
1010- that may help you to identify or fix the issue. You can add these parameters
1111- in the GRUB boot menu by pressing “e” to modify the selected boot entry
1212- and editing the line starting with <literal>linux</literal>. The following
1313- are some useful kernel command line parameters that are recognised by the
1414- NixOS boot scripts or by systemd:
1515- <variablelist>
1616- <varlistentry>
1717- <term>
1818- <literal>boot.shell_on_fail</literal>
1919- </term>
2020- <listitem>
2121- <para>
2222- Allows the user to start a root shell if something goes wrong in stage 1
2323- of the boot process (the initial ramdisk). This is disabled by default
2424- because there is no authentication for the root shell.
2525- </para>
2626- </listitem>
2727- </varlistentry>
2828- <varlistentry>
2929- <term>
3030- <literal>boot.debug1</literal>
3131- </term>
3232- <listitem>
3333- <para>
3434- Start an interactive shell in stage 1 before anything useful has been
3535- done. That is, no modules have been loaded and no file systems have been
3636- mounted, except for <filename>/proc</filename> and
3737- <filename>/sys</filename>.
3838- </para>
3939- </listitem>
4040- </varlistentry>
4141- <varlistentry>
4242- <term>
4343- <literal>boot.debug1devices</literal>
4444- </term>
4545- <listitem>
4646- <para>
4747- Like <literal>boot.debug1</literal>, but runs stage1 until kernel modules are loaded and device nodes are created.
4848- This may help with e.g. making the keyboard work.
4949- </para>
5050- </listitem>
5151- </varlistentry>
5252- <varlistentry>
5353- <term>
5454- <literal>boot.debug1mounts</literal>
5555- </term>
5656- <listitem>
5757- <para>
5858- Like <literal>boot.debug1</literal> or
5959- <literal>boot.debug1devices</literal>, but runs stage1 until all
6060- filesystems that are mounted during initrd are mounted (see
6161- <option><link linkend="opt-fileSystems._name_.neededForBoot">neededForBoot</link></option>
6262- ). As a motivating example, this could be useful if you've forgotten to set
6363- <option><link linkend="opt-fileSystems._name_.neededForBoot">neededForBoot</link></option>
6464- on a file system.
6565- </para>
6666- </listitem>
6767- </varlistentry>
6868- <varlistentry>
6969- <term>
7070- <literal>boot.trace</literal>
7171- </term>
7272- <listitem>
7373- <para>
7474- Print every shell command executed by the stage 1 and 2 boot scripts.
7575- </para>
7676- </listitem>
7777- </varlistentry>
7878- <varlistentry>
7979- <term>
8080- <literal>single</literal>
8181- </term>
8282- <listitem>
8383- <para>
8484- Boot into rescue mode (a.k.a. single user mode). This will cause systemd
8585- to start nothing but the unit <literal>rescue.target</literal>, which
8686- runs <command>sulogin</command> to prompt for the root password and start
8787- a root login shell. Exiting the shell causes the system to continue with
8888- the normal boot process.
8989- </para>
9090- </listitem>
9191- </varlistentry>
9292- <varlistentry>
9393- <term>
9494- <literal>systemd.log_level=debug systemd.log_target=console</literal>
9595- </term>
9696- <listitem>
9797- <para>
9898- Make systemd very verbose and send log messages to the console instead of
9999- the journal.
100100- </para>
101101- </listitem>
102102- </varlistentry>
103103- </variablelist>
104104- For more parameters recognised by systemd, see <citerefentry>
105105- <refentrytitle>systemd</refentrytitle>
106106- <manvolnum>1</manvolnum></citerefentry>.
107107- </para>
108108-109109- <para>
110110- Notice that for <literal>boot.shell_on_fail</literal>,
111111- <literal>boot.debug1</literal>, <literal>boot.debug1devices</literal>, and
112112- <literal>boot.debug1mounts</literal>, if you did <emphasis>not</emphasis>
113113- select "start the new shell as pid 1", and you <literal>exit</literal> from
114114- the new shell, boot will proceed normally from the point where it failed, as
115115- if you'd chosen "ignore the error and continue".
116116- </para>
117117-118118- <para>
119119- If no login prompts or X11 login screens appear (e.g. due to hanging
120120- dependencies), you can press Alt+ArrowUp. If you’re lucky, this will start
121121- rescue mode (described above). (Also note that since most units have a
122122- 90-second timeout before systemd gives up on them, the
123123- <command>agetty</command> login prompts should appear eventually unless
124124- something is very wrong.)
125125- </para>
126126-</section>
···11+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-boot-problems">
22+ <title>Boot Problems</title>
33+ <para>
44+ If NixOS fails to boot, there are a number of kernel command line
55+ parameters that may help you to identify or fix the issue. You can
66+ add these parameters in the GRUB boot menu by pressing
77+ <quote>e</quote> to modify the selected boot entry and editing the
88+ line starting with <literal>linux</literal>. The following are some
99+ useful kernel command line parameters that are recognised by the
1010+ NixOS boot scripts or by systemd:
1111+ </para>
1212+ <variablelist>
1313+ <varlistentry>
1414+ <term>
1515+ <literal>boot.shell_on_fail</literal>
1616+ </term>
1717+ <listitem>
1818+ <para>
1919+ Allows the user to start a root shell if something goes wrong
2020+ in stage 1 of the boot process (the initial ramdisk). This is
2121+ disabled by default because there is no authentication for the
2222+ root shell.
2323+ </para>
2424+ </listitem>
2525+ </varlistentry>
2626+ <varlistentry>
2727+ <term>
2828+ <literal>boot.debug1</literal>
2929+ </term>
3030+ <listitem>
3131+ <para>
3232+ Start an interactive shell in stage 1 before anything useful
3333+ has been done. That is, no modules have been loaded and no
3434+ file systems have been mounted, except for
3535+ <literal>/proc</literal> and <literal>/sys</literal>.
3636+ </para>
3737+ </listitem>
3838+ </varlistentry>
3939+ <varlistentry>
4040+ <term>
4141+ <literal>boot.debug1devices</literal>
4242+ </term>
4343+ <listitem>
4444+ <para>
4545+ Like <literal>boot.debug1</literal>, but runs stage1 until
4646+ kernel modules are loaded and device nodes are created. This
4747+ may help with e.g. making the keyboard work.
4848+ </para>
4949+ </listitem>
5050+ </varlistentry>
5151+ <varlistentry>
5252+ <term>
5353+ <literal>boot.debug1mounts</literal>
5454+ </term>
5555+ <listitem>
5656+ <para>
5757+ Like <literal>boot.debug1</literal> or
5858+ <literal>boot.debug1devices</literal>, but runs stage1 until
5959+ all filesystems that are mounted during initrd are mounted
6060+ (see
6161+ <link linkend="opt-fileSystems._name_.neededForBoot">neededForBoot</link>).
6262+ As a motivating example, this could be useful if you’ve
6363+ forgotten to set
6464+ <link xlink:href="options.html#opt-fileSystems._name_.neededForBoot">neededForBoot</link>
6565+ on a file system.
6666+ </para>
6767+ </listitem>
6868+ </varlistentry>
6969+ <varlistentry>
7070+ <term>
7171+ <literal>boot.trace</literal>
7272+ </term>
7373+ <listitem>
7474+ <para>
7575+ Print every shell command executed by the stage 1 and 2 boot
7676+ scripts.
7777+ </para>
7878+ </listitem>
7979+ </varlistentry>
8080+ <varlistentry>
8181+ <term>
8282+ <literal>single</literal>
8383+ </term>
8484+ <listitem>
8585+ <para>
8686+ Boot into rescue mode (a.k.a. single user mode). This will
8787+ cause systemd to start nothing but the unit
8888+ <literal>rescue.target</literal>, which runs
8989+ <literal>sulogin</literal> to prompt for the root password and
9090+ start a root login shell. Exiting the shell causes the system
9191+ to continue with the normal boot process.
9292+ </para>
9393+ </listitem>
9494+ </varlistentry>
9595+ <varlistentry>
9696+ <term>
9797+ <literal>systemd.log_level=debug</literal>
9898+ <literal>systemd.log_target=console</literal>
9999+ </term>
100100+ <listitem>
101101+ <para>
102102+ Make systemd very verbose and send log messages to the console
103103+ instead of the journal. For more parameters recognised by
104104+ systemd, see systemd(1).
105105+ </para>
106106+ </listitem>
107107+ </varlistentry>
108108+ </variablelist>
109109+ <para>
110110+ Notice that for <literal>boot.shell_on_fail</literal>,
111111+ <literal>boot.debug1</literal>,
112112+ <literal>boot.debug1devices</literal>, and
113113+ <literal>boot.debug1mounts</literal>, if you did
114114+ <emphasis role="strong">not</emphasis> select <quote>start the new
115115+ shell as pid 1</quote>, and you <literal>exit</literal> from the new
116116+ shell, boot will proceed normally from the point where it failed, as
117117+ if you’d chosen <quote>ignore the error and continue</quote>.
118118+ </para>
119119+ <para>
120120+ If no login prompts or X11 login screens appear (e.g. due to hanging
121121+ dependencies), you can press Alt+ArrowUp. If you’re lucky, this will
122122+ start rescue mode (described above). (Also note that since most
123123+ units have a 90-second timeout before systemd gives up on them, the
124124+ <literal>agetty</literal> login prompts should appear eventually
125125+ unless something is very wrong.)
126126+ </para>
127127+</section>