Hello Guys,
Is there any way to update kernel bootargs in grub configuration via an OTA update?
I’m on a x86 platform and only root partitions are currently updated by mender update. I would like to update kernel bootargs set in grub.cfg in the boot/efi partition as well.
How can I do that?
Hi @perceval,
It can be done via two primary ways, depending a bit on your exact requirements.
The somewhat more straightforward way would be to create a single-file application deployment that just drops a new grub.cfg
in the boot partition.
The more involved, but also more dynamic way would be to create an ArtifactCommit_Leave_xyz
script that you ship with the system update that requires the modification. This script will be executed once the system update is done deploying to the inactive partition, and can then take care of arbitrary changes. In this script you can change anything on the boot partition at your will - but be careful to make things bullet-proof, as you are leaving the safe area of rollbacks then. Scripts can be added by passing the -s
argument to mender-artifact write
.
Hope this helps, let me know if you need additional information.
Greetz,
Josef
Hi @TheYoctoJester,
Thank you for your reply.
What do you mean by a single file application deployment? Does it imply to create a recipes taking the new grub.cfg and put it in a mender image update file? How do you effectively implement this solution?
Concerning the ArtifactCommit_Leave_xyz
script, should it be added in a custom my-mender-artifactimg.bbclass
recipe? How do you see the implementation for a custom distro?
Greetings
Perceval
Hey @TheYoctoJester,
I would like to extend my question with: how do I update grub?
I would like to deploy a new version of grub in /boot. I thought about creating a mender artifact with only grub and grub.conf and without the grub env.
I thought about creating an update module.
I’m using yocto but I’m a little bit lost here and I would need guidance to implement that. Could you help me on that?
thank you very much
have a great day
Hi @perceval,
After thinking a bit about it, I would conclude
- yes it can be done fro Yocto
- no, it is not exactly trivial.
It would require a custom Update Module which is able to handle a GRUB-style payload, including eventually required reconfigurations, and a kind of grub-update recipe which takes the output of the GRUB build by Yocto, and packages it accordingly to the aforementioned Update Module. Not witchcraft, but also requires some care.
Do you have an immediate need or problem which you need to solve?
Greetz,
Josef
Hello @TheYoctoJester
Thank you for taking the time to think about that. What I had in mind was just replacing the bootx64.efi
without taking care of the configuration. The goal is to upgrade grom grub 2.04 to grub 2.12 to leverage a flicker free boot process like on modern distros.
So I thought about creating an update module with only /boot/efi/EFI/BOOT/bootx64.efi
inside (or even with the grub.config
).
It would be easier than a GRUB-style payload, right?
Greetz
Perceval
Hi @perceval,
If you are confident that the only thing you really need is dropping the new binary at a defined path (or just want to give it a go for fun and testing), then the easiest way is to use the Single File Update Module. It is installed by default, and you can implicitly use it through the web UI. Just select the file you want to deploy as artifact to upload, then you will be prompted for the path that it should be placed at. If you’re lucky, then this is all you need. If additional permission settings or such are needed, then you need to use the generator script as described in the linked Hub post.
Greetz,
Josef