Massflash encrypted nvme fails with Could not stat device /dev/mmcblk0 - No such file or directory

hello shai.segev,

are you trying to re-flash backup image to another Orin NX device with an empty NVMe?
if yes…
please refer to Topic 311018 to apply the fixes for verification.
for instance,

diff --git a/scripts/backup-restore/nvrestore_partitions.sh b/scripts/backup-restore/nvrestore_partitions.sh
index 0cebae9..77d2cd5 100755
--- a/scripts/backup-restore/nvrestore_partitions.sh
+++ b/scripts/backup-restore/nvrestore_partitions.sh
@@ -54,6 +54,7 @@
 BLOCK_DEVICE_LIST=("nvme0n1")
 MMC_DEVICES=("3701" "3767-0005")
 MODEL=$(tr -d '\0' < /proc/device-tree/compatible)
+BLOCK_SIZE=512
 for MMC_DEVICE in "${MMC_DEVICES[@]}"
 do
 	if echo "${MODEL}" | grep -q "${MMC_DEVICE}"; then
@@ -301,6 +302,16 @@
 	exit 1
 fi
 
+declare -A able_to_delete
+
+for device in "${BLOCK_DEVICE_LIST[@]}"; do
+    if blkdiscard -f "/dev/${device}" &>/dev/null; then
+        able_to_delete["${device}"]="success"
+    else
+        able_to_delete["${device}"]=""
+    fi
+done
+
 # The GPT must be the first partition flashed, so this block ensures that the
 # GPT exists and is flashed first.
 # shellcheck disable=SC2013
@@ -369,10 +380,14 @@
 				echo "${SCRIPT_NAME} Checksum of ${FIELDS[2]} does not match the checksum in the index file."
 				exit
 			fi
+			options=("status=progress" "bs=${BLOCK_SIZE}")
 			if [ "${FIELDS[2]}" = 'gpt_2' ]; then
-				dd if="${FIELDS[1]}" of="/dev/${BLOCK_DEVICE}" bs=512 seek=$((FIELDS[3])) count=$((FIELDS[4]))
+				dd if="${FIELDS[1]}" of="/dev/${BLOCK_DEVICE}" "${options[@]}" seek=$((FIELDS[3])) count=$((FIELDS[4]))
 			else
-				zstd -dc "${FIELDS[1]}" | dd of="/dev/${FIELDS[2]}" status=progress conv=sparse bs=512 seek=$((FIELDS[3])) count=$((FIELDS[4]))
+				if [ -n "${able_to_delete["${BLOCK_DEVICE}"]}" ]; then
+					options+=("conv=sparse")
+				fi
+				zstd -dc "${FIELDS[1]}" | dd of="/dev/${FIELDS[2]}" "${options[@]}" seek=$((FIELDS[3])) count=$((FIELDS[4]))
 			fi
 		fi
 	done