Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dracut: run emergency.target on ignition/torcx service unit failure #28

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

jepio
Copy link
Member

@jepio jepio commented Sep 7, 2021

dracut: run emergency.target on ignition/torcx service unit failure

This PR isolates emergency.target when ignition units fail, ensuring that we don't end up with a boot loop in initramfs.

How to use

emerge-amd64-usr bootengine coreos-kernel

Testing done

Tested with invalid ignition configs from flatcar/Flatcar#434 and flatcar/Flatcar#468. In both cases the boot now stops and the user sees the ignition error on the console.

Right now, when ignition fails during boot the following happens:

1. ignition service fails, which fails initrd.target fails and starts emergency.target
2. initrd-parse-etc.service is already starting and launches initrd-fs.target and initrd-cleanup.service
3. initrd-cleanup.service isolates initrd-swithc-root.target
4. emergency.service is stopped and starts default.target again
5. initrd.target starts ignition services again
6. loop back to 1.

This is a boot loop that makes it hard for users to figure out what is wrong
with their ignition config. This appears to be unintentional, and something
observed in CoreOS and Fedora CoreOS as well.

Apparently, for a brief while systemd did not allow OnFailure clauses in
targets. This was fixed in systemd, but coreos shipped this fix as well
coreos/ignition-dracut#188.

So add OnFailure clauses to ignition units to ensure boot stops right there.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@jepio jepio merged commit 589e6be into flatcar-master Sep 9, 2021
@jepio jepio deleted the jepio/ignition-fix-bootloop branch September 9, 2021 09:09
@pothos
Copy link
Member

pothos commented Sep 9, 2021

Wonderful, it stops with a red error message about the wrong configuration, and shows the dracut emergency shell prompt ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants