Skip to content

postmarketos-initramfs: export logs on boot failure

Administrator requested to merge log-recovery into master

Current situation

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.

This MR

Let's improve things by exporting logs automatically on boot failure. This is safer than just exposing a root shell, and enables us to properly triage issues.

Initially grab some potentially useful data, generate a README and expose the individual command outputs as well as concatenating them into a bit file for easier uploading to the issue tracker.

To help with triaging, we'll also record the version of the postmarketos-initramfs package and hash the init.sh and init_functions.sh files, as well as the FDT (devicetree) blob if the system is booted with DT.

When boot fails, if mass storage gadget is available, then a device called PMOS_LOGS will appear on the host machine with the following layout:

-rw-r--r-- 1 cas cas   7359 Jan  1  1980 blkid.txt
-rw-r--r-- 1 cas cas    404 Jan  1  1980 cmdline.txt
-rw-r--r-- 1 cas cas  34786 Jan  1  1980 dmesg.txt
-rw-r--r-- 1 cas cas 110067 Jan  1  1980 fdt.dtb
-rw-r--r-- 1 cas cas    191 Jan  1  1980 _info
-rw-r--r-- 1 cas cas   3324 Jan  1  1980 partitions.txt
-rw-r--r-- 1 cas cas   1215 Jan  1  1980 pmOS_init.txt
-rw-r--r-- 1 cas cas    401 Jan  1  1980 README.txt
-rw-r--r-- 1 cas cas  36402 Jan  1  1980 shift-axolotl-edge-6.7.0-rc5-sdm845-00149-g1a73fc7098fa-dirty.tar.xz

Example README.txt:

Something went wrong and your device did not boot properly. If this was unexpected
then please open a new issue by visiting

https://gitlab.com/postmarketOS/pmaports/-/issues/new

and attach the following file by dragging it onto the page:

* shift-axolotl-edge-6.7.0-rc5-sdm845-00149-g1a73fc7098fa-dirty.tar.xz

You are running postmarketOS edge on kernel 6.7.0-rc5-sdm845-00149-g1a73fc7098fa-dirty.

I've attached an example log file below.

shift-axolotl-edge-6.7.0-rc5-sdm845-00149-g1a73fc7098fa-dirty.tar.gz

TODO:

  • Update the troubleshooting wiki page to document reporting boot bugs right at the top (this is the page we point to when folks have issues booting and currently it has nearly no useful info)
Edited by Administrator

Merge request reports

Loading