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

rear dies with " is not a block device" when have disks with "sun" disklabel

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-8.10, rhel-9.5
    • rear
    • None
    • No
    • Low
    • rhel-jotnar
    • ssg_core_services
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • None

      What were you trying to do that didn't work?

      When having a disk formatted with a "sun" disklabel, ReaR generates broken "part" entries for the disk: the <flag> field is missing, as shown in the example below:

      # Format: part <device> <partition size(bytes)> <partition start(bytes)> <partition type|name> <flags> /dev/<partition>
      part /dev/vdb 1021353984 0 none  /dev/vdb1
                                                                ^^ 2 spaces here indicating missing "flags" field
      part /dev/vdb 52125696 1021353984 none  /dev/vdb2
                                                                               ^^ 2 spaces here indicating missing "flags" field
      part /dev/vdb 1073479680 0 none  /dev/vdb3
                                                                ^^ 2 spaces here indicating missing "flags" field
      

      This is not an issue unless the disk is being used or AUTOEXCLUDE_DISKS=n is specified in the configuration. In such case, it leads to breaking ReaR with error below:

        2025-02-10 09:49:08.852577476 Verifying that the 'part' entries for /dev/vdb in /var/lib/rear/layout/disklayout.conf specify consecutive partitions
        /usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 82: test: -gt: unary operator expected
        /usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 82: test: -gt: unary operator expected
        /usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 82: test: -gt: unary operator expected
        2025-02-10 09:49:08.853433577 Verifying that the 'lvm...' entries in /var/lib/rear/layout/disklayout.conf are correct
        2025-02-10 09:49:08.860286544  is not a block device
        2025-02-10 09:49:08.862013114  is not a block device
        2025-02-10 09:49:08.863767364  is not a block device
      

      What is the impact of this issue to you?

      Need to forcibly exclude "sun" disks

      Please provide the package NVR for which the bug is seen:

      rear-2.6-12.el8
      rear-2.6-25.el9

      How reproducible is this bug?:

      Always

      Steps to reproduce

      1. Attach a disk to a VM
      2. Format it with "sun" disklabel
        # fdisk /dev/vdb
        
        Welcome to fdisk (util-linux 2.37.4).
        Changes will remain in memory only, until you decide to write them.
        Be careful before using the write command.
        
        Device does not contain a recognized partition table.
        Created a new DOS disklabel with disk identifier 0x500e96c2.
        
        Command (m for help): s
        Created a new partition 1 of type 'Linux native' and of size 974 MiB.
        Created a new partition 2 of type 'Linux swap' and of size 49.7 MiB.
        Created a new partition 3 of type 'Whole disk' and of size 1023.8 MiB.
        Created a new Sun disklabel.
        
        Command (m for help): w
        The partition table has been altered.
        Calling ioctl() to re-read partition table.
        Syncing disks.
        
      3. Add AUTOEXCLUDE_DISKS=n to the configuration and execute rear mkrescue
         echo "AUTOEXCLUDE_DISKS=n" >> /etc/rear/local.conf
        # rear mkrescue
        

      Expected results

      No error

      Actual results

      Error.
      Disk layout shows missing field:

      # grep part /var/lib/rear/layout/disklayout.conf 
      [...]
      # Format: part <device> <partition size(bytes)> <partition start(bytes)> <partition type|name> <flags> /dev/<partition>
      part /dev/vdb 1021353984 0 none  /dev/vdb1
                                                                ^^ 2 spaces here indicating missing "flags" field
      part /dev/vdb 52125696 1021353984 none  /dev/vdb2
                                                                               ^^ 2 spaces here indicating missing "flags" field
      part /dev/vdb 1073479680 0 none  /dev/vdb3
                                                                ^^ 2 spaces here indicating missing "flags" field
      

      Additional information

      The buggy code is extract_partitions() function in usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh.

      The issue is not present Upstream because Upstream removed support for "sun" disks:

      ERROR: Unsupported partition table 'sun' on /dev/vdb (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')
      

              jotnar-project Jötnar Project
              rhn-support-rmetrich Renaud Métrich
              Pavel Cahyna Pavel Cahyna
              Jötnar Project Jötnar Project
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: