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
norpol
February 23, 2024, 11:22pm
2
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
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
norpol
February 25, 2024, 1:52pm
4
Though if you want to run it a second time you have to vacuum, since bsod will always pick up the newest emergency message.
Is systemd-bsod enabled in NixOS? I cannot seem to check the status of systemd-bsod.service
it’s a stage 1 only thing, and it’s only if you enable boot.initrd.systemd.enable
.