# resin-init-flasher fails to flash NVMe drive

**URL:** <https://forums.balena.io/t/resin-init-flasher-fails-to-flash-nvme-drive/368865>\
**Category:** balenaOS\
**Created:** [September 1, 2023, 3:14pm UTC](https://forums.balena.io/t/resin-init-flasher-fails-to-flash-nvme-drive/368865 "2023-09-01T15:14:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adimopoulos](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@adimopoulos](https://forums.balena.io/u/adimopoulos)\
**Post date:** [September 1, 2023, 3:14pm UTC](https://forums.balena.io/t/resin-init-flasher-fails-to-flash-nvme-drive/368865/1 "2023-09-01T15:14:32Z")

</div>

Hello,

 ![IMG_20230830_152914](https://global.discourse-cdn.com/balena/original/2X/c/c1cea0086b30d6f6eb936737dd8c35b8c22dc651.jpeg)

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](https://github.com/balena-os/meta-balena/blob/v3.1.13/meta-balena-common/recipes-support/resin-init/resin-init-flasher/resin-init-flasher#L176-L183). The call to [`get_internal_device()`](https://github.com/balena-os/meta-balena/blob/v3.1.13/meta-balena-common/recipes-support/os-helpers/os-helpers/os-helpers-fs#L239) 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](https://github.com/balena-os/balena-generic/blob/v3.1.13/layers/meta-balena-generic/recipes-support/resin-init/resin-init-flasher.bbappend#L1)?
3. Which drive will be used when multiple `NVMe` drives exist in the system?
