Bug 2300115

Summary: blivet crashes if asked for the type UUID of a partition on an msdos-labeled disk
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: python-blivetAssignee: Vojtech Trefny <vtrefny>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: blivet-maint-list, dlehman, japokorn, mkolman, robatino, rvykydal, vponcova, vtrefny
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: openqa
Fixed In Version: python-blivet-3.10.1-4.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-07-30 19:13:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2247865    

Description Adam Williamson 2024-07-26 18:16:26 UTC
Description of problem:
anaconda since 41.26 will ask blivet for the type UUID of partitions on msdos-labeled disks in some circumstances (when scanning a disk for existing Windows devices). This causes blivet to crash:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/dasbus/server/handler.py", line 455, in _method_callback
    result = self._handle_call(
        interface_name,
    ...<2 lines>...
        **additional_args
    )
  File "/usr/lib/python3.13/site-packages/dasbus/server/handler.py", line 265, in _handle_call
    return handler(*parameters, **additional_args)
  File "/usr/lib64/python3.13/site-packages/pyanaconda/modules/storage/devicetree/viewer_interface.py", line 194, in GetExistingSystems
    return OSData.to_structure_list(self.implementation.get_existing_systems())
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/site-packages/pyanaconda/modules/storage/devicetree/viewer.py", line 491, in get_existing_systems
    windows_data = self._get_windows_data()
  File "/usr/lib64/python3.13/site-packages/pyanaconda/modules/storage/devicetree/viewer.py", line 528, in _get_windows_data
    if str(device.part_type_uuid) == EFI_PARTITION_TYPE:
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/blivet/threads.py", line 49, in run_with_lock
    return m(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/blivet/devices/partition.py", line 382, in part_type_uuid
    return UUID(bytes=self.parted_partition.type_uuid)
  File "/usr/lib64/python3.13/uuid.py", line 175, in __init__
    raise TypeError('one of the hex, bytes, bytes_le, fields, '
                    'or int arguments must be given')
TypeError: one of the hex, bytes, bytes_le, fields, or int arguments must be given

This is because pyparted, when asked for the type UUID of a partition on an msdos-labeled disk, returns None (because parted tells it msdos-labeled disks do not support type UUIDs, which is true), and blivet goes right ahead and passes that return value to `uuid.UUID`, which chokes on it (as the error more or less says, it requires exactly one of the five input args to not be None).

Version-Release number of selected component (if applicable): python-blivet-3.10.1-3.fc41

How reproducible: 100%

Steps to Reproduce:
1. Set up an existing disk with an msdos label and some partitions
2. Boot an installer with anaconda 41.26 or later with the disk attached
3. Select the disk as the install target, and try to go to the 'reclaim space' page

Actual results:
anaconda crashes with the above traceback

Expected results:
anaconda should not crash

Additional info:
Proposed fix at https://github.com/storaged-project/blivet/pull/1265

Proposing as a Beta blocker per "When using the guided partitioning flow, the installer must be able to: Cleanly install to a disk with a valid ms-dos or gpt disk label and partition table which contains existing data and sufficient unpartitioned space for a Fedora installation ... Remove existing storage volumes to free up space, at the user's direction"

Comment 1 Adam Williamson 2024-07-30 16:09:15 UTC
This should be fixed in the next compose, waiting for it to be finished so we can confirm.

Comment 2 Adam Williamson 2024-07-30 19:13:46 UTC
Fix confirmed.