Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2026220

Summary: parted fails to parse the fake MBR partition table created by dosfstools-4.2 for FAT12 images
Product: Red Hat Enterprise Linux 9 Reporter: Laszlo Ersek <lersek>
Component: partedAssignee: Brian Lane <bcl>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: rjones
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-03 00:54:36 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:

Description Laszlo Ersek 2021-11-24 06:42:45 UTC
*** Description of problem:

In dosfstools-4.2 a new option appeared, called "--mbr". Under circumstances that matter much to libguestfs, namely when the disk being formatted is (a) non-removable and (b) unpartitioned (that is, a whole disk, not a partition), the "--mbr" option defaults to "yes". (For the sake of the reproducer below, we'll use an explicit "--mbr=yes".) When this option is in effect, "mkfs.fat" overlays the first sector of the medium (the FAT boot sector) with a bogus MBR partition table. The table has one entry, and it describes a partition that spans the entire disk, covering the partition table itself, resident in the first sector of the medium. This is supposed to placate Windows (otherwise Windows does not recognize the FAT filesystem on a non-removable device), and to work with Linux utilities as well (the kernel itself, and blkid, and so on). However, in case the chosen FAT variant is FAT12, parted rejects the partition table with the error message "Invalid partition table - recursive partition".

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

- parted-3.4-6.el9.x86_64
  (it should reproduce with upstream parted too, as of commit b20227adf575)

- dosfstools-4.2-3.el9.x86_64

*** How reproducible:

Always.

*** Steps to Reproduce:

(1) rm -f image
    fallocate -l 1M image
    mkfs.fat --mbr=yes image
    parted -m -s -- image unit b print 

(2) rm -f image
    fallocate -l 255M image
    mkfs.fat -F 12 --mbr=yes image
    parted -m -s -- image unit b print 

(In both cases, FAT12 is used. In the first case, "mkfs.fat" picks FAT12 automatically, based on the size of the image. In the second case, we force FAT12.)

*** Actual results:

parted prints the following:

(1)

(stderr) Error: Invalid partition table - recursive partition on /root/image.
(stdout) BYT;
(stdout) /root/image:1048576B:file:512:512:unknown::;

(2)

(stderr) Error: Invalid partition table - recursive partition on /root/image.
(stdout) BYT;
(stdout) /root/image:267386880B:file:512:512:unknown::;

and parted exits with status 1. No partition information is listed.

*** Expected results:

In case (2), the disk image (255MB) is large enough for us to force either FAT16 or FAT32 (passing "-F 16" and "-F 32" to "mkfs.fat", respectively). In those cases, the partition output is [almost] as expected:

(2 / FAT16)

(stdout) BYT;
(stdout) /root/image:267386880B:file:512:512:loop::;
(stdout) 1:0B:267386879B:267386880B:fat16::;

(2 / FAT32)

(stdout) BYT;
(stdout) /root/image:267386880B:file:512:512:loop::;
(stdout) 1:0B:267386879B:267386880B:fat32::;

(And exit status 0 in both sub-cases.)

The same kind of output is expected with FAT12 as well.

Note: where I wrote "[almost] as expected" above, I alluded to the *separate bug* that "parted" prints the partition table *type* as "loop", instead of "mbr". I'm going to file a separate BZ about that.

Comment 1 Brian Lane 2021-12-03 00:54:29 UTC
This is because parted doesn't support detecting FAT12, which is basically a failure to detect FAT16 or 32, so it would end up causing false positives. And then it tries to parse the fake, invalid, msdos partition and complains.

Comment 2 RHEL Program Management 2021-12-03 00:54:36 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.