Triggering systemd-bsod manually

With Systemd v255, a new systemd-bsod service was introduced, displaying a simplified error message upon emergencies in the early boot. The service seems to be included by default in the initrd when boot.systemd.initrd is enabled.

For testing purposes and out of curiosity, I want to see that service in action. How would I do that? I tried triggering a kernel panic using sysrq but nothing happened :frowning:

Good question, I’ve just asked myself the same, with the same result when triggering a panic via sysrq.

GitHub - FlyTechVideos/systemd-bsod-playground demonstrates how to trigger it.

Running these commands will show a blue error message, with a QR code containing the same text.

I couldn’t figure out a way to trigger it without rotating/vacuuming the journal unfortunately.

sudo journalctl --user --flush --rotate --vacuum-time=1s
sudo systemd-cat -p emerg echo "My bsod error message"
sudo "$(readlink -f "$(which systemctl)" | cut -d/ -f-4)/lib/systemd/systemd-bsod"

Looking further into the linked repo, it appears you can “style” the bsod error page to be also red.

sudo journalctl --user --flush --rotate --vacuum-time=1s
sudo systemd-cat -p emerg echo "$(printf %b '\e[41m' '\e[8]' '\e[H\e[J')my error message"
sudo "$(readlink -f "$(which systemctl)" | cut -d/ -f-4)/lib/systemd/systemd-bsod"

Thanks a lot. It worked :smiley:

Apparently you can use the -c flag for systemd-bsod and start it
before writing the emergency message to avoid vacuuming your journal.

1 Like

Though if you want to run it a second time you have to vacuum, since bsod will always pick up the newest emergency message.