From f2e7cd13077c4c166da314e1fe800d30d0c05aa6 Mon Sep 17 00:00:00 2001 From: jgupta Date: Mon, 25 Jul 2022 14:46:10 +0200 Subject: [PATCH] Fix issue in extract image The problem lays with the 'extract-image' script as it is using lsblk commands to extract image's partition (find out root/efi/boot, lines:100-102) but the output is empty inside a container. lsblk gives empty output for FSTYPE, LABEL, GUID.. the fix is to use blkid. Closes-Bug: 1974350 Change-Id: I3b460c6dd9caa519c55327c5bd4b7e4585a8bd22 --- diskimage_builder/elements/sysprep/bin/extract-image | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/elements/sysprep/bin/extract-image b/diskimage_builder/elements/sysprep/bin/extract-image index c460dccf..cc4173e5 100755 --- a/diskimage_builder/elements/sysprep/bin/extract-image +++ b/diskimage_builder/elements/sysprep/bin/extract-image @@ -97,9 +97,9 @@ function extract_image() { fi for LOOPDEV in ${LOOPDEVS}; do - fstype=$(lsblk --all --nodeps --noheadings --output FSTYPE $LOOPDEV) - label=$(lsblk --all --nodeps --noheadings --output LABEL $LOOPDEV) - part_type=$(lsblk --all --nodeps --noheadings --output PARTTYPE $LOOPDEV) + fstype=$(sudo blkid -o value -s TYPE -p "${LOOPDEV}" 2>/dev/null) + label=$(sudo blkid -o value -s LABEL -p "${LOOPDEV}" 2>/dev/null) + part_type=$(sudo blkid -o value -s PART_ENTRY_TYPE -p "${LOOPDEV}" 2>/dev/null) if [ -z "${fstype}" ]; then # Ignore block device with no filesystem type