-
Notifications
You must be signed in to change notification settings - Fork 296
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
sysroot: Support boot counting for boot entries #3310
base: main
Are you sure you want to change the base?
Conversation
Hi @igoropaniuk. Thanks for your PR. I'm waiting for a ostreedev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This PR was created for initial feedback, I'll address the naming in the tests if needed and re-push |
I love the idea of integrating here, thanks for starting this! This came up before in at least #3032 Hmm don't we need to consider how we make this configurable? Currently systemd kernel-install parses |
@cgwalters thanks for the feedback, my concern regarding parsing A can add an optional autoconf flag for that |
Add support for boot counting for bootloader entries [1]. The boot counting data is stored in the name of the boot loader entry. A boot loader entry file name may contain a plus (+) followed by a number. This may optionally be followed by a minus (-) followed by a second number. The dot (.) and file name suffix (conf or efi) must immediately follow. All "pending" entries (in the middle of boot counting) are automatically removed during creation of new boot entries for new deployments. The feature is enabled with --enable_boot_count autoconf option. Testing: $ ostree admin deploy 91fc19319be9e79d07159303dff125f40f10e5c25614630dcbed23d95e36f907 Copying /etc changes: 2 modified, 3 removed, 4 added bootfs is sufficient for calculated new size: 0 bytes Transaction complete; bootconfig swap: yes; bootversion: boot.0.1, deployment count change: 1 $ ls /boot/loader/entries ostree-1+3.conf ostree-2+3.conf [1] https://uapi-group.org/specifications/specs/boot_loader_specification/#boot-counting Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io> configure option
6b33424
to
8ea23c7
Compare
@cgwalters added support for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for working on this!
@@ -362,6 +362,14 @@ AS_IF([test "$enable_man_html" = yes && test "$enable_man" = no], [ | |||
]) | |||
AM_CONDITIONAL(ENABLE_MAN_HTML, test "$enable_man_html" = yes) | |||
|
|||
AC_ARG_ENABLE(boot-count, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of a build-time option this should be a runtime option in the sysroot; something like
[sysroot]
boot-counting = true
or so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, makes sense, will fix. thanks!
bootloader_get_max_boot_tries (OstreeSysroot *self, OstreeDeployment *deployment, | ||
GCancellable *cancellable, GError **error) | ||
{ | ||
g_autofree char *tries_file_path = ostree_deployment_get_boot_tries_relpath (deployment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm...one super messy thing here is that at this point we may not have actually written out the deployment's /etc
. We really want a version of this that's in /usr
.
AFAICS, the uapi standard doesn't specify /etc/kernel/tries
- that's an invention of kernel-install
.
To combine with "make this configurable via sysroot" we could have e.g.:
[sysroot]
boot_counting=3
But OTOH I've been trying to get away from the sysroot configuration for other reasons...so we may need to invent /usr/lib/ostree/sysroot.conf
or so as a pair with /usr/lib/ostree/prepare-root.conf
?
BTW, which bootloader are you looking at using this with? |
@cgwalters EDK2 + systemd-boot |
Add support for boot counting for bootloader entries [1]. The boot counting data is stored in the name of the boot loader entry. A boot loader entry file name may contain a plus (+) followed by a number. This may optionally be followed by a minus (-) followed by a second number. The dot (.) and file name suffix (conf or efi) must immediately follow.
All "pending" entries (in the middle of boot counting) are automatically removed during creation of new boot entries for new deployments.
Testing:
$ ostree admin deploy 91fc19319be9e79d07159303dff125f40f10e5c25614630dcbed23d95e36f907 Copying /etc changes: 2 modified, 3 removed, 4 added bootfs is sufficient for calculated new size: 0 bytes Transaction complete; bootconfig swap: yes; bootversion: boot.0.1, deployment count change: 1
$ ls /boot/loader/entries
ostree-1+3.conf ostree-2+3.conf
[1] https://uapi-group.org/specifications/specs/boot_loader_specification/#boot-counting