<div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, 24 Oct 2026 at 18:20, Joe Burmeister <<a href="mailto:joe.burmeister@devtank.co.uk">joe.burmeister@devtank.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u><div><div dir="auto">Hi,<br><br>I'm emailing you three as it seems relevant to each of you.<br><br>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. <br><br>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.<br><br>When there is no boot code in the MBR, older parted versions change the partition UUIDs when it modifies the partition table.<br><br>An example of this being a problem is when the Pi resizes the partition during first boot in init script: <a href="https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/initramfs-tools/scripts/local-premount/resize_early" target="_blank">https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/initramfs-tools/scripts/local-premount/resize_early</a><br><br>Then of course, it can't find the given partition UUID of the root to mount it.<br><br>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.<br><br>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.<br><br>Perhaps parted should have an option to put in MBR boot code for compatibility with legacy versions of parted.<br><br>Attached is my test and results.<br><br>Regards,<br><br>Joe </div></div></blockquote><div><br></div><div> I've never used a Raspberry Pi but if I understand correctly their setup<br>and your issue goes like this:<br>1. PIGen tool creates a small Raspberry Pi disk image using a newer<br>   version of parted (>= v3.7) which doesn't write x86 boot code into<br>   the MBR.  This is written to media such as a MicroSD card which is<br>   larger than the disk image.</div><div>2. The Raspberry Pi is booted from the MicroSD card and on first boot it<br>   is passed boot parameter "resize" to resize the root partition to<br>   fill the MicroSD card.  This uses an older version of parted<br>   (<= v3.6) which adds x86 boot code into the MBR if there is none.<br>   This also updates the unique 32-bit disk signature (4 bytes at offset<br>   0x01B8 (440 decimal) in the MBR).  Blkid uses this along with the<br>   partition number as the partition UUID.  Thus the partition UUID of<br>   the root file system changes, breaking the boot process.</div><div><br></div><div>Please correct me if I have not understood this.<br><br>I've done a different test.  I've used fdisk to create an MBR partition<br>table and partition, and then used parted to resize it.  fdisk doesn't<br>put x86 boot code into the MBR.  When resized with parted <= 3.6 x86<br>boot code is written into the MBR *AND* the unique 32-bit disk signature<br>is updated.  When resized with parted >= 3.7 x86 boot code is not<br>written into the MBR and the unique 32-bit disk signature remained the<br>same.<br><br>It is unfortunate that first setup of an ARM CPU computer happens to<br>depend on parted writing x86 boot code into the MBR!  I really don't<br>think that parted should be re-adding x86 boot code into the MBR to fix<br>this.<br><br>My suggested options are:<br>1. The Raspberry Pi init environment is updated to use parted >= 3.7 to<br>   match the version of parted used in PIGen.  Then the partition UUID<br>   won't change when the partition is resized.<br>2. Update the Raspberry Pi environment to boot and mount file systems by<br>   FS label rather than by partition UUID.  Then it won't matter that<br>   the partition UUID changes when the partition is resized.<br><br>Sorry I broke this,<br>Mike</div><div><br></div><div><br></div></div></div>