1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 21:11:34 +03:00
mobile-nixos/doc/in-depth/stage-1.adoc
Samuel Dionne-Riel 00f81fa95c boot/init: Handle hung tasks
The way we're handling them is to have a global timer that is reset at
any point a task is ran.

This gives a maximum amount of chances to any task to have its
dependencies resolve.

A minimum of 60s is given, but in reality the chances are the conditions
for trying to resolve were already present before the timeout started
counting towards that particular dependency.

Note that a long running task, when successfully ran, does not cause the
timeout to be reached.

E.g. at 10s of timeout a task is started, the loop is not executed until
the task exits. When it exits the branch followed is for a task that
ran, which means that even if the task took 70s total (which gives us 80
seconds) a timeout of 60s wouldn't apply here.

Though, please, don't make your tasks take that much time to run!
2020-11-07 20:13:31 -05:00

29 lines
1.2 KiB
Plaintext

= Notes about `stage-1`
include::_support/common.inc[]
== What is stage-1?
This is what is also referred as `initrd`, or `initramfs`. `stage-1` refers to
the fact that this is the first part of the system that gets run once the kernel
has been started.
== About "sad phone" screens
It may happen that you have a "sad phone" screen when booting.
This means that a fatal error has happened.
When there is no screen logging available for the device, the general case of
error has been codified as a background color.
* Yellow (`0xFFFF00`) means that mounting the root filesystem was not possible.
* Fuchsia (`0xFF00FF`) means that mounting succeeded, but no compatible generation was found to boot.
* Black (`0x000000`) means a dependency hung boot
* Red (`0xFF0000`) means that executing (`exec`) and switching to the found generation's init failed.
* Brown (`0x95681C`) means an uncontrolled abort happened.
It may happen that the boot seemingly or actually hangs before a "sad phone"
screen appears. In those instances, it means something else earlier kept the
early init scripts to continue. In the future, better logging and status
reporting will be added to keep track of early failures.