chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

commit c15216c3bf801b4cd800c72c2a56341555ba622a
parent 714a61263eeb7f3ea82261918ee0ced26235208c
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Sat, 24 Oct 2026 21:54:58 -0400

blue screen: name what failed from dinit's log, draw it with the chamesle theme when udev is already stopped, keep the console for the command line

Diffstat:
Mtools/initrd/init | 6++++--
Mtools/pkg/chamesle-plymouth/files/usr/lib/chamesle/blue-screen | 22+++++++++++++++++++---
Mtools/pkg/chamesle-plymouth/files/usr/lib/chamesle/init | 5+++--
Mtools/pkg/chamesle-plymouth/recipe | 2+-
4 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/tools/initrd/init b/tools/initrd/init @@ -230,8 +230,10 @@ fi [ "$DEBUG" = 1 ] && emergency "chamesle.debug=1: about to switch root" [ -x "/newroot$INIT" ] || emergency "$INIT not found in the system image" INIT_ARGS= -# dinit starts the blue screen (its recovery service) on its own if the system can't finish starting -[ "$INIT" = /usr/bin/dinit ] && [ -x /newroot/usr/lib/chamesle/blue-screen ] && INIT_ARGS=--auto-recovery +# dinit starts the blue screen (its recovery service) on its own if the system can't finish starting. its log is +# how the blue screen knows what failed +[ "$INIT" = /usr/bin/dinit ] && [ -x /newroot/usr/lib/chamesle/blue-screen ] && + INIT_ARGS="--auto-recovery --log-file /run/dinit.log" [ "$QUIET" = 1 ] && [ "$INIT" = /usr/bin/dinit ] && [ "$DEBUG" = 0 ] && INIT_ARGS="$INIT_ARGS --quiet" [ "$SPLASH" = 1 ] && plymouth update-root-fs --new-root-dir=/newroot udevadm control --exit 2>/dev/null diff --git a/tools/pkg/chamesle-plymouth/files/usr/lib/chamesle/blue-screen b/tools/pkg/chamesle-plymouth/files/usr/lib/chamesle/blue-screen @@ -3,20 +3,36 @@ # service; without a reason it names the services that failed. any key gives a command line (sulogin asks for # root's password, or lets you straight in when root is locked, as it is with sudo) reason=$1 +# what failed, from dinit's log (/usr/lib/chamesle/init keeps one): by now dinit has stopped everything and closed +# its socket, so dinitctl can't say. the services whose own command failed, else the ones that couldn't start +if [ -z "$reason" ] && [ -f /run/dinit.log ]; then + failed=$(sed -n 's/.*[Ss]ervice \([^ ]*\) command failed.*/\1/p' /run/dinit.log | sort -u | tr '\n' ' ') + [ -n "$failed" ] || failed=$(sed -n 's/.*service \([^ ]*\) failed to start.*/\1/p' /run/dinit.log | + grep -vx boot | sort -u | tr '\n' ' ') + [ -n "$failed" ] && reason="What failed: ${failed% }" +fi if [ -z "$reason" ] && command -v dinitctl >/dev/null; then failed=$(dinitctl list 2>/dev/null | sed -n 's/^[[][^]]*X[^]]*[]] *\([^ ]*\).*/\1/p' | tr '\n' ' ') [ -n "$failed" ] && reason="What failed: ${failed% }" fi -# the boot screen may be gone already, it goes when the desktop starts +# the boot screen may be gone already, it goes when the desktop starts. udev has been stopped too, so plymouth +# looks for the screen itself (or it falls back to text), and it needs a moment before it takes messages if ! plymouth --ping 2>/dev/null; then mkdir -p /run/plymouth - plymouthd --mode=boot --tty=/dev/tty1 2>/dev/null && plymouth show-splash + plymouthd --mode=boot --tty=/dev/tty1 --kernel-command-line="$(cat /proc/cmdline) splash plymouth.ignore-udev" \ + 2>/dev/null && plymouth show-splash && sleep 2 fi if plymouth --ping 2>/dev/null; then plymouth display-message --text=chamesle-error [ -n "$reason" ] && plymouth display-message --text="$reason" plymouth watch-keystroke >/dev/null 2>&1 + # all the way gone, or it takes the console with it as sulogin starts plymouth quit + i=0 + while plymouth --ping 2>/dev/null && [ $i -lt 50 ]; do + sleep 0.1 + i=$((i + 1)) + done fi # the same in text, for the command line, or if there's no screen to draw on clear 2>/dev/null @@ -24,7 +40,7 @@ echo echo ":( Chamesle couldn't finish starting." [ -n "$reason" ] && echo " $reason" echo -echo " 'dinitctl list' shows what's running and what failed, logs are in /var/log." +echo " 'dinitctl list' shows what's running and what failed, logs are in /var/log and /run/dinit.log." echo " Typing 'reboot' restarts. In the boot menu you can pick a snapshot from before the last update." echo exec sulogin --force diff --git a/tools/pkg/chamesle-plymouth/files/usr/lib/chamesle/init b/tools/pkg/chamesle-plymouth/files/usr/lib/chamesle/init @@ -1,4 +1,5 @@ #!/bin/sh # dinit, which starts the recovery service (the blue screen) on its own when the system can't finish starting, -# instead of asking on a console that's hidden behind the boot screen. the boot line has init=/usr/lib/chamesle/init -exec /usr/bin/dinit --auto-recovery "$@" +# instead of asking on a console that's hidden behind the boot screen. the boot line has init=/usr/lib/chamesle/init. +# its log is how the blue screen knows what failed +exec /usr/bin/dinit --auto-recovery --log-file /run/dinit.log "$@" diff --git a/tools/pkg/chamesle-plymouth/recipe b/tools/pkg/chamesle-plymouth/recipe @@ -1,6 +1,6 @@ name=chamesle-plymouth version=0.8.0 -rel=0 +rel=1 desc="The Chamesle boot screen: the logo with a spinner under it, and a blue screen when the system can't start" url=https://chamesle.org license=GPL-3.0-or-later