Not possible to downgrade after upgrade to meta-mender/kirkstone

Hello!

I am in the process of upgrading a project that is using Mender + Yocto Project, the upgrade path is dunfellkirkstone.

We are using Intel based hardware with EFI support.

But I stumbled upon a unexpected behavior and wanted to get your input on it.

Assuming that I have the following releases:

  • v2.0.0 (kirkstone)
  • v1.0.0 (dunfell)

If I flash my device with v2.0.0 ( hddimg), I get the following error if I try to “downgrade” to v1.0.0 using .mender (rootfs-image):

/usr/bin/fw_setenv: line 96: cd: /boot/efi/EFI/BOOT/mender_grubenv2: No such file or directory

It seems to be related to this commit, Upgrade to grub-mender-grubenv with grub.d support. · mendersoftware/meta-mender@515ddb4 · GitHub.

The path changed:

  • /boot/efi/EFI/BOOT/mender_grubenv*/boot/efi/grub-mender-grubenv/mender_grubenv*

But it does not seem that “older” grub-mender-grubenv-* tools (the ones in dunfell) are able to auto-detect this behavior and hence the error.

The reverse works just fine, that is flashing a device with v1.0.0 (hddimg), and then upgrading to v4.0.0 using .mender (rootfs-image). I guess this is what is meant by that the change is “backwards compatible”.

Is this expected behavior?

Friendly ping. @kacf maybe? :slight_smile:

Hey @mirzak!

You are correct that flashing with hddimg and then downgrading won’t work. This is because the contents on /boot/efi is permanent, and survives Mender rootfs updates. So if you try to downgrade, you still have the kirkstone layout in /boot/efi, which dunfell is not prepared to handle.

I believe you can work around it by using the /etc/mender_grubenv.config file to specify the location manually. Unfortunately it means that the two dunfell images will be incompatible: One for /boot/efi dunfell layout, and one for /boot/efi kirkstone layout. So it’s probably better to start all images with the dunfell layout and upgrade them to kirkstone, if you suspect that you need downgrades later, since then you can move seamlessly between them.

1 Like

Thanks for the detailed response :).

So it’s probably better to start all images with the dunfell layout and upgrade them to kirkstone,

This is a very good point, and this is what we will continue doing for a while.

if you suspect that you need downgrades later, since then you can move seamlessly between them.

I do not suspect that we actually will need downgrades, but is a nice option to have for unforeseen events when doing an “major upgrade”.