Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 2178043

Summary: Use GPT partition types compatible with systemd-gpt-auto-generator by default
Product: [Fedora] Fedora Reporter: Vitaly Kuznetsov <vkuznets>
Component: anacondaAssignee: Vladimír Slávik <vslavik>
Status: POST --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anaconda-maint-list, bcl, berrange, blivet-maint-list, crobinso, dlehman, japokorn, jkonecny, jstodola, kraxel, mkolman, rvykydal, vponcova, vslavik, vtrefny, w
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
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:

Description Vitaly Kuznetsov 2023-03-14 09:58:18 UTC
To be compatible with systemd-gpt-auto-generator (https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html) for partitioning auto discovers, specific partition GUIDs need to be used (see "Table 1. Partition Type GUIDs"). The suggestion is to use these partition GUIDs by default for 'standard' (non-lvm) partitioning.

E.g. on x86_64 system, root filesystem will need to be created with "4f68bce3-e8cd-4db1-96e7-fbcaf984b709" partition GUID (and not "Linux filesystem" 0FC63DAF-8483-4772-8E79-3D69D8477DE4 used by default today).

GPT auto generator is an important feature in conjunction with Unified Kernel Images (UKIs). As UKI's kernel command line is set during kernel package build, it becomes impossible to pass custom 'kernel=' options to the kernel so partitioning must be discovered automatically.

Making it possible to install UKI instead of a normal kernel with anaconda in some cases may also be interesting but I suggest to create a separate BZ for it (if needed). This one is solely focused on partitioning.

Comment 1 Brian Lane 2023-03-14 17:03:38 UTC
FYI - pyparted support for the new parted UUID functions will need to be backported/rebased for this to work.

Also, I don't think we should be changing the default partition UUIDs in the middle of a release cycle. This seems like a change that should at least be optional, if not wait for the next major RHEL release.

Comment 2 Vitaly Kuznetsov 2023-03-15 09:26:40 UTC
(In reply to Brian Lane from comment #1)
> 
> Also, I don't think we should be changing the default partition UUIDs in the
> middle of a release cycle. This seems like a change that should at least be
> optional, if not wait for the next major RHEL release.

The change would only affect new setups, not existing ones so I was thinking 
it might still be OK to change the default. I may, however, underestimate the
importance of Partition GUIDs staying constant for some setups.

Providing an option in RHEL9 and making it the default in RHEL10 also sounds
like a very reasonable approach.

Comment 3 Jiri Konecny 2023-03-16 10:12:20 UTC
Hello, are you planning to backport Unified kernel support to RHEL-9? If not than I would focus on getting this upstream and RHEL-10 from there instead.

Comment 4 Brian Lane 2023-03-16 15:51:08 UTC
(In reply to Vitaly Kuznetsov from comment #2)

> The change would only affect new setups, not existing ones so I was thinking 
> it might still be OK to change the default. I may, however, underestimate the
> importance of Partition GUIDs staying constant for some setups.

I don't have any specific examples, but I'm sure there are people who do an install and then validate it using their own tools. It would be a surprising change to have the default UUIDs change without asking for it.

> 
> Providing an option in RHEL9 and making it the default in RHEL10 also sounds
> like a very reasonable approach.

I think that's the best approach.

Comment 5 Vitaly Kuznetsov 2023-03-16 17:05:45 UTC
(In reply to Jiri Konecny from comment #3)
> Hello, are you planning to backport Unified kernel support to RHEL-9? If not
> than I would focus on getting this upstream and RHEL-10 from there instead.

Yes, we already have it (TechPreview) in 9.2 https://bugzilla.redhat.com/show_bug.cgi?id=2142102

Note, there's no hard requirement on anaconda to support that at this moment, UKI
is only going to be used for Confidential VMs in clouds and these normally use
pre-generated images. For kickstart installs, Partition GUIDs can also be adjusted with
e.g. sfdisk when needed. This is more a 'nice to have' feature.

Comment 6 Jan Stodola 2023-03-23 12:48:26 UTC
Brain, this functionality doesn't seem to be fully implemented upstream, the following UUIDs were created on a disk with GPT disk label (tested using Fedora rawhide):

[root@localhost ~]# lsblk -p -o NAME,PARTTYPE,mountpoint /dev/vda
NAME        PARTTYPE                             MOUNTPOINT
/dev/vda                                         
├─/dev/vda1 c12a7328-f81f-11d2-ba4b-00a0c93ec93b /boot/efi
├─/dev/vda2 0fc63daf-8483-4772-8e79-3d69d8477de4 /boot
├─/dev/vda3 0fc63daf-8483-4772-8e79-3d69d8477de4 /
└─/dev/vda4 0fc63daf-8483-4772-8e79-3d69d8477de4 /home
[root@localhost ~]#

Is anything missing in pyparted or any other component needs to be involved?


Vitaly, I agree with Brian that we should not change the current behavior in RHEL-9, and introduce this feature in RHEL-10. This bug should rather be tracked against Fedora to make sure it's fully implemented there first.

Comment 7 Brian Lane 2023-03-24 15:24:23 UTC
(In reply to Jan Stodola from comment #6)
> Brain, this functionality doesn't seem to be fully implemented upstream, the
> following UUIDs were created on a disk with GPT disk label (tested using
> Fedora rawhide):
> 
> [root@localhost ~]# lsblk -p -o NAME,PARTTYPE,mountpoint /dev/vda
> NAME        PARTTYPE                             MOUNTPOINT
> /dev/vda                                         
> ├─/dev/vda1 c12a7328-f81f-11d2-ba4b-00a0c93ec93b /boot/efi
> ├─/dev/vda2 0fc63daf-8483-4772-8e79-3d69d8477de4 /boot
> ├─/dev/vda3 0fc63daf-8483-4772-8e79-3d69d8477de4 /
> └─/dev/vda4 0fc63daf-8483-4772-8e79-3d69d8477de4 /home
> [root@localhost ~]#
> 
> Is anything missing in pyparted or any other component needs to be involved?

Depends on what you mean by fully implemented :) In rawhide you can set arbitrary UUIDs with parted by using the 'type' command. pyparted also supports this new libparted API. The default UUIDs have not changed though, that would need to be implemented by Blivet (and possibly Anaconda). So if you are just creating new partitions you will not see anything different.

Comment 8 Jan Stodola 2023-03-24 16:07:09 UTC
By fully implemented I meant that the installer would automatically set the correct UUIDs for the partitions based on their mount points or usage (/boot, /, /home, /usr, swap,...) as described here: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/

So, I'm reassigning this bug to blivet for now, to be implemented in Fedora first.

Comment 9 Vojtech Trefny 2023-03-27 11:45:46 UTC
Support for the discoverable partitions was added in blivet 3.7.0 which is available in Fedora 38 so if there isn't anything else needed, I think we can either close this as duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1075288 or move back to Anaconda.

Comment 10 Jan Stodola 2023-03-27 12:08:32 UTC
OK, so moving back to anaconda to start using discoverable partitions.
Here is the relevant blivet PR: https://github.com/storaged-project/blivet/pull/1080

Comment 11 Jiri Konecny 2023-04-13 11:52:43 UTC
Hi Vojta, what is required from Anaconda to enable this?

Comment 12 Vojtech Trefny 2023-06-21 08:21:53 UTC
You just need to set the `gpt_discoverable_partitions` flag to True, everything else will be automatic.

Comment 13 Vladimír Slávik 2023-07-27 19:25:22 UTC
Here is a draft PR just to check it does what advertised. What interface do we use to make it optional? Since it's a single global flag in Blivet, it seems a poor match for anything in kickstart. I wonder if it should be a config option or a boot option?

https://github.com/rhinstaller/anaconda/pull/4974

Comment 14 Vitaly Kuznetsov 2023-07-28 14:25:10 UTC
On the one hand, making it configurable make sense but honestly I don't see why this shouldn't be the new default:
I don't see downsides from using this new GUIDs even in the autodiscovery feature is not going to be used. It may,
however, make sense to preserve the existing behavior in RHEL.

In case it's possible to set per-partition, I'd suggest to make it a 'part' flag, e.g. '--legacy-guid' but
looking at he pull request I think it's global. In that case it can be a 'bootloader' option I guess...

Comment 15 Vojtech Trefny 2023-07-28 14:31:51 UTC
Can this be a problem with dualboot -- can we break booting of a preexisting installation that uses systemd boot if we suddenly add a new Fedora / partition with "root GUID"? If this isn't a problem, I think it could be default without a configuration option.

Comment 16 Vitaly Kuznetsov 2023-09-19 14:28:24 UTC
(In reply to Vojtech Trefny from comment #15)
> Can this be a problem with dualboot -- can we break booting of a preexisting
> installation that uses systemd boot if we suddenly add a new Fedora /
> partition with "root GUID"? If this isn't a problem, I think it could be
> default without a configuration option.

Honestly, I can't think of a scenario when this would be a problem. For existing installations,
which don't use GPT partition auto-discovery (more or less all existing installations), partition
GUIDs should not matter much. For new installations, where GPT partition auto-discovery IS supposed
to be used (when UKI is used instead of the standard kernel -- anaconda doesn't support that yet), 
I would not expect to see more than one set of discoverable partitions on the same disk, it makes no
sense. Going forward, Anaconda may refuse to do UKI based setup in case there's any ambiguity in
partitioning but this can certainly be sorted out later.

Comment 17 Vojtech Trefny 2023-09-20 07:14:03 UTC
(In reply to Vitaly Kuznetsov from comment #16)
> I would not expect to see more than one set of discoverable partitions on
> the same disk, it makes no
> sense.

If we turn this feature on by default than we'll have two sets of discoverable partitions on the same disk every time someone decides to have two Fedora installations in dualboot. We can assume this won't happen very often, but it can happen and if the result is unbootable system, than we can't have this enabled by default. So my question is still the same -- what will happen if I have two root partitions on the same disk in this case?

Comment 18 Vitaly Kuznetsov 2023-09-26 11:52:50 UTC
(In reply to Vojtech Trefny from comment #17)
> (In reply to Vitaly Kuznetsov from comment #16)
> > I would not expect to see more than one set of discoverable partitions on
> > the same disk, it makes no sense.
> 
> If we turn this feature on by default than we'll have two sets of
> discoverable partitions on the same disk every time someone decides to have
> two Fedora installations in dualboot. We can assume this won't happen very
> often, but it can happen and if the result is unbootable system, than we
> can't have this enabled by default. So my question is still the same -- what
> will happen if I have two root partitions on the same disk in this case?

For the existing, standard kernel setup when you pass explicit "root=<UUID>" on the
command line nothing is going to change, it does not really matter if partition
GUIDs are "discoverable" or not. I don't see any risk to dual-booted systems here, 
things will keep working as usual even if you have multiple partition sets: partition
UUIDs are still unique, they're independent from GUIDs (types).

In case someone explicitly wants to use 'GPT autodiscovery' feature by not supplying "root=.."
on the kernel command line (and anaconda doesn't create such setups) he/she must be sure that 
the right root partition will be auto-discovered but this is a generic problem: if you have two
setups on the same drive and don't want to specify which one you want to boot, how would the
system decide what you want?

Comment 19 Vladimír Slávik 2023-10-04 11:42:53 UTC
Ah, thanks for the explanation. So if I read this right: Systems installed by anaconda explicitly pick the place to boot, so there's no detection taking place. Using the new GUIDs won't change anything for such setups. And if someone modifies their system, they need to do it by hand, and know what they're doing, so they will know they have two Fedoras... likely... Is that correct?

Is there any other distro using this, or is Fedora the only consideration this far?

Comment 20 Vitaly Kuznetsov 2023-10-04 12:02:19 UTC
(In reply to Vladimír Slávik from comment #19)
> Ah, thanks for the explanation. So if I read this right: Systems installed
> by anaconda explicitly pick the place to boot, so there's no detection
> taking place. Using the new GUIDs won't change anything for such setups. And
> if someone modifies their system, they need to do it by hand, and know what
> they're doing, so they will know they have two Fedoras... likely... Is that
> correct?

Yes, it is. We may want to add an option to install UKI instead of a normal kernel 
image to Anaconda in the future and it would certainly make sense to add a check that
there's just one set of 'discoverable' partitions on the target disk but for now it's
all 'manual'.

For the reference, here's a kickstart which I use to create UKI-based Fedora image:
https://people.redhat.com/~vkuznets/Fedora-UKI-rh.ks

> 
> Is there any other distro using this, or is Fedora the only consideration
> this far?

AFAIK Ubuntu uses UKI for Azure CVM image too and thus they also rely on 'discoverable'
GUIDs but honestly I'm not sure if this has anything to do with Anaconda.

Comment 21 Vladimír Slávik 2023-10-17 14:21:43 UTC
*** Bug 2160074 has been marked as a duplicate of this bug. ***

Comment 22 Daniel Berrangé 2023-10-17 14:25:24 UTC
(In reply to Vitaly Kuznetsov from comment #18)
> (In reply to Vojtech Trefny from comment #17)
> > (In reply to Vitaly Kuznetsov from comment #16)
> > > I would not expect to see more than one set of discoverable partitions on
> > > the same disk, it makes no sense.
> > 
> > If we turn this feature on by default than we'll have two sets of
> > discoverable partitions on the same disk every time someone decides to have
> > two Fedora installations in dualboot. We can assume this won't happen very
> > often, but it can happen and if the result is unbootable system, than we
> > can't have this enabled by default. So my question is still the same -- what
> > will happen if I have two root partitions on the same disk in this case?
> 
> For the existing, standard kernel setup when you pass explicit "root=<UUID>"
> on the
> command line nothing is going to change, it does not really matter if
> partition
> GUIDs are "discoverable" or not. I don't see any risk to dual-booted systems
> here, 
> things will keep working as usual even if you have multiple partition sets:
> partition
> UUIDs are still unique, they're independent from GUIDs (types).

IOW it depends on what scenarios we want to protect against. Historically
all *default* installs by anaconda will have resilted in 'root=<UUID>' being set.
So setting GPT discoverable GUIDs won't break any default historicall Fedora/RHEL
installs.

We don't know what other OS distros have done, however, so there is a risk that
by installing new Fedora, we'll berak some other distro install on the same disk
that is relying on GPT discovery.

To protect against that scenario would require us to detect if any other
pre-existing partitions aside from the ESP are present and avoid enabling 
GPT discoverable partitions. 

This would, however, complicate life if we ever want to /rely/ on GPT discovery
in future, to stop setting "root=<UUID>", but maybe we can worry about that when
the time comes ?


> In case someone explicitly wants to use 'GPT autodiscovery' feature by not
> supplying "root=.."
> on the kernel command line (and anaconda doesn't create such setups) he/she
> must be sure that 
> the right root partition will be auto-discovered but this is a generic
> problem: if you have two
> setups on the same drive and don't want to specify which one you want to
> boot, how would the
> system decide what you want?

That's what a bootloader UI is for.

Comment 23 Vladimír Slávik 2023-10-17 15:17:57 UTC
Amended https://github.com/rhinstaller/anaconda/pull/4974 to have also config.