[parted-devel] Parted backward compatible issue as of commit ea81f4e

Mike Fleetwood mike.fleetwood at googlemail.com
Sun Oct 25 11:23:15 GMT 2026


On Sat, 24 Oct 2026 at 18:20, Joe Burmeister <joe.burmeister at devtank.co.uk>
wrote:

> Hi,
>
> I'm emailing you three as it seems relevant to each of you.
>
> Sorry if you all know about this, but I figured I should make sure. It
> costs me a bit of time to find so might cost others too.
>
> Using Raspberry Pi's PiGen tool building images, I've found an issue with
> commit ea81f4e of parted that removed the boot code in MBR.
>
> When there is no boot code in the MBR, older parted versions change the
> partition UUIDs when it modifies the partition table.
>
> An example of this being a problem is when the Pi resizes the partition
> during first boot in init script:
> https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/initramfs-tools/scripts/local-premount/resize_early
>
> Then of course, it can't find the given partition UUID of the root to
> mount it.
>
> Right now this means a PiGen image built with a distro with a new parted,
> builds an image that can't boot all the way and need manually fixing to
> boot.
>
> PiGen probably should add an MBR boot code to images it creates (if there
> isn't one) until the parted in the images doesn't need it to not charge the
> partition UUID. Or use the parted of the install in a chroot.
>
> Perhaps parted should have an option to put in MBR boot code for
> compatibility with legacy versions of parted.
>
> Attached is my test and results.
>
> Regards,
>
> Joe
>

 I've never used a Raspberry Pi but if I understand correctly their setup
and your issue goes like this:
1. PIGen tool creates a small Raspberry Pi disk image using a newer
   version of parted (>= v3.7) which doesn't write x86 boot code into
   the MBR.  This is written to media such as a MicroSD card which is
   larger than the disk image.
2. The Raspberry Pi is booted from the MicroSD card and on first boot it
   is passed boot parameter "resize" to resize the root partition to
   fill the MicroSD card.  This uses an older version of parted
   (<= v3.6) which adds x86 boot code into the MBR if there is none.
   This also updates the unique 32-bit disk signature (4 bytes at offset
   0x01B8 (440 decimal) in the MBR).  Blkid uses this along with the
   partition number as the partition UUID.  Thus the partition UUID of
   the root file system changes, breaking the boot process.

Please correct me if I have not understood this.

I've done a different test.  I've used fdisk to create an MBR partition
table and partition, and then used parted to resize it.  fdisk doesn't
put x86 boot code into the MBR.  When resized with parted <= 3.6 x86
boot code is written into the MBR *AND* the unique 32-bit disk signature
is updated.  When resized with parted >= 3.7 x86 boot code is not
written into the MBR and the unique 32-bit disk signature remained the
same.

It is unfortunate that first setup of an ARM CPU computer happens to
depend on parted writing x86 boot code into the MBR!  I really don't
think that parted should be re-adding x86 boot code into the MBR to fix
this.

My suggested options are:
1. The Raspberry Pi init environment is updated to use parted >= 3.7 to
   match the version of parted used in PIGen.  Then the partition UUID
   won't change when the partition is resized.
2. Update the Raspberry Pi environment to boot and mount file systems by
   FS label rather than by partition UUID.  Then it won't matter that
   the partition UUID changes when the partition is resized.

Sorry I broke this,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/parted-devel/attachments/20261025/3c0b801f/attachment.htm>


More information about the parted-devel mailing list