Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-6989

ReaR fails while verifying the disklayout when a disk has a 0 size

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Normal Normal
    • rhel-8.10
    • rhel-8.7.0
    • rear
    • rear-2.6-12.el8
    • None
    • Medium
    • sst_cs_system_management
    • ssg_core_services
    • 25
    • 26
    • 5
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • If docs needed, set a value
    • None

      Description of problem:

      When plugging in a USB multi-card reader (SD / MicroSD) which has no card insert, the device (/dev/sda) has a 0 size.
      This leads to layout verification to fail:
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
      No partition label type for 'disk /dev/sda' (may cause 'rear recover' failure)
      /dev/sda size 0 is not a positive integer
      ERROR:
      ====================
      BUG in /root/rear/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh line 254:
      'Entries in /root/rear/var/lib/rear/layout/disklayout.conf are broken ('rear recover' would fail)'
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      This happens when AUTOEXCLUDE_DISKS=n (which is not the default).

      The root cause is the code snippet in /usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh, which doesn't skip disks with $devsize == 0 :
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
      415 devsize=$(get_disk_size ${disk#/sys/block/})
      416 disktype=$(parted -s $devname print | grep -E "Partition Table|Disk label" | cut -d ":" -f "2" | t r -d " ")
      :
      430 echo "disk $devname $devsize $disktype"
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      This leads to creating entry disk sda 0, which is invalid entry (missing $disktype).

      I think the solution is to skip those 0 size disks completely.

      Version-Release number of selected component (if applicable):

      rear-2.6+

      How reproducible:

      Always, see above.

            rhn-support-pcahyna Pavel Cahyna
            rhn-support-rmetrich Renaud Métrich
            Pavel Cahyna Pavel Cahyna
            Jakub Haruda Jakub Haruda
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: