Bug 2175971 - GPT PMBR size mismatch in iso file created by xorriso
Summary: GPT PMBR size mismatch in iso file created by xorriso
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: libisoburn
Version: 37
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Robert Scheck
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-07 01:28 UTC by David Sandalf
Modified: 2023-07-01 20:36 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
Embargoed:


Attachments (Terms of Use)
xorriso commands used to create ISO file (862 bytes, application/x-shellscript)
2023-03-07 01:28 UTC, David Sandalf
no flags Details
mkisofile emulation commands used to create ISO file (606 bytes, text/plain)
2023-03-07 01:36 UTC, David Sandalf
no flags Details
updated xorriso commands used to create iso file (1.23 KB, application/x-shellscript)
2023-07-01 20:28 UTC, David Sandalf
no flags Details

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.


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