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

Proof-of-concept for "A/B" fallback booting #502

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frozencemetery
Copy link
Member

Add a tool (shimctl) that makes shim updates more robust by keeping two
copies of shim around (shimARCH.efi and shimARCH_b.efi). Together with
shim-booted.service, it also supports tracking what versions of shim
were booted (and whether they were the "B" entry), enabling boot
counting.

See-also: https://mivehind.net/2022/08/17/shim-ab-booting-poc/
Signed-off-by: Robbie Harwood rharwood@redhat.com

Add a tool (shimctl) that makes shim updates more robust by keeping two
copies of shim around (shimARCH.efi and shimARCH_b.efi).  Together with
shim-booted.service, it also supports tracking what versions of shim
were booted (and whether they were the "B" entry), enabling boot
counting.

See-also: https://mivehind.net/2022/08/17/shim-ab-booting-poc/
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
@julian-klode
Copy link
Collaborator

Sweet. I'm gonna look at this next week when I get back working this is super interesting to me

@miabbott
Copy link

miabbott commented Sep 2, 2022

This looks similar to https://github.com/coreos/bootupd/

cc: @cgwalters

@cgwalters
Copy link
Contributor

Yeah, seems like it'd be pretty straightforward to integrate this into bootupd;

  • It's an already extant systemd service that would definitely like to have this functionality
  • It's also written in Rust, which avoids dragging python into systems that don't want to ship it (e.g. Fedora CoreOS today) and avoids runtime type errors
  • It already has a robust test suite, which one definitely wants for anything that is performing system updates

@frozencemetery
Copy link
Member Author

Well, python isn't set in stone - this is a proof of concept after all. I think we'd rather rewrite it in C than add a dependency on bootupd to shim.

@cgwalters
Copy link
Contributor

It'd be good to do a sync on this, because bootupd is the thing that updates shim and grub for us today and moving ownership of it to a separate service definitely requires some thought.

On a tangental topic, today bootupd is only really tested on rpm-ostree-based systems, but was explicitly designed to be decoupled from that. A tricky thing here is trying to move ownership of updates to the EFI partition from yum/rpm to a different service. rpm-ostree enforces today moving files from /boot to /usr/lib/ostree-boot, and then bootupd moves them again as part of this: https://github.com/coreos/fedora-coreos-config/blob/254cf4f4e083b36f94a7008a620b59a069ce12c2/manifests/bootupd.yaml#L13

Are you aiming for this code to support traditional yum/dnf systems and (rpm-)ostree based ones? If it's just the former, then I guess for now we could reimplement this logic in bootupd, and canonically use bootupd on rpm-ostree based systems.

I think we'd rather rewrite it in C than add a dependency on bootupd to shim.

I'm not sure that such a thing would need to be a hard dependency, but rather if bootupd isn't installed then shim wouldn't have A/B updates and would just be updated via rpm directly as it is today or so.

But is there a specific reason you think a bootupd dependency would be problematic?

@frozencemetery
Copy link
Member Author

frozencemetery commented Sep 2, 2022 via email

@cgwalters
Copy link
Contributor

updates to the ESP are already atomic.

When done via rpm directly writing things? Really? How can that be, given that there are multiple files involved in both shim and grub? Is anything actually testing it?

bootupd is also mentioned in its own README.md as being disabled by
default, even on coreos. That means we are quite far away from a world
where we could add a dependency on it to shim

Yeah, but the only reason for that is the non-atomicity, or at least my belief of that.

But it may indeed be the case that a model like this of using the EFI variables to do an A/B setup is sufficient, particularly if on an incomplete update if we hit a failure, and when rolling back we're able to retry the update.

@frozencemetery
Copy link
Member Author

frozencemetery commented Sep 7, 2022 via email

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