Bug 2175971

Summary: GPT PMBR size mismatch in iso file created by xorriso
Product: [Fedora] Fedora Reporter: David Sandalf <dsspamcatcher>
Component: libisoburnAssignee: Robert Scheck <redhat-bugzilla>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: hhorak, redhat-bugzilla, scdbackup
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:
Attachments:
Description Flags
xorriso commands used to create ISO file
none
mkisofile emulation commands used to create ISO file
none
updated xorriso commands used to create iso file none

Description David Sandalf 2023-03-07 01:28:18 UTC
Created attachment 1948593 [details]
xorriso commands used to create ISO file

Description of problem: fdisk shows a GPT PMBR size mismatch error on a file generated by xorriso


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


How reproducible: generate an ISO file using attachment xorrisofile.sh


Steps to Reproduce:
1. Unpack Fedora 37 ISO file
2. Repack into directory used for xorriso source
3. Use xorriso to create ISO file (see xorrisofile.sh attachment)
4. fdisk on ISO file

Actual results: fdisk on ISO file shows GPT PMBR size mismatch error


Expected results: no error from fdisk


Additional info: if the ISO file is generated using mkisofs emulation mode, fdisk shows no error (see mkisofsfile.sh attachment)

Comment 1 David Sandalf 2023-03-07 01:36:22 UTC
Created attachment 1948594 [details]
mkisofile emulation commands used to create ISO file

Comment 2 Robert Scheck 2023-06-15 23:49:48 UTC
Relaying the response from upstream: I guess the difference between the native xorriso commands in xorrisofile.sh and the mkisofs options in attachment #1948594 [details] is the different default endpadding in the two command modes.

You could try the following command additionally in xorrisofile.sh:

   -padding included

From 'man xorriso':
>  -padding number["k"|"m"]|"included"|"appended"
>      Append the given number of extra  bytes  to  the  image  stream.
>      This  is  a  traditional  remedy  for a traditional bug in block
>      device read drivers. Needed only for CD recordings in TAO  mode.
>      Since  one  can  hardly predict on what media an image might end
>      up, xorriso adds the traditional 300k of padding by  default  to
>      all images.
>      For  images  which  will  never  get  to  a CD it is safe to use
>      -padding 0 .
>      Normally padding is not written as part of  the  ISO  image  but
>      appended after the image end. This is -padding mode "appended".
>      Emulation command -as "mkisofs" and command -jigdo cause padding
>      to be written as part of the image.  The same effect is achieved
>      by -padding mode "included".

Additional information: fdisk will complain again after the ISO is copied onto an USB stick, because then again the size of the storage device will not match the size in the Protective MBR. Further the location of the Backup GPT will not be correct.
There are partition editors which can repair this state on the USB stick to get a flawless GPT.

In case further support is needed, please consider contacting https://lists.gnu.org/mailman/listinfo/bug-xorriso directly.

Comment 3 David Sandalf 2023-06-20 20:57:39 UTC
Unfortunately, adding

   -padding included

does not fix the problem.

Comment 4 Thomas Schmitt 2023-06-28 19:05:07 UTC
Hi,

i got xorrisofile.sh to run by extracting the EFI partition and setting
variable tempfile to the path of the extracted file.
Input was the mount point of Fedora-Everything-netinst-x86_64-37-1.7.iso.

Indeed there remain 4 blocks of not included padding.
This comes from the table-of-content emulation on overwritable media,
which not only installs an additional superblock but also pads the
resulting image to a multiple of 64 KiB.
This can be prevented by command

  -compliance no_emul_toc

Afterwards the complaint of fdisk is gone here.

Note that xorriso command -blank does not truncate the image file if it
already exists. So to surely prevent any trailing stuff in the image, you
should remove the image file before the xorriso run.


(It seems that "-boot_image any appended_part_as=gpt" makes the
table-of-content emulation unrecognizable to xorriso. I will have to
investigate whether this is a bug or a feature. In any case its currently
a waste of disk blocks.)

Have a nice day :)

Thomas

Comment 5 Thomas Schmitt 2023-06-28 19:07:31 UTC
(No, i do not need info from redhat-bugzilla)

Comment 6 Thomas Schmitt 2023-06-28 19:50:02 UTC
(aatempt to clear the needinfo request)

Comment 7 David Sandalf 2023-07-01 20:28:35 UTC
Created attachment 1973662 [details]
updated xorriso commands used to create iso file

Comment 8 David Sandalf 2023-07-01 20:36:40 UTC
I got xorriso to work, thanks to your help.

I had to add both "-padding included" and "-compliance no_emul_toc" to the commands.

I also needed to remove the -blank command and delete the output file before xorriso started.

I have attached the new commands, including the way I generated the tempfile.