coreos / bootupd

Bootloader updater
Apache License 2.0
125 stars 24 forks source link

Is it safe to run `/usr/bin/bootupctl backend generate-update-metadata` in a Containerfile? #635

Closed travier closed 2 months ago

travier commented 7 months ago

To fix issues with Fedora Atomic desktops, I'm considering backporting the bootupd inclusion to Fedora 39:

While thinking about that, I wondered if it would be able to create layered images with bootupd included in a layer.

Is it safe to run /usr/bin/bootupctl backend generate-update-metadata from a container layer?

FROM quay.io/fedora-ostree-desktops/kinoite:40

RUN rpm-ostree install bootupd \
    &&\
    /usr/bin/bootupctl backend generate-update-metadata \
    && \
    ostree container commit

I'll do some testing.

cgwalters commented 7 months ago

Offhand, I think so.

travier commented 2 months ago

I did that for a while in https://github.com/travier/fedora-kinoite/commit/7e3df8d9b9d8efe80572e417c4622aaeedbf0f49 and it worked fine.

fiftydinar commented 1 month ago

Running this in Containerfile makes /usr/lib/ostree-boot/efi/ empty.

Is this normal behavior?

Credits to @bsherman for finding this out

travier commented 1 month ago

Yes, the content is moved to /usr/lib/bootupd/updates. https://github.com/bsherman/ublue-custom/commit/7778989d3e6a08ab4711f319004b115d407b319c looks weird and it will likely fail when installing with Ananconda.

What's your issue with /usr/lib/ostree-boot/efi/ being empty?

bsherman commented 1 month ago

What's your issue with /usr/lib/ostree-boot/efi/ being empty?

I noticed the change when trying to use grub2-switch-to-blscfg on an installed system, which failed since the image had bootupctl backend generate-update-metadata.

Yes, the content is moved to /usr/lib/bootupd/updates. https://github.com/bsherman/ublue-custom/commit/7778989d3e6a08ab4711f319004b115d407b319c looks weird and it will likely fail when installing with Ananconda.

My naive guess is, if using such an image with bootupd, the service must be started to update grub, rather than using grub2-switch-to-blscfg?

travier commented 1 month ago

You don't need to use grub2-switch-to-blscfg because that's what ostree does by default now and ostree-grub2 generates a config that reads BLS (unless you've explicitly told it not to but it's not the default). Bootupd will update older GRUBs to be able to read BLS.

bsherman commented 1 month ago

You don't need to use grub2-switch-to-blscfg because that's what ostree does by default now and ostree-grub2 generates a config that reads BLS (unless you've explicitly told it not to but it's not the default). Bootupd will update older GRUBs to be able to read BLS.

I see what's happening now. Apologies for the noise on this.

In the past I'd seen this discussion ( https://discussion.fedoraproject.org/t/why-does-grub2-present-twice-double-menuentry-for-each-ostree-entry/73990/8 ) and Universal Blue forums were we'd documented use of grub2-switch-to-blscfg as a way to drop the duplicate boot entries in Grub.

I had NOT seen your recent updates to that discussion, however. Recent questions about the duplicate entries and noticing it reoccurring on my own system caused me to ask some questions.

Since it's clearly expected behavior, I'm content. Thank you for the response!

travier commented 1 month ago

Yes, with an updated GRUB (with BLS support) and dynamic GRUB configs (pre-bootupd) then you'll get duplicated GRUB entries. This will go away once we transition people to static GRUB configs by default, hopefully for F42 but we don't have this ready yet.