Bug 2180041 - ReaR fails while verifying the disklayout when a disk has a 0 size
Summary: ReaR fails while verifying the disklayout when a disk has a 0 size
Keywords:
Status: ASSIGNED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rear
Version: 8.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Cahyna
QA Contact: CS System Management SST QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-20 15:39 UTC by Renaud Métrich
Modified: 2023-08-08 14:17 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github rear rear issues 2958 0 None open ReaR fails while verifying the disklayout when a disk has a 0 size 2023-03-20 15:39:27 UTC
Red Hat Issue Tracker RHELPLAN-152435 0 None None None 2023-03-20 15:40:58 UTC

Description Renaud Métrich 2023-03-20 15:39:27 UTC
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.

Comment 1 Pavel Cahyna 2023-03-20 16:04:32 UTC
Looks similar to https://github.com/rear/rear/issues/2810, but that one appeared only with new code added in ReaR 2.7 (PR https://github.com/rear/rear/pull/2804), while this happens with ReaR 2.6.

In that issue we were not able to get details of the USB device. @rmetrich can you please provide details about the USB device (lsusb output)?

Comment 2 Pavel Cahyna 2023-03-21 16:48:31 UTC
USB device details:
Bus 002 Device 007: ID 8564:4000 Transcend Information, Inc. microSD/SD/CF UHS-II Card Reader [RDF8, RDF9]


Note You need to log in before you can comment on or make changes to this bug.