Upgrade from dunfell to kirkstone failing due to grubenv location

Hi,

Our situation has some similarities to the one describe in this post Not possible to downgrade after upgrade to meta-mender/kirkstone however the issue for us is the upgrade, not the downgrade.

We are using Yocto to build the operating system for our product and we use mender to deploy updates to our users. Our product uses the following:

  • Either an iEi-NANO-PV-D5251-R10 or iEi-NANO-ULT5-i5-R10 board. Both are Intel x86 architecture.
  • grub2 as the boot loader.
  • Does not use EFI grub.
  • The OS is deployed on an SATA SSD with four partitions: boot, A, B, and data.

We run mender directly on the command line using a mender file on a USB drive (we have an automated set of scripts in our image to do this). We do not deploy OTA updates.

We are attempting to migrate our product from dunfell to kirkstone. Our production infrastructure requires the following strategy:

  • For units in the field we will upgrade to kirkstone from dunfell using mender just as for all other updates.
  • For new production we must flash the new kirkstone image to the SSD directly.
  • We do not support downgrades from kirkstone to dunfell.

I am building from the tip of the kirkstone branch of meta-mender, openembedded-core, and meta-openembedded.

I am able to build the kirkstone image and mender upgrade package for our product. I have been able to run the mender upgrade from the command line using mender install and to boot into the new partition. The new partition boots up just fine and our applications run properly.

The problem occurs when I try to run mender commit. The following error occurs:

INFO[0000] Output (stderr) from command "grub-mender-grubenv-print": /usr/bin/grub-mender-grubenv-print: line 115: cd: /boot/grub/grub-mender-grubenv/mender_grubenv1: No such file or directory 
INFO[0000] Output (stderr) from command "grub-mender-grubenv-print": /usr/bin/grub-mender-grubenv-print: line 115: cd: /boot/grub/grub-mender-grubenv/mender_grubenv2: No such file or directory 
INFO[0000] Output (stderr) from command "grub-mender-grubenv-print": Unable to restore environment both are corrupt.

This is due to the patch identified in the topic linked above where the location of the grubenv has moved from /boot/grub/mender_grubenvX in dunfell to /boot/grub/grub-mender-grubenv/mender_grubenvX in kirkstone. Because the SSD I am upgrading was originally prepared with dunfell, the boot partition still has the dunfell layout.

From the patch notes and discussion in the linked topic I am lead to believe that the kirkstone grub-mender-grubenv tools are backwards-compatible and should be able to deal with the environment in either location. Is this interpretation correct or do the kirkstone tools not actually support the grubenv in the dunfell location?

I want to make sure I am not doing this all wrong before I start trying to come up with a workaround like hacking /etc/mender_grubenv.config or trying to update the boot partition.

Thanks!