Skip to content

create org.osbuild.bootupd stage#1519

Merged
achilleas-k merged 6 commits intoosbuild:mainfrom
dustymabe:dusty-bootupd
Jan 10, 2024
Merged

create org.osbuild.bootupd stage#1519
achilleas-k merged 6 commits intoosbuild:mainfrom
dustymabe:dusty-bootupd

Conversation

@dustymabe
Copy link
Contributor

Add the bootupd stage to install GRUB on both BIOS and UEFI systems,
ensuring that your bootloader stays up-to-date.

Signed-off-by: Renata Ravanelli rravanel@redhat.com

@dustymabe
Copy link
Contributor Author

The 2nd commit here will be dropped. The 3rd and 4th commits are optional and stem from a previous conversation between @achilleas-k @cgwalters and I. Over there I don't think we fully fleshed out if the optimization was completely out of the question or not. Maybe I should just open a separate PR with that optimization so we could focus discussion on it, but at the same time I don't want to introduce options to the bootupd stage here if we'd remove them later.

@achilleas-k achilleas-k self-requested a review December 22, 2023 17:21
@achilleas-k
Copy link
Member

Maybe I should just open a separate PR with that optimization so we could focus discussion on it, but at the same time I don't want to introduce options to the bootupd stage here if we'd remove them later.

That would be preferable, yeah. Can you open it separately so we can talk about that there and then keep this specific to bootupd? Thanks!

@dustymabe dustymabe force-pushed the dusty-bootupd branch 2 times, most recently from 3f34ccf to 25cf86a Compare January 4, 2024 16:23
@dustymabe
Copy link
Contributor Author

I broke out the controversial commits into #1527

You can now review just the first commit in this PR. The 2nd commit is just there to make tests pass until we can update the registry.gitlab.com/redhat/services/products/image-builder/ci/images/fedora-coreos next week when a new build of FCOS is out that we can use.

@mvo5 mvo5 self-requested a review January 4, 2024 17:35
mvo5 added a commit to mvo5/osbuild that referenced this pull request Jan 5, 2024
The EFI binaries are currently pulled from a hardcoded path in the
buildroot. When moving to containers as buildroots this will no
longer work as they have an alternative layout. This is an easy
"fix" - make the location of the `EFI/` directory configurable.

This allows us set `efi_root` to `/usr/lib/bootupd/updates/EFI/`
and keep our existing `bootc-image-builder` workflow.

Note that this may actually not be the desired solution and instead
we want the new `bootupd`: osbuild#1519
@dustymabe
Copy link
Contributor Author

@achilleas-k can you pull quay.io/fedora/fedora-coreos:testing and push it to registry.gitlab.com/redhat/services/products/image-builder/ci/images/fedora-coreos:testing and I'll update this so tests pass and we can hopefully merge.

You can delete registry.gitlab.com/redhat/services/products/image-builder/ci/images/fedora-coreos:stable if you want as it should be unused now.

dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 8, 2024
The update to v103 includes:

- create org.osbuild.ostree.aleph stage
    - osbuild/osbuild#1475
- mounts: support mounting partitions
    - osbuild/osbuild#1501
- osbuild/mounts: adjust the source path to use when mounting devices
    - osbuild/osbuild#1493

And I also add the bootupd stage in here from the yet to merge PR:
osbuild/osbuild#1519
mvo5 added a commit to mvo5/osbuild that referenced this pull request Jan 8, 2024
The EFI binaries are currently pulled from a hardcoded path in the
buildroot. When moving to containers as buildroots this will no
longer work as they have an alternative layout. This is an easy
"fix" - make the location of the `EFI/` directory configurable.

This allows us set `efi_root` to `/usr/lib/bootupd/updates/EFI/`
and keep our existing `bootc-image-builder` workflow.

Note that this may actually not be the desired solution and instead
we want the new `bootupd`: osbuild#1519
@achilleas-k
Copy link
Member

@achilleas-k can you pull quay.io/fedora/fedora-coreos:testing and push it to registry.gitlab.com/redhat/services/products/image-builder/ci/images/fedora-coreos:testing and I'll update this so tests pass and we can hopefully merge.

Done: https://gitlab.com/redhat/services/products/image-builder/ci/images/container_registry/5710257

@dustymabe
Copy link
Contributor Author

@achilleas-k can you pull quay.io/fedora/fedora-coreos:testing and push it to registry.gitlab.com/redhat/services/products/image-builder/ci/images/fedora-coreos:testing and I'll update this so tests pass and we can hopefully merge.

Done: https://gitlab.com/redhat/services/products/image-builder/ci/images/container_registry/5710257

Thanks! Pushed a new update and rebased on top of latest main. Hopefully the tests pass!

mvo5 added a commit to mvo5/osbuild that referenced this pull request Jan 9, 2024
The EFI binaries are currently pulled from a hardcoded path in the
buildroot. When moving to containers as buildroots this will no
longer work as they have an alternative layout. This is an easy
"fix" - make the location of the `EFI/` directory configurable.

This allows us set `efi_src_dir` to `/usr/lib/bootupd/updates/EFI/`
and keep our existing `bootc-image-builder` workflow.

Note that this may actually not be the desired solution and instead
we want the new `bootupd`: osbuild#1519
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR - this looks fine but I would really like some tests. When looking at that I got a bit carried away and opened dustymabe#14 for your consideration. It addresses the nitpicks/ideas I have in here. I would also love to have a stage test and will look at this next.

Fwiw, we are super happy that you work on this because we will most likely use it for the bootc container builds :)

mvo5
mvo5 previously approved these changes Jan 9, 2024
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now, given that I changed this a bit it might be best if e.g. @achilleas-k could have a look too.

I would love to have a stage test as well to run this for real and I started to look into it but I think it's a bit involved (because of the required mount setup). I think it's okay to not block on this because there is no regression risk.

dustymabe added a commit to coreos/coreos-assembler that referenced this pull request Jan 9, 2024
The update to v103 includes:

- create org.osbuild.ostree.aleph stage
    - osbuild/osbuild#1475
- mounts: support mounting partitions
    - osbuild/osbuild#1501
- osbuild/mounts: adjust the source path to use when mounting devices
    - osbuild/osbuild#1493

And I also add the bootupd stage in here from the yet to merge PR:
osbuild/osbuild#1519
dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 9, 2024
The update to v103 includes:

- create org.osbuild.ostree.aleph stage
    - osbuild/osbuild#1475
- mounts: support mounting partitions
    - osbuild/osbuild#1501
- osbuild/mounts: adjust the source path to use when mounting devices
    - osbuild/osbuild#1493

And I also add the bootupd stage in here from the yet to merge PR:
osbuild/osbuild#1519
dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 9, 2024
There were some updates from code review in [1]. Let's pull them
here and also update the mpp.yaml manifest to include the ostree
deployment specification.

[1] osbuild/osbuild#1519
dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 9, 2024
There were some updates from code review in [1]. Let's pull them
here and also update the mpp.yaml manifest to include the ostree
deployment specification.

[1] osbuild/osbuild#1519
mvo5
mvo5 previously approved these changes Jan 9, 2024
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still looks good!

dustymabe added a commit to coreos/coreos-assembler that referenced this pull request Jan 9, 2024
There were some updates from code review in [1]. Let's pull them
here and also update the mpp.yaml manifest to include the ostree
deployment specification.

[1] osbuild/osbuild#1519
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The last two commits have subjects that are too long. Can we keep them under 72 chars?
  2. Can we also clean up the history a bit? (see comment below).
  3. The disk option under bios: Making enforcing the name through the schema for the devices object would make it consistent with how we do it in other stages, but if we prefer to keep it explicit, I'd change the name of the option to make it clear that it maps to a "device".

@dustymabe
Copy link
Contributor Author

dustymabe commented Jan 9, 2024

  1. The last two commits have subjects that are too long. Can we keep them under 72 chars?

Fixed.

  1. Can we also clean up the history a bit? (see comment below).

Tried to fix.

  1. The disk option under bios: Making enforcing the name through the schema for the devices object would make it consistent with how we do it in other stages, but if we prefer to keep it explicit, I'd change the name of the option to make it clear that it maps to a "device".

I was leaning your way on this, but then Renata and I found a gap in
our coverage here (see the newest commit) where on ppc64le we need to
be able to install into a partition of a device so I added the
partition key too. Otherwise we could have made bios: true/false a
boolean.

ravanelli and others added 6 commits January 9, 2024 17:07
Add the bootupd stage to install GRUB on both BIOS and UEFI systems,
ensuring that your bootloader stays up-to-date.

Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
The stable stream currently doesn't have a new enough bootupd to pass
the tests for the bootupd stage. Let's update to `:testing` for now
and we'll switch back to `:stable` later.
Also refactor bind mounts into a helper.
It now tests  bind_mounts and bootupd behavior separately.
For ppc64le we need to pass in a partition (i.e. /dev/loop0p1) rather
than the root device (/dev/loop0) to the --device argument of bootupctl.
Let's add a partition field and find the device node based on the user
specified partition.

On ppc64le this would look something like:

```
      - type: org.osbuild.bootupd
        options:
          bios:
            device: disk
            partition:
              mpp-format-int: '{image.layout[''POWERPC-PREP-BOOT''].partnum}'
          static-configs: true
          deployment:
            osname: fedora-coreos
            ref: ostree/1/1/0
        devices:
          disk:
            type: org.osbuild.loopback
            options:
              filename: disk.img
              partscan: true
        mounts:
          - name: root
            type: org.osbuild.xfs
            source: disk
            partition:
              mpp-format-int: '{image.layout[''root''].partnum}'
            target: /
          - name: boot
            type: org.osbuild.ext4
            source: disk
            partition:
              mpp-format-int: '{image.layout[''boot''].partnum}'
            target: /boot
```
@achilleas-k
Copy link
Member

I was learning your way on this, but then Renata and I found a gap in
our coverage here (see the newest commit) where on ppc64le we need to
be able to install into a partition of a device so I added the
partition key too. Otherwise we could have made bios: true/false a
boolean.

You could specify the start and size options of the device to create a loopback that points to the specific partition. In the test case for example it look like this:

        {
          "type": "org.osbuild.bootupd",
          "options": {
            "bios": true,
            "static-configs": true,
            "deployment": {
              "osname": "fedora-coreos",
              "ref": "ostree/1/1/0"
            }
          },
          "devices": {
            "disk": {
              "type": "org.osbuild.loopback",
              "options": {
                "filename": "disk.img",
                "start": 4096,
                "size": 260096
              }
            }
          }
        }

Would that work?

@dustymabe
Copy link
Contributor Author

Would that work?

unfortunately not. the grub2-install stuff really doesn't like it when you map in a slice of a device and not the whole device itself :(

@achilleas-k
Copy link
Member

achilleas-k commented Jan 9, 2024

Would that work?

unfortunately not. the grub2-install stuff really doesn't like it when you map in a slice of a device and not the whole device itself :(

Right, of course -_-
(forgot we went through all this already)

Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good to go on my end!

@achilleas-k achilleas-k enabled auto-merge (rebase) January 9, 2024 22:59
@achilleas-k achilleas-k merged commit 8cce659 into osbuild:main Jan 10, 2024
@dustymabe
Copy link
Contributor Author

Thank you @mvo5 and @achilleas-k for the help and the reviews here.

mvo5 added a commit to mvo5/images that referenced this pull request Jan 15, 2024
Add support for the new `org.osbuild.bootupd` stage that got added
in osbuild/osbuild#1519
mvo5 added a commit to mvo5/images that referenced this pull request Jan 16, 2024
Add support for the new `org.osbuild.bootupd` stage that got added
in osbuild/osbuild#1519
mvo5 added a commit to mvo5/images that referenced this pull request Jan 16, 2024
Add support for the new `org.osbuild.bootupd` stage that got added
in osbuild/osbuild#1519
mvo5 added a commit to mvo5/images that referenced this pull request Jan 16, 2024
Add support for the new `org.osbuild.bootupd` stage that got added
in osbuild/osbuild#1519
github-merge-queue bot pushed a commit to osbuild/images that referenced this pull request Jan 16, 2024
Add support for the new `org.osbuild.bootupd` stage that got added
in osbuild/osbuild#1519
dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 16, 2024
dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 16, 2024
dustymabe added a commit to dustymabe/coreos-assembler that referenced this pull request Jan 17, 2024
dustymabe added a commit to coreos/coreos-assembler that referenced this pull request Jan 17, 2024
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.

5 participants