]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: Check if any init exists before switching root
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 May 2023 11:48:25 +0000 (13:48 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 12 May 2023 05:48:50 +0000 (07:48 +0200)
commitaaa27e2e21c04339914f26b7125789087eb51166
treef4d5db8b319865c2765eb1ad7d7d4ad37915d143
parent3f92250f4c10a723693b734b803c98f3b0d53f3e
core: Check if any init exists before switching root

If we switch root and can't execute an init program afterwards, we're
completely stuck as we can't go back to the initramfs to start
emergency.service as it will have been completely removed by the switch
root operation.

To prevent leaving users with a completely undebuggable system, let's
at least check before we switch root whether at least one of the init
programs we might want to execute actually exist, and fail early if
none of them exists.
src/core/main.c