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

Make EFI partition size configurable at install time #2105

Merged

Conversation

davidcassany
Copy link
Contributor

Fixes #2104

@davidcassany davidcassany requested a review from a team as a code owner June 17, 2024 10:55
@davidcassany
Copy link
Contributor Author

In addition to that we could also consider having way higher default value (what about 1G or even 2G?) So if we ever support systemd-boot or unified kernel image (which require having kernel and initrd within the EFI partition) we could eventually consider upgrades without having to reinstall from scratch.

@davidcassany davidcassany force-pushed the make_efi_partition_size_configurable branch from 86f6bc3 to 07d4633 Compare June 17, 2024 11:10
@davidcassany davidcassany self-assigned this Jun 17, 2024
Copy link
Contributor

@anmazzotti anmazzotti left a comment

Choose a reason for hiding this comment

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

Looks good, only one minor remark to provide an example.

@@ -19,7 +19,7 @@ install:
# size: 300

# default partitions
# only 'oem', 'recovery', 'state' and 'persistent' objects allowed
# only 'efi', 'oem', 'recovery', 'state' and 'persistent' objects allowed
Copy link
Contributor

Choose a reason for hiding this comment

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

Just nitpicking, but it would be best to also include an efi partition example, just to highlight the fact that the filesystem to use should be vfat. Or can it be omitted even? I don't truly know if we use the defaults or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vfat filesystem is set by default and I was wondering to force it or not (error out if not set to vfat), but then I thought about better giving some flexibility as this is pretty hidden in the setup and if one is actually touching this is probably for a good reason. For instance I don't know if for RPi it is mandatory to boot from vfat or it can be another filesystem.
What we probably could consider in the future is renaming this EFI partition to some firmware neutral name (boot partition?), so there is no explicit assumption we are using EFI firmware. But I did not want to touch that at this time because it feels like a risky change, there might be some corner cases hard to foresee.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would not force it as well, but it could be an idea. What I missed is an example for the end-users to follow, let's say I do want to use this feature, then I would miss (without looking at the source code) how can I extend the partition size, and what do I need to configure in order to do that.
I was wondering is that fat, fat32, etc. before looking at the source, and if it's optional is even better, so I could just code:

efi:
  size: 1000

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed this is the case you can provide only size and this will only modify the default size, but keep all other parameters. About partition sizes we definitely need some docs on that topic and we already have an issue for that rancher/elemental-docs#345

Copy link
Contributor

Choose a reason for hiding this comment

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

or instance I don't know if for RPi it is mandatory to boot from vfat or it can be another filesystem.

It is mandatory. It cannot be another filesystem.
(At least for the firmware and bootloader files. Once GRUB takes over, things probably look a bit brighter.)

@kkaempf
Copy link
Contributor

kkaempf commented Jun 17, 2024

As said in #2104, calling it EFI partition is misleading on Raspberry (and might as well other ARM platforms).
Raspberry doesn't boot from EFI but also needs a vfat formatted boot partition.

It might not matter implementation wise, but I'm somewhat concerned about mixing topics.

@davidcassany
Copy link
Contributor Author

As said in #2104, calling it EFI partition is misleading on Raspberry (and might as well other ARM platforms). Raspberry doesn't boot from EFI but also needs a vfat formatted boot partition.

It might not matter implementation wise, but I'm somewhat concerned about mixing topics.

All right, this is a fair point and probably we can start by exposing it with a different name but keep all variables and constants as they are now, which is probably already misleading. Lets start having a look.

@davidcassany davidcassany marked this pull request as draft June 17, 2024 15:50
@davidcassany
Copy link
Contributor Author

I also dislike the boot name as this can easily be confusing with /boot 🤔 Shall we call it firmware partition? Something like:

install:
  partitions:
    firmware:
      size: 512
    oem:
      ...

We could easily name EFI to firmware in UX and probably change the EFI variable name to FW or something like that, however there still many constant literals that refer to efi (e.g. the partition is mounted at /run/elemental/efi).

Note that in toolkit we are only effectively supporting EFI firmware. So to some extend it makes sense keeping the default constant literals referring to efi (e.g. /run/elemental/efi).

Shall we try to do such a rename? How far should we attempt to go.

@kkaempf
Copy link
Contributor

kkaempf commented Jun 18, 2024

firmware isn't clear either, as there's "boot firmware" (like in RPi) and "kernel firmware" (all the *-firmware rpms).

Yeah, naming is hard 😆

@davidcassany
Copy link
Contributor Author

Probably bootloader partition is more accurate? Could be meaningful for BIOS, EFI and UBOOT-like with EFI Grub

@kkaempf
Copy link
Contributor

kkaempf commented Jun 18, 2024

Probably bootloader partition is more accurate? Could be meaningful for BIOS, EFI and UBOOT-like with EFI Grub

Let's go for bootloader !

@@ -4,6 +4,9 @@ cloud-init-paths:
- "some/alternate/path"

install:
partitions:
efi:
size: 512
Copy link
Contributor

Choose a reason for hiding this comment

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

How/where do we document the size unit ? (I'd assume it's in megabytes ;-) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes everything is in megabytes, it is already added as a comment in the example config file and also in elemental-toolkit docs.

Signed-off-by: David Cassany <dcassany@suse.com>
Signed-off-by: David Cassany <dcassany@suse.com>
Signed-off-by: David Cassany <dcassany@suse.com>
Signed-off-by: David Cassany <dcassany@suse.com>
Signed-off-by: David Cassany <dcassany@suse.com>
@davidcassany davidcassany force-pushed the make_efi_partition_size_configurable branch from 43b37d3 to 4f6e8c1 Compare June 18, 2024 10:06
@@ -19,7 +19,7 @@ install:
# size: 300

# default partitions
# only 'oem', 'recovery', 'state' and 'persistent' objects allowed
# only 'bootloader', 'oem', 'recovery', 'state' and 'persistent' objects allowed
# size in MiB
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is were we document all sizes are in megabytes. It is also documented in elemental-toolkit docs.

@@ -4,6 +4,9 @@ cloud-init-paths:
- "some/alternate/path"

install:
partitions:
efi:
size: 512
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes everything is in megabytes, it is already added as a comment in the example config file and also in elemental-toolkit docs.

@davidcassany davidcassany marked this pull request as ready for review June 18, 2024 10:09
EfiLabel = "COS_GRUB"
EfiPartName = "efi"
BootLabel = "COS_GRUB"
BootPartName = "efi"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note this PR changes the variable and constant names, but none of the values. This to ensure no regressions are introduced. If we consider changes values to I'd do it in a separate and follow up PR.

@@ -502,7 +502,7 @@ func (pl PartitionList) GetByNameOrLabel(name, label string) *Partition {

type ElementalPartitions struct {
BIOS *Partition
EFI *Partition
Boot *Partition `yaml:"bootloader,omitempty" mapstructure:"bootloader"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bootloader partition is named as Boot in the struct, just for the sake of short names.

Copy link
Contributor

@kkaempf kkaempf left a comment

Choose a reason for hiding this comment

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

Ok to merge 🚀

@davidcassany davidcassany merged commit 15a10cc into rancher:main Jun 19, 2024
29 checks passed
@davidcassany davidcassany deleted the make_efi_partition_size_configurable branch June 19, 2024 04:23
@kkaempf
Copy link
Contributor

kkaempf commented Jun 19, 2024

I cannot add

partitions:
  bootloader:
    size: 128

via the Rancher UI 😕

@kkaempf
Copy link
Contributor

kkaempf commented Jun 19, 2024

When trying to edit via kubectl I get

> kubectl edit -n fleet-default MachineRegistration rpi-cluster-nodes
error: machineregistrations.elemental.cattle.io "rpi-cluster-nodes" is invalid
A copy of your changes has been stored to "/tmp/kubectl-edit-rw5pf.yaml"
error: Edit cancelled, no valid changes were saved.

@kkaempf
Copy link
Contributor

kkaempf commented Jun 21, 2024

Confirmed working, thanks !

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

Successfully merging this pull request may close these issues.

COS_GRUB too small on ARM / RPi
3 participants