This incorprates the debug-shell functionality directly into the
initramfs, so it's no longer necessary to build and boot a custom
initramfs in order to debug your device.
Additionally, the behaviour of the debug-shell is entirely reworked, It
now creates an ACM serial gadget which can be accessed via any normal
terminal emulator (picocom, minicom, etc; or PuTTY on windows). Rather
than just invoking sh, the debug-shell now creates a respawning getty on
both the new virtual console and the active console (this will either be
the UART console or tty0/1).
It is necessary to spawn these shells via getty since the logging rework
means we can no longer assume that stdin/out/err reference a TTY.
In addition to the above, it is now possible to trigger a log dump by
holding volume up during boot. This can be useful for helping users
debug their devices if the issue doesn't result in a failure that can be
detected in the initramfs.
With these changes, the console-shell and debug-shell hook packages are
reduced to only adding the additional tools/features. console-shell is
still required for fbkeyboard, and debug-shell for the setup_usb_storage
tool.
Co-Developed-by: Clayton Craft <craftyguy@postmarketos.org>
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
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>
Some change (I think some tools switching from the coreutils to busybox
versions?) subtly broke debug-shell behaviour. Try to fix it.
Signed-off-by: Caleb Connolly <caleb@connolly.tech>
[ci:skip-build]: already built successfully in CI
With the recent changes in commit 80fff9242, there's no longer an $IP
variable we can use. Use the same code as in init_functions.sh to get
the potentially customized IP address to use for telnet.
Since we've now finally removed telnetd from the main initramfs but we
still need telnetd for the debug-shell, add it to the files for that
hook.
Also make sure the list of files is sorted.
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.
The show_splash function called by the 20-debug-shell.sh script already
skips fbsplash when the device is configured to not use the framebuffer.
But the variable was not defined in the script. This is solved by
including the /etc/deviceinfo file.
Follow-up to !108, where this change got lost in the rebase.
* Travis and Coveralls badges
* aports: instead of <https://github.com/postmarketOS>, use
<https://postmarketos.org>
* References to full URLs to issues and pull requests replaced with
a hash and the number
* grsec check: simplify error message, remove link to github issue
(nobody is using that anymore anyway)
* Changed usb-shell behavior, it wait for some user action before continue booting
* Rename usb-shell to debug-shell and changed port to 23
* Add `20-debug-shell.sh` script to static code analysis
* Enable eth0 interface in initramfs (qemu)
* Add additional script to run a shell in order to be able to kill it from a telnet session