resin-init-flasher fails to flash NVMe drive

Hello,

As seen on the photo, resin-init-flasher is having trouble completing the installation when an NVMe drive coexists with an HDD drive. After some debugging I have traced the issue to the extend I could. The issue seems to come from the flashing section of the resin-init-flasher script. The call to get_internal_device() seems to correctly return /dev/nvme0n1 but as seen on the photo later in the script /dev/sda/ is trying to get used as the installation target. Or at least, that’s what is reported so there may be a printing error. In any case, $internal_dev does not have a stable behaviour.

There is also the error: Error: Could not stat device /dev/nvme0n1 which is weird as both /dev/nvme0n1 and /dev/sda exist and are also listed with lsblk.

I am using balenaOS version 3.1.13 (Generic x86_64 (GPT)). I think I didn’t have the same issue in older versions but I am not certain. However, rolling back to a previous version is not an option.

My questions are:

  1. Can you confirm that this is a bug?
  2. Can we somehow configure the precedence in the order of the installation targets?
  3. Which drive will be used when multiple NVMe drives exist in the system?