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

supporting multiple tries per partition (boot counter) in GRUB #1250

Open
davidhuwyler opened this issue Sep 21, 2023 · 7 comments
Open

supporting multiple tries per partition (boot counter) in GRUB #1250

davidhuwyler opened this issue Sep 21, 2023 · 7 comments
Labels
help wanted RFE Request for Enhancement
Milestone

Comments

@davidhuwyler
Copy link

davidhuwyler commented Sep 21, 2023

I was not able to find an example of a GRUB configration to allow more than one try per rauc slot.
Maybe with "test" and "eval" or something?
Or is only one try per slot possible with GRUB?

@jluebbe
Copy link
Member

jluebbe commented Sep 21, 2023

If I remember correctly, the main issue was decrementing the TRY counters. If that's possible in new grub versions, we'd be happy to take a PR implementing that (and adding a second example script to contrib).

@jluebbe jluebbe added help wanted RFE Request for Enhancement labels Sep 21, 2023
@mbessler
Copy link

I'm using the following patch for grub that implements a increment/decrement command:
0253-Reimplement-boot_counter.patch from https://src.fedoraproject.org/rpms/grub2/c/db4a99687c8306760702abda9c01a2e74d19a3f3
Direct link: https://src.fedoraproject.org/rpms/grub2/blob/db4a99687c8306760702abda9c01a2e74d19a3f3/f/0253-Reimplement-boot_counter.patch

I also have a patch for rauc that creates a boot loader type "grubalt" to work with this feature. The grub bootscript is basically a port of the rauc u-boot boot selection script.

If there is any interest, I can share both.

@davidhuwyler
Copy link
Author

thanks mbessler, very interesting!
I'll try the patch if it works for me.

Ive got a double for loop working now in the grub bootscript to implement a 3 try a b system.
Not very pretty but functional...

@mbessler
Copy link

Before I found this patch, I had used some "not very pretty" code to increment/decrement using an if/then/else construct that handled numbers from around 0-10. However should the value be something outside that range, it could not handle it well.
Having the proper increment and decrement functions really helps.

@jluebbe
Copy link
Member

jluebbe commented Oct 24, 2023

I'm using the following patch for grub that implements a increment/decrement command: 0253-Reimplement-boot_counter.patch from https://src.fedoraproject.org/rpms/grub2/c/db4a99687c8306760702abda9c01a2e74d19a3f3 Direct link: https://src.fedoraproject.org/rpms/grub2/blob/db4a99687c8306760702abda9c01a2e74d19a3f3/f/0253-Reimplement-boot_counter.patch

@mbessler Do you know it they plan to upstream this change? I've not found it in https://git.savannah.gnu.org/cgit/grub.git/log/ so far.

I also have a patch for rauc that creates a boot loader type "grubalt" to work with this feature. The grub bootscript is basically a port of the rauc u-boot boot selection script.

If there is any interest, I can share both.

I'd be interested! We could at least take a look if it could be integrated into RAUC without too much overhead. As long as a patched GRUB is needed, I'd like to avoid unnecessary extra code.

@jluebbe jluebbe changed the title Question: Are multiple tries per partition possible in GRUB? supporting multiple tries per partition (boot counter) in GRUB Oct 24, 2023
@jluebbe
Copy link
Member

jluebbe commented Oct 24, 2023

A related discussion can be found at https://pagure.io/fedora-iot/issue/12.

@jluebbe jluebbe added this to the Unplanned milestone Oct 24, 2023
@mbessler
Copy link

@jluebbe no idea, I don't run or follow Fedora/RH, just found the patch useful. It would seem that the increment/decrement would not be a controversial change, but I have not looked into Grub upstream (other than checking for the existence of the feature).

Grubalt bootchooser pull request opened: #1275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted RFE Request for Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants