Skip to content

Conversation

@ipetrov117
Copy link
Contributor

This PR attempts to fix the below described problems, while also providing additional unit test.

Problem:

  1. When the source deployment (e.g. a deployment coming from elmenetal3 customize --install-description) defines a partition slice that is smaller than the partition slice of the dest deployment (e.g. an install.yaml file from an ISO installer media) the dest deployment partition slice is disregarded and only the src partition slice is present.
  2. As stated in the code Disks and Partitions are merged one by one in order. That is fine for Disks, however when merging partitions we get the following problems:
    1. Entries that are present in the destination deployment, but are not present in the source deployment will be replaced.
    2. Merging partitions one by one without checking what we are merging causes different partitions to be merged together which breaks the deployment state.

Example for problem (1):

  1. install.yaml file in an ISO installer before customization:

    ...
    disks:
      - partitions:
        - label: EFI
           fileSystem: vfat
           size: 1024
           role: efi
           mountPoint: /boot
           mountOpts:
             - defaults
             - x-systemd.automount
         - label: RECOVERY
           fileSystem: btrfs
           size: 1280
           role: recovery
           hidden: true
         - label: SYSTEM
           fileSystem: btrfs
           role: system
           mountPoint: /
           mountOpts:
             - ro=vfs
           rwVolumes:
             - path: /var
               noCopyOnWrite: true
               mountOpts:
                 - x-initrd.mount
             - path: /root
               mountOpts:
                 - x-initrd.mount
             - path: /etc
               snapshotted: true
               mountOpts:
                 - x-initrd.mount
             - path: /opt
             - path: /srv
             - path: /home
     ...
  2. Source deployment that is passed to the installer media using elemental3 customize --install-description deployment.yaml ..:

    disks:
     - target: /dev/sda
       partitions: []
  3. After booting the customized installer media, the merged install.yaml deployment file looks like this:

    ...
    disks: 
      - target: /dev/sda
        partitions: []
    ...
  4. Which in turn produces the following error in the elemental-autoinstall.service:

    Nov 19 15:57:32 localhost.localdomain elemental3ctl[1452]: 2025/11/19 15:57:32 inconsistent deployment setup found: no 'system' partition defined
    

Example for problem (2):

  1. install.yaml file in an ISO installer before customization is the same as in problem (1) (Note that the RECOVERY partition is defined).
  2. Source deployment that is passed to the installer media using elemental3 customize --install-description deployment.yaml ..:
    disks:
     - target: /dev/sda
       partitions:
         - label: EFI
           fileSystem: vfat
           size: 1024
           role: efi
           mountPoint: /boot
           mountOpts:
             - defaults
             - x-systemd.automount
         - label: ignition
           fileSystem: btrfs
           size: 256
           role: data
           mountPoint: /run/elemental/firstboot
           hidden: true
         - label: ELEMENTAL-PREPARE
           fileSystem: btrfs
           size: 128
           role: data
           mountPoint: /run/elemental/prepare
           hidden: true
         - label: SYSTEM
           fileSystem: btrfs
           role: system
           mountPoint: /
           mountOpts:
             - ro=vfs
           rwVolumes:
             - path: /var
               noCopyOnWrite: true
               mountOpts:
                 - x-initrd.mount
             - path: /root
               mountOpts:
                 - x-initrd.mount
             - path: /etc
               snapshotted: true
               mountOpts:
                 - x-initrd.mount
             - path: /opt
             - path: /srv
             - path: /home
  3. After booting the customized installer media, the merged install.yaml deployment file looks like this:
    ...
    disks:
      - target: /dev/sda
         partitions:
           - label: EFI
             fileSystem: vfat
             size: 1024
             role: efi
             mountPoint: /boot
             mountOpts:
               - defaults
               - x-systemd.automount
           - label: ignition
             fileSystem: btrfs
             size: 256
             role: data
             mountPoint: /run/elemental/firstboot
             hidden: true
           - label: ELEMENTAL-PREPARE
             fileSystem: btrfs
             size: 128
             role: data
             mountPoint: /run/elemental/prepare
             mountOpts:
               - ro=vfs
             rwVolumes:
               - path: /var
                 noCopyOnWrite: true
                 mountOpts:
                   - x-initrd.mount
               - path: /root
                 mountOpts:
                   - x-initrd.mount
               - path: /etc
                 snapshotted: true
                 mountOpts:
                   - x-initrd.mount
               - path: /opt
               - path: /srv
               - path: /home
             hidden: true
           - label: SYSTEM
             fileSystem: btrfs
             role: system
             mountPoint: /
             mountOpts:
               - ro=vfs
             rwVolumes:
               - path: /var
                 noCopyOnWrite: true
                 mountOpts:
                   - x-initrd.mount
               - path: /root
                 mountOpts:
                   - x-initrd.mount
               - path: /etc
                 snapshotted: true
                 mountOpts:
                   - x-initrd.mount
               - path: /opt
               - path: /srv
               - path: /home
    ...
  4. Two are the things of note here:
    1. The RECOVERY partition that was present in the destination deployment is now missing - This happens because the ignition partition essentially overrides the RECOVERY partition, as partitions with index 1 are merged.
    2. The ELEMENTAL-PREPARE partition from the source was merged with the SYSTEM partition from dest deployment - This happens due to the merge of partitions with index 2 from both the src (ELEMNTAL-PREPARE) and dest (SYSTEM) deployments.
  5. Finally this results in the following error on the elemental-autoinstall.service:
    Nov 19 16:07:36 localhost.localdomain elemental3ctl[1415]: 2025/11/19 16:07:36 inconsistent deployment setup found: rw volume paths must be unique. Duplicated '/var'
    

Proposed Solution:

  1. Partitions with the same label in both source and destination deployments are merged
  2. Non-merged partitions (e.g. labeled partitions that are present in either source or destination) will be appended to the final result
  3. Partitions without a label will be appended to the final result.
  4. Partitions with duplicate labels from source will have only the last duplicate partition merged to destination (e.g. if 3 partitions have the same label in source, only the last defined of those 3 partitions will be merged with a partition with the same label from destination).

Example with proposed solution:

  1. install.yaml file in an ISO installer before customization is the same as in problem (1)
  2. deployment.yaml source file is the same as in problem (2)
  3. After installer media customization the merged install.yaml file looks like this:
...
  disks:
    - target: /dev/sda
      partitions:
        - label: ignition
          fileSystem: btrfs
          size: 256
          role: data
          mountPoint: /run/elemental/firstboot
          hidden: true
        - label: ELEMENTAL-PREPARE
          fileSystem: btrfs
          size: 128
          role: data
          mountPoint: /run/elemental/prepare
          hidden: true
        - label: EFI
          fileSystem: vfat
          size: 1024
          role: efi
          mountPoint: /boot
          mountOpts:
            - defaults
            - x-systemd.automount
        - label: RECOVERY
          fileSystem: btrfs
          size: 1280
          role: recovery
          hidden: true
        - label: SYSTEM
          fileSystem: btrfs
          role: system
          mountPoint: /
          mountOpts:
            - ro=vfs
          rwVolumes:
            - path: /var
              noCopyOnWrite: true
              mountOpts:
                - x-initrd.mount
            - path: /root
              mountOpts:
                - x-initrd.mount
            - path: /etc
              snapshotted: true
              mountOpts:
                - x-initrd.mount
            - path: /opt
            - path: /srv
            - path: /home
...

This essentially ensures that all partitions are merged accordingly to their counterparts, or just appended if said counterparts do not exit.

@ipetrov117 ipetrov117 marked this pull request as ready for review November 19, 2025 16:37
@ipetrov117 ipetrov117 requested a review from a team as a code owner November 19, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant