Skip to content

Commit

Permalink
05core: print warnings to secondary consoles
Browse files Browse the repository at this point in the history
This allows us to print the helpful messages that we have added
for our users before they enter dracut's emergency shell to all
configured consoles on the machine.

Closes coreos/fedora-coreos-tracker#954
  • Loading branch information
dustymabe committed Jun 2, 2022
1 parent 835fde8 commit b847a21
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ EOF
echo "Displaying logs from failed units: ${failed}"
for unit in ${failed}; do
# 10 lines should be enough for everyone
journalctl -b --no-pager --no-hostname -u ${unit} -n 10
SYSTEMD_COLORS=true journalctl -b --no-pager --no-hostname -u ${unit} -n 10
done
fi
fi
}

# If we're invoked from a dracut breakpoint rather than
# dracut-emergency.service, we won't have a controlling terminal and stdio
# won't be connected to it. Explicitly read/write /dev/console.
_display_relevant_errors < /dev/console > /dev/console
# Print warnings/informational messages to all configued consoles on the
# machine. Code inspired by https://github.com/dracutdevs/dracut/commit/32f68c1
MESSAGE="$(_display_relevant_errors)"
while read -r _tty rest; do
echo -e "$MESSAGE" > /dev/"$_tty"
done < /proc/consoles

0 comments on commit b847a21

Please sign in to comment.