[Bug 2081724] Re: [SRU] A "target-resize" scenario is suggested but the disk does not have room for more primary partitions

Olivier Gayot 2081724 at bugs.launchpad.net
Fri Jan 17 10:10:35 UTC 2025


** Changed in: subiquity
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to subiquity in Ubuntu.
https://bugs.launchpad.net/bugs/2081724

Title:
  [SRU] A "target-resize" scenario is suggested but the disk does not
  have room for more primary partitions

Status in subiquity:
  Fix Released
Status in subiquity package in Ubuntu:
  Confirmed
Status in subiquity source package in Noble:
  Confirmed

Bug description:
  [ Impact ]

   * Subiquity advertises "guided-resize" scenarios that cannot be honored because the disk does not have enough room for the required primary partitions. If the user selects such a scenario, the installation fails early.
  * Examples of such "impossible" scenarios include:
     * If a DOS partitioned disk has 4 existing primary partitions, no matter what partition gets resized, the resulting gap is unusable because no more partitions can be added.
     * On UEFI, if a DOS partitioned disk has 3 existing primary partitions and no ESP, resizing a partition will only make room for 1 more partition, not 2 (1 needed for the ESP and one for the system).
     * ...

  [ Test Plan ]

   * Boot the 24.04.1 desktop ISO (can be a VM).
   * If testing the fix, refresh the `ubuntu-desktop-bootstrap` snap to a patched version.
   * Open a terminal and partition the disk in such a way that 4 primary partitions exist (and the last one is large enough to be resized):
      # fdisk /dev/vda
  ```
  Disklabel type: dos
  /dev/vda1      2048   206847    204800    100M 83 Linux
  /dev/vda2   206848    411647    204800    100M 83 Linux
  /dev/vda3   411648    616447    204800    100M 83 Linux
  /dev/vda4   616448  41943039  41326592   19.7G 83 Linux
  ```
  * Create the FS at least on the partition to resize:
    $ mkfs.ext4 /dev/vda4

   * Go through the desktop installer screens normally until "Disk setup"
   * Select "Install Ubuntu alongside other partitions". If testing the patched version, the "Install Ubuntu alongside other partitions" option should not be offered.
   * Go through the next screens. At some point the installer will show a "Something went wrong" screen.
   * $ sudo grep -F "No known plan" /var/log/installer/subiquity-server-debug.log

  [ Where problems could occur ]

  * This change removes the option for affected users to do a
  installation using resize. Some users might see treat this as a
  regression (why isn't the option offered anymore ?!).

  * By removing the option for "impossible" scenarios, more users will
  hopefully try target reformat instead of target resize. However, more
  users will also try manual partitioning. We know that manual
  partitioning is not as user friendly as it should and therefore is a
  source of bugs in the installer.

  * If the fix is not fully correct, there is a chance that we would
  stop offering valid target resize scenarios, so we should make sure
  that typical use-cases are properly tested.

  [ Other Info ]

   * The fix to backport is
  https://github.com/canonical/subiquity/pull/2090

  [ Original description ]

  In private bug reports, we noticed that Subiquity sometimes fails to
  apply a target-resize scenario because the disk does not have enough
  room for more partitions. This is more common with DOS partitions
  tables since we can only have 4 primary partitions.

  Ideally, we should only make Subiquity suggest scenarios that we are
  confident can be applied. One way to ensure they can be applied would
  be to apply them in a throwaway filesystem model ; but this requires a
  lot of work.

  To limit the number of "bad" target-resize scenarios suggested, we
  could check the number of available partitions and compare it with the
  number of partitions that we /think/ we would require to add. This
  wouldn't be a perfect solution but should limit the number of possible
  errors.

  Here's the stack trace of an occurrence of the issue.

  2023-12-07 05:26:50,235 DEBUG root:30 start: subiquity/Filesystem/v2_guided_POST:
  2023-12-07 05:26:50,237 DEBUG subiquity.server.controllers.filesystem:1152 GuidedChoiceV2(target=GuidedStorageTargetResize(disk_id='disk-nvme0n1', partition_number=2, new_size=895145788059, minimum=675641556992, recommended=1006511325184, maximum=1012127498240, allowed=[<GuidedCapability.DIRECT: 2>, <GuidedCapability.LVM: 3>, <GuidedCapability.LVM_LUKS: 4>, <GuidedCapability.ZFS: 5>], disallowed=[]), capability=<GuidedCapability.DIRECT: 2>, recovery_key=None, sizing_policy=<SizingPolicy.ALL: 2>, reset_partition=False)
  2023-12-07 05:26:50,239 DEBUG subiquity.models.filesystem:2105 adding fat32 to Partition(device=disk-nvme0n1, size=1127219200, wipe='superblock', flag='boot', number=4, grub_device=True, offset=895199739904, id='partition-0')
  2023-12-07 05:26:50,243 DEBUG root:30 finish: subiquity/Filesystem/v2_guided_POST: SUCCESS: 500 Traceback (most recent call last):
    File "/snap/ubuntu-desktop-installer/126...
  2023-12-07 05:26:50,243 DEBUG subiquity.server.server:448 request to /storage/v2/guided crashed
  Traceback (most recent call last):
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/common/api/server.py", line 164, in handler
      result = await implementation(**args)
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/server/controllers/filesystem.py", line 1154, in v2_guided_POST
      await self.guided(data)
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/server/controllers/filesystem.py", line 735, in guided
      self.guided_direct(gap)
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/server/controllers/filesystem.py", line 511, in guided_direct
      self.create_partition(device=gap.device, gap=gap, spec=spec)
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/common/filesystem/manipulator.py", line 103, in create_partition
      part = self.model.add_partition(
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/models/filesystem.py", line 2010, in add_partition
      p = Partition(
    File "<attrs generated init subiquity.models.filesystem.Partition>", line 24, in __init__
      self.__attrs_post_init__()
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/models/filesystem.py", line 210, in _do_post_inits
      fn(obj)
    File "/snap/ubuntu-desktop-installer/1269/bin/subiquity/subiquity/models/filesystem.py", line 854, in __post_init__
      raise Exception("Exceeded number of available partitions")
  Exception: Exceeded number of available partitions

To manage notifications about this bug go to:
https://bugs.launchpad.net/subiquity/+bug/2081724/+subscriptions




More information about the foundations-bugs mailing list