When modifying a GPT parted clears all GUID specific attributes. This happens even when modifying unrelated partitions, e.g. adding a new partition. According to the UEFI standard these bits must be preserved (see Table 24 of the UEFI spec[1]) even when only modifying the other attributes.
The attached patch solves the problem by having the full attributes instead of the two flags hidden and legacy_boot in GPTPartitionData and modifying the full attributes directly. Thanks, Arvin [1] https://uefi.org/sites/default/files/resources/UEFI%20Spec%202.8B%20May%202020.pdf -- Arvin Schnell, <aschn...@suse.com> Senior Software Engineer, Research & Development SUSE Software Solutions Germany GmbH Maxfeldstraße 5 90409 Nürnberg Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer