Currently, when postmarketOS fails to boot up, retrieving any
information necessary to root cause the issue is non-trivial, requiring
building a custom initramfs with debug-shell enabled and then manually
copying out data.
Let's improve the situation by exporting logs automatically on boot
failure. This is safer than just exposing a root shell but still
provides a whole lot of useful info that should make duplicating and
triaging issues much easier for developers.
This commit implements the functionality and includes some generally
useful data. We then generate a README and expose files for each command/log
as well as an archive that can be easily attached to a GitLab issue.
To help with triaging, also record the version of the postmarketos-initramfs
package and hash the init.sh and init_functions.sh files.
For testing purposes, you can trigger the log recovery mode on-time by
creating an empty file named ".pmos_export_logs" in the /boot partition.
Signed-off-by: Caleb Connolly <caleb@connolly.tech>
With the recent changes in commit 80fff9242, it's possible that the
client IP address is customized. Use the same code as in
init_functions.sh to get the this potentially customized IP address to
use for the nbd-client.
[ci:skip-build]: already built successfully in CI
Since the original "Loading..." splash is being shown before the hooks
is being run, we should go back to the "Loading..." splash once we're
done in the hook.
[ci:skip-build]: already built successfully in CI