[arch-general] mkinitcpio debugging with systemd

Tobias Hunger tobias.hunger at gmail.com
Wed Sep 24 03:51:49 EDT 2014

Hi Matti,

On Wed, Sep 24, 2014 at 9:20 AM, Martti Kühne <mysatyre at gmail.com> wrote:
> Thanks for the pointer. I just removed the init= setting from
> /etc/default/grub and added the systemd hook to mkinitcpio.conf.
> I generated both the bootloader config and the initcpio.

Yeap, that part works fine for me, too. Make sure to use the "sd-*"
variant of the HOOKS if available. The arch wiki is unfortunately a
bit lacking wrt. mkinitcpio and systemd:-/

It e.g. suggests to add the "base" hook before "systemd", to get a
debug environment... That will indeed install some binaries, but then
the systemd hook will overwrite the init script with systemd and thus
remove the normal options to trigger a debug shell in the initrd.

> However, I still wonder, because my machine boots just fine this way.

So does mine till I start to tinker with it:-)

> Thinking more closely about the issue as you present it, usually, if
> things go wrong in the inticpio stage you get thrown to a shell to fix
> stuff manually.

That is no longer the case once I enable the "systemd" hook (I do have
the "base" hook before the "systemd" one).

> As it does not looks like this seems to be the case,
> your new_root appears to get mounted and the issue appears to be
> somewhere else...

You are correct, but how did you gather that from my original mail? :-)

Systemd claims to have mounted / and /usr. It then proceeds to tear
down services it started as part of the initrd and tries to pivot
root. Everything perfectly normal up to that point.

Then it fails with "/bin/sh not found".

Most likely either / or /usr is not mounted properly. A quick "ls"
should point me into the right direction, but how do I get a debug

> You also did not provide any error message or other
> pointer which would lead us to the source of your problem, and I think
> you should add anything you have (eg. remove the "quiet" boot option).

I have to admit that I did not think about removing "quiet" this
morning:-/ Shame on me.

My question is basically how to get the a debug shell in an initrd
created by mkinitcpio with the "systemd" hook enabled?

The long and involved way is most likely to make sure the
systemd-debug-generator will be added to the initrd by the "systemd"
hook, together with a modified debug-shell.service that actually is
started during the initrd (and not only afterwards).

Then I should be able to enable that debug shell with the kernel
parameters documented for the systemd-debug-generator.

Is there a simpler way, involving less hacking?

Best Regards,

More information about the arch-general mailing list