published on
tags: linux systemd

Forcing systemd initramfs to boot into recovery shell

I have been trying to debug an initramfs hook that I wrote, which wasnt doing what I wanted it to (namely it did literally nothing at all). Some debugging was in order. I wanted get into the initramfs image environment and see what was going on and what assumptions I have made that turned out to be incorrect.

However, I am using a systemd based initramfs image so the usual break[=<premount|postmount> or the legacy break=y wont work. Instead I had to add a systemd specific kernel parameter:

systemd.unit=emergency.target

Now I need to figure out how to get it to boot into a shell like before mounting root (like break=premount does).